0.0.25 • Published 2 years ago

stewardbank-sso v0.0.25

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Building and Deploying

npm run build
npm login
npm publish

Make sure you bump the version before publishing

Javascript SDK

This SDK allows a JS client to initiate authentication and payment related actions.

Installation

The package is a webpack module and has a dependancy on StompJS. To start using simply install via yarn or npm.

yarn add stewardbank-sso

Then import into your project and use.

To use in a script tage you can use an import similar to this.

<script src="/node_modules/stewardbank-sso/dist/index_bundle.js"></script>

This will make a variable StewardBankSSO globally available;

Auth Usage

Actions currently available:

  • REGISTER
  • LOGIN
  • VALIDATE

Example:

import StewardBankSSO from "stewardbank-sso"

let sso = new StewardBankSSO(); // 1.
sso.auth({ // 2.
    clientId: 'merchant_platform', 
    clientSecret: 'a1sds2s2-a9c5-4b14-9ec7-b9d402534891', 
    action: 'REGISTER'
})
.then(data => console.log("sso auth response", data));

Going step by step this is what happened:

  1. Instantiated the StewardBankSSO object. This object somes with the stewardbank-sso library.
  2. Calling the auth method, this method takes AuthDto object below. The clientID and clientSecret be found in the developer section of the merchant portal.

    The method auth returns a promise whose response you should listen for inorder to determine whether the action was successful or not. Sample promise response:

    {
        "complete": true,
        "body": {},
        "success": false,
    }

    The boolean success indicates whether the action was successful or not and the object body will contain whatever payload is relevant to the action taken, usually the customer profile.

Auth DTO:

{
    clientId: '',
    clientSecret: '',
    action: 'LOGIN'
}

Payment Usage

Example:

let sso = new StewardBankSSO(); // 1.
sso.payment({ // 2.
    clientId: 'merchant_platform', 
    clientSecret: 'a1sds2s2-a9c5-4b14-9ec7-b9d402534891', 
    amount: '20', // 3.
    destinationAccount: '1003862468', // 4.
    productUids: 'fdb76b39-d9d9-4f71-a9c5-b9d402534891:1,67536169-6374-4302-a9c5-b9d402534891:2', // 5.
    hash: '55a2078e9ffdfd0a21193791e716ea6b' // 6.
});

Going step by step this is what happened:

  1. Instantiated the StewardBankSSO object. This object somes with the stewardbank-sso library.
  2. Calling the payment method, this method takes the Payment DTO below. The clientID and clientSecret be found in the developer section of the merchant portal, The method payment returns a promise whose response you should listen for inorder to determine whether the action was successful or not. Sample promise response:
    {
      "body": {
        "account": "1003862468",
        "addData": null,
        "amount": 1290,
        "displayErrorMessage": null,
        "errorMessage": null,
        ...
        "phone": "263773591219",
        "productUids": "fdb76b39-d9d9-4f71-9b25-3d2271103771:1,67536169-6374-4302-b54a-616fc85c4b6e:2",
        "receiptData": null,
        "reference": "083d0a6e-bb63-4d70-9330-32af1afcb925",
        "status": "SUCCESS",
        "type": "INTEGRATION",
        "uid": "09110a60-3fca-4770-8395-540379da1226",
        "userUid": "79875914-70e4-4214-bebb-2a936673f3da",
      },
      "complete": true,
      "success": true
    }
    The boolean success indicates whether the action was successful or not and the object body will contain the result of the transation request.

Payment DTO:

{
    clientId: '',
    clientSecret: '',
    destinationPhone: '',
    destinationAccount: '',
    amount: '',
    productUids: '',
    hash: '',
}
0.0.24

2 years ago

0.0.25

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.16-beta

3 years ago

0.0.15-beta

3 years ago

0.0.14-beta

3 years ago

0.0.11-beta

3 years ago

0.0.12-beta

3 years ago

0.0.13-beta

3 years ago

0.0.9-beta

3 years ago

0.0.10-beta

3 years ago

0.0.8-beta

3 years ago

0.0.7-beta

3 years ago

0.0.6-beta

3 years ago

0.0.5-beta

3 years ago

0.0.4-beta

3 years ago

0.0.3-beta

3 years ago

0.0.2-beta

3 years ago

0.0.1-beta

3 years ago