Skip to content

seven-sdk 1.5.0

Install from the command line:
Learn more about npm packages
$ npm install @nsftx/seven-sdk@1.5.0
Install via package.json:
"@nsftx/seven-sdk": "1.5.0"

About this version

Publishing

Seven SDK for JavaScript

The official Seven SDK for JavaScript, available for browsers (where applicable), or Node.js backends. Sources for implementation:

Installing

npm install @nsftx/seven-sdk

Usage and Getting Started

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);

Wallet

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',
});

Getting Help

Contact us at Slack channel #team-seven;

Opening Issues

Please create detailed issue on GitHub Issues.

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.

Details


Assets

  • seven-sdk-1.5.0.tgz

Download activity

  • Total downloads 112
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all