tangocard
v1.3.2
Published
With this RESTful API you can integrate a global reward or incentive program into your app or platform. If you have any questions or if you'd like to receive your own credentials, please contact us at [email protected].
Downloads
39
Readme
Getting started
With this RESTful API you can integrate a global reward or incentive program into your app or platform. If you have any questions or if you'd like to receive your own credentials, please contact us at [email protected].
How to Build
The generated SDK relies on Node Package Manager (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from here. The SDK also requires Node to be installed. If Node isn't already installed, please install it from here
NPM is installed by default when Node is installed
To check if node and npm have been successfully installed, write the following commands in command prompt:
node --version
npm -version
Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):
npm install
This will install all dependencies in the node_modules
folder.
Once dependencies are resolved, you will need to move the folder Raas
in to your node_modules
folder.
How to Use
The following section explains how to use the library in a new project.
1. Open Project Folder
Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Click on File
and select Open Folder
.
Select the folder of your SDK and click on Select Folder
to open it up in Sublime Text. The folder will become visible in the bar on the left.
2. Creating a Test File
Now right click on the folder name and select the New File
option to create a new test file. Save it as index.js
Now import the generated NodeJS library using the following lines of code:
var lib = require('lib');
Save changes.
3. Running The Test File
To run the index.js
file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:
node index.js
How to Test
These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:
Method 1 (Run all tests)
- Navigate to the root directory of the SDK folder from command prompt.
- Type
mocha --recursive
to run all the tests.
Method 2 (Run all tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha *
to run all the tests.
Method 3 (Run specific controller's tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha Tango Card RaaS v2 APIController
to run all the tests in that controller file.
To increase mocha's default timeout, you can change the
TEST_TIMEOUT
parameter's value inTestBootstrap.js
.
Initialization
Authentication
In order to setup authentication in the API client, you need the following information.
| Parameter | Description | |-----------|-------------| | platformName | RaaS v2 API Platform Name | | platformKey | RaaS v2 API Platform Key |
API client can be initialized as following:
const lib = require('lib');
// Configuration parameters and credentials
lib.Configuration.platformName = "QAPlatform2"; // RaaS v2 API Platform Name
lib.Configuration.platformKey = "apYPfT6HNONpDRUj3CLGWYt7gvIHONpDRUYPfT6Hj"; // RaaS v2 API Platform Key
Class Reference
List of Controllers
- AccountsController
- CatalogController
- OrdersController
- CustomersController
- ExchangeRatesController
- StatusController
- FundController
AccountsController
Get singleton instance
The singleton instance of the AccountsController
class can be accessed from the API Client.
var controller = lib.AccountsController;
getAccount
Get an account
function getAccount(accountIdentifier, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| accountIdentifier | Required
| Account Identifier |
Example Usage
var accountIdentifier = 'accountIdentifier';
controller.getAccount(accountIdentifier, function(error, response, context) {
});
getAllAccounts
Gets all accounts under the platform
function getAllAccounts(callback)
Example Usage
controller.getAllAccounts(function(error, response, context) {
});
createAccount
Create an account under a given customer
function createAccount(customerIdentifier, body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| customerIdentifier | Required
| Customer Identifier |
| body | Required
| Request Body |
Example Usage
var customerIdentifier = 'customerIdentifier';
var body = new CreateAccountRequestModel({"key":"value"});
controller.createAccount(customerIdentifier, body, function(error, response, context) {
});
getAccountsByCustomer
Gets a list of accounts for a given customer
function getAccountsByCustomer(customerIdentifier, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| customerIdentifier | Required
| Customer Identifier |
Example Usage
var customerIdentifier = 'customerIdentifier';
controller.getAccountsByCustomer(customerIdentifier, function(error, response, context) {
});
CatalogController
Get singleton instance
The singleton instance of the CatalogController
class can be accessed from the API Client.
var controller = lib.CatalogController;
getCatalog
Get Catalog
function getCatalog(callback)
Example Usage
controller.getCatalog(function(error, response, context) {
});
OrdersController
Get singleton instance
The singleton instance of the OrdersController
class can be accessed from the API Client.
var controller = lib.OrdersController;
getOrder
TODO: Add a method description
function getOrder(referenceOrderID, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| referenceOrderID | Required
| Reference Order ID |
Example Usage
var referenceOrderID = 'referenceOrderID';
controller.getOrder(referenceOrderID, function(error, response, context) {
});
createOrder
TODO: Add a method description
function createOrder(body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| body | Required
| TODO: Add a parameter description |
Example Usage
var body = new CreateOrderRequestModel({"key":"value"});
controller.createOrder(body, function(error, response, context) {
});
getOrders
TODO: Add a method description
function getOrders(input, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| accountIdentifier | Optional
| TODO: Add a parameter description |
| customerIdentifier | Optional
| TODO: Add a parameter description |
| externalRefID | Optional
| TODO: Add a parameter description |
| startDate | Optional
| TODO: Add a parameter description |
| endDate | Optional
| TODO: Add a parameter description |
| elementsPerBlock | Optional
| TODO: Add a parameter description |
| page | Optional
| TODO: Add a parameter description |
Example Usage
var input = [];
input['accountIdentifier'] = 'accountIdentifier';
input['customerIdentifier'] = 'customerIdentifier';
input['externalRefID'] = 'externalRefID';
input['startDate'] = date("D M d, Y G:i");
input['endDate'] = date("D M d, Y G:i");
input['elementsPerBlock'] = 78;
input['page'] = 78;
controller.getOrders(input, function(error, response, context) {
});
createResendOrder
TODO: Add a method description
function createResendOrder(referenceOrderID, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| referenceOrderID | Required
| TODO: Add a parameter description |
Example Usage
var referenceOrderID = 'referenceOrderID';
controller.createResendOrder(referenceOrderID, function(error, response, context) {
});
CustomersController
Get singleton instance
The singleton instance of the CustomersController
class can be accessed from the API Client.
var controller = lib.CustomersController;
getCustomer
Get a customer
function getCustomer(customerIdentifier, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| customerIdentifier | Required
| Customer Identifier |
Example Usage
var customerIdentifier = 'customerIdentifier';
controller.getCustomer(customerIdentifier, function(error, response, context) {
});
createCustomer
Create a new customer
function createCustomer(body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| body | Required
| Request Body |
Example Usage
var body = new CreateCustomerRequestModel({"key":"value"});
controller.createCustomer(body, function(error, response, context) {
});
getAllCustomers
Gets all customers under the platform
function getAllCustomers(callback)
Example Usage
controller.getAllCustomers(function(error, response, context) {
});
ExchangeRatesController
Get singleton instance
The singleton instance of the ExchangeRatesController
class can be accessed from the API Client.
var controller = lib.ExchangeRatesController;
getExchangeRates
Retrieve current exchange rates
function getExchangeRates(callback)
Example Usage
controller.getExchangeRates(function(error, response, context) {
});
StatusController
Get singleton instance
The singleton instance of the StatusController
class can be accessed from the API Client.
var controller = lib.StatusController;
getSystemStatus
Tags:
Skips Authentication
Retrieve system status
function getSystemStatus(callback)
Example Usage
controller.getSystemStatus(function(error, response, context) {
});
FundController
Get singleton instance
The singleton instance of the FundController
class can be accessed from the API Client.
var controller = lib.FundController;
getCreditCards
List all credit cards registered on this platform
function getCreditCards(callback)
Example Usage
controller.getCreditCards(function(error, response, context) {
});
createCreditCard
Register a new credit card
function createCreditCard(body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| body | Required
| TODO: Add a parameter description |
Example Usage
var body = new CreateCreditCardRequestModel({"key":"value"});
controller.createCreditCard(body, function(error, response, context) {
});
createUnregisterCreditCard
Unregister a credit card
function createUnregisterCreditCard(body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| body | Required
| TODO: Add a parameter description |
Example Usage
var body = new UnregisterCreditCardRequestModel({"key":"value"});
controller.createUnregisterCreditCard(body, function(error, response, context) {
});
createDeposit
Fund an account
function createDeposit(body, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| body | Required
| TODO: Add a parameter description |
Example Usage
var body = new DepositRequestModel({"key":"value"});
controller.createDeposit(body, function(error, response, context) {
});
getDeposit
Get details for a specific credit card deposit
function getDeposit(depositId, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| depositId | Required
| Deposit ID |
Example Usage
var depositId = 'depositId';
controller.getDeposit(depositId, function(error, response, context) {
});
getCreditCard
Get details for a specific credit card
function getCreditCard(token, callback)
Parameters
| Parameter | Tags | Description |
|-----------|------|-------------|
| token | Required
| Card Token |
Example Usage
var token = 'token';
controller.getCreditCard(token, function(error, response, context) {
});