Socket
Socket
Sign inDemoInstall

@nsoft/seven-sdk

Package Overview
Dependencies
19
Maintainers
7
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @nsoft/seven-sdk

The official Seven SDK for JavaScript


Version published
Maintainers
7
Install size
3.31 MB
Created

Readme

Source

Publishing

Seven SDK for JavaScript

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

  • Wallet API

Installing

npm install @nsoft/seven-sdk

Usage and Getting Started

Import modules required by your application:

import sdk from '@nsoft/seven-sdk';

or using CommonJS:

const sdk = require('@nsoft/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.

Keywords

FAQs

Last updated on 13 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc