tangocard

1.3.2 • Public • Published

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 devsupport@tangocard.com.

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

Version Check

Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):

npm install

Resolve Dependencies

Resolve Dependencies

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.

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.

Open Project

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.

Create new file

Save new file

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

Run file

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)

  1. Navigate to the root directory of the SDK folder from command prompt.
  2. Type mocha --recursive to run all the tests.

Method 2 (Run all tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha * to run all the tests.

Method 3 (Run specific controller's tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. 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 in TestBootstrap.js.

Run Tests

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

Class: AccountsController

Get singleton instance

The singleton instance of the AccountsController class can be accessed from the API Client.

var controller = lib.AccountsController;

Method: 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) {
 
    
    });

Method: getAllAccounts

Gets all accounts under the platform

function getAllAccounts(callback)

Example Usage

 
 
    controller.getAllAccounts(function(error, response, context) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Back to List of Controllers

Class: CatalogController

Get singleton instance

The singleton instance of the CatalogController class can be accessed from the API Client.

var controller = lib.CatalogController;

Method: getCatalog

Get Catalog

function getCatalog(callback)

Example Usage

 
 
    controller.getCatalog(function(error, response, context) {
 
    
    });

Back to List of Controllers

Class: OrdersController

Get singleton instance

The singleton instance of the OrdersController class can be accessed from the API Client.

var controller = lib.OrdersController;

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Back to List of Controllers

Class: CustomersController

Get singleton instance

The singleton instance of the CustomersController class can be accessed from the API Client.

var controller = lib.CustomersController;

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: getAllCustomers

Gets all customers under the platform

function getAllCustomers(callback)

Example Usage

 
 
    controller.getAllCustomers(function(error, response, context) {
 
    
    });

Back to List of Controllers

Class: ExchangeRatesController

Get singleton instance

The singleton instance of the ExchangeRatesController class can be accessed from the API Client.

var controller = lib.ExchangeRatesController;

Method: getExchangeRates

Retrieve current exchange rates

function getExchangeRates(callback)

Example Usage

 
 
    controller.getExchangeRates(function(error, response, context) {
 
    
    });

Back to List of Controllers

Class: StatusController

Get singleton instance

The singleton instance of the StatusController class can be accessed from the API Client.

var controller = lib.StatusController;

Method: getSystemStatus

Tags: Skips Authentication

Retrieve system status

function getSystemStatus(callback)

Example Usage

 
 
    controller.getSystemStatus(function(error, response, context) {
 
    
    });

Back to List of Controllers

Class: FundController

Get singleton instance

The singleton instance of the FundController class can be accessed from the API Client.

var controller = lib.FundController;

Method: getCreditCards

List all credit cards registered on this platform

function getCreditCards(callback)

Example Usage

 
 
    controller.getCreditCards(function(error, response, context) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Method: 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) {
 
    
    });

Back to List of Controllers

Readme

Keywords

none

Package Sidebar

Install

npm i tangocard

Weekly Downloads

5

Version

1.3.2

License

none

Last publish

Collaborators

  • meir