stewardbank-sso v0.0.25
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:
- Instantiated the
StewardBankSSO
object. This object somes with thestewardbank-sso
library. 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:
- Instantiated the
StewardBankSSO
object. This object somes with thestewardbank-sso
library. - Calling the
payment
method, this method takes thePayment DTO
below. The clientID and clientSecret be found in the developer section of the merchant portal, The methodpayment
returns a promise whose response you should listen for inorder to determine whether the action was successful or not. Sample promise response:
The boolean{ "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 }
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: '',
}
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago