seven-sdk 1.6.0
Install from the command line:
Learn more about npm packages
$ npm install @nsftx/seven-sdk@1.6.0
Install via package.json:
"@nsftx/seven-sdk": "1.6.0"
About this version
The official Seven SDK for JavaScript, available for browsers (where applicable), or Node.js backends. Sources for implementation:
npm install @nsftx/seven-sdk
Import modules required by your application:
import sdk from '@nsftx/seven-sdk';
or using CommonJS:
const sdk = require('@nsftx/seven-sdk').default;
Since we use @babel/plugin-transform-runtime
it is required to use @babel/runtime
with this library.
npm install --save @babel/runtime
Example of generating access key needed to access some APIs:
const accessKey = new sdk.Security.AccessKey({
keyId: '00000000-0000-0000-0000-000000000000',
keySecret: 'abcdefghijklmnopqrst',
});
Example of generating betslip barcode:
const betslip = new sdk.Betslip({
barcodePrefix: 'XX',
barcodeSalt: 'abcdef0000',
});
const barcode = betslip.getBarcode(1000);
To use wallet first create wallet instance:
const wallet = new sdk.Wallets.Wallet({
environment: 'production',
dataCenter: 'ro',
authOptions: {
keyId: 'keyId',
keySecret: 'keySecret',
},
});
Then you can use wallet instance to call wallet actions. Debit action requires two parameters, debit payload and requests payload (required for debugging and auditing), for non cash payments:
const debitResult = await wallet.debit(
{
// Debit payload
requests: [{
uuid: '08e9e088-6ee7-43de-a42f-3f1e59af10b8',
}],
paymentId: '00000000-0000-0000-0000-000000000001',
amount: 10,
bonusAmount: 0,
sourceId: 'Roulette',
refId: '8X1VTSH4D',
md5Sig: 'md5Signature',
ticket: {},
money: {
subtotal: 950,
taxApplied: 50,
total: 1000,
},
},
{
// Request payload
locale: 'en',
uuid: '064920e0-4f52-4348-8a70-0ce303f1ee47',
},
);
For cash payments, third parameter is required:
const debitResult = await wallet.debit(
{ // Debit payload ... },
{ // Request payload ... },
{
// Cash payload
cashPayment: true,
cashRegister: '08e9e088-6ee7-43de-a42f-3f1e59af10b8',
userUuid: '485251bc-73ea-4d20-9903-d35d15044130',
userUsername: 'buha',
},
);
md5Sig
property is provided by Betslip API. To generate it for testing purposes, WalletHash
method can be used.
const hash = new sdk.Wallets.WalletHash('Roulette', 'secret');
const md5Sig = hash.getSignature(requests, {
cashPayment: true,
cashRegister: '08e9e088-6ee7-43de-a42f-3f1e59af10b8',
userUuid: '485251bc-73ea-4d20-9903-d35d15044130',
});
Contact us at Slack channel #team-seven
;
Please create detailed issue on GitHub Issues.
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.