New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

idtbeyond

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idtbeyond

  • 1.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ruby Gem for IDT Beyond

Join the chat at https://gitter.im/IDTLabs/IDTBeyond-Ruby

The official node package for interacting with the IDT Beyond API.

Getting started with IDT Beyond

To use this service, sign up for a free account at: https://portal.idtbeyond.com, or read the documentation at https://portal.idtbeyond.com/docs.

Requirements

  • bundler
  • ruby 2.2.1

Setup your environment

  1. Make sure above requirements are fulfilled. (see site documentation in links above)
  2. run npm install idtbeyond --save to add this module to your project

Testing

Running rake spec will run the unit tests with RSpec 3.x.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/idtbeyond/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am "Add some feature")
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Usage

require "idtbeyond"
idtbeyond_iatu = IDTBeyond::Service::IATU.new "app-id", "app-key", "term-id"
Each application has a unique `app-id` and `app-key`. You can generate up to 5 keys per application, and they can be regenerated by you at any time. Make sure to use the correct ones, and update your code when new valid keys are generated.

####Parameters

ParameterRequiredTypeDescription
app-idtruestringApplication ID.
app-keytruestringApplication Key.
term-idtruestringTerminal name for the environment serving the application.

API Status

This returns the status of the IDT Beyond API.

Request:

idtbeyond_iatu.get_status

Response:

{
   "alive":true
}

Get all products

This endpoint retrieves a current list of products offered by our IATU API.

Request:

idtbeyond_iatu.get_products
[
   {
      "country":"Guatemala",
      "country_code":"GT",
      "carrier":"Tigo",
      "carrier_code":"Tigo",
      "mask":"502-XXXX-XXXX",
      "denomination":700,
      "minDenomination":700,
      "maxDenomination":700,
      "commission":"10"
   },
   {
      "country":"Argentina",
      "country_code":"AR",
      "carrier":"Movistar",
      "carrier_code":"Movistar",
      "mask":"54-XXXX-XXX-XXXX",
      "denomination":700,
      "minDenomination":700,
      "maxDenomination":700,
      "commission":"14.50"
   }
]

Local Value

Get the local value of a particular product.

Example:

idtbeyond_iatu.get_local_value amount, "carrier_code", "country_code", "currency_code"

Request:

idtbeyond_iatu.get_local_value "500", Claro, "GT", "USD"

Response:

{	
	"carrier_code":"Claro",
	"country_code":"GT",
	"amount":"500",
	"currency_code":"USD",
	"local_currency":"GTQ",
	"local_amount":"3965",
	"divisor":"100"
}

####Parameters

ParameterRequiredTypeDescription
country_codetruestring2-digit code of the country in ISO 3166 format. Ex: CO for Columbia.
carrier_codetruestringName of the mobile carrier. Ex: Tigo
currency_codetruestringThe currency code (ISO 4217) on the product you are querying. Ex: USD
amounttrueintegerThe amount of the product you would like to get the value of. Ex: 1000 = $10.00 (in cents).

Balance

This call allows you get the balance on a specific application.

Request:

idtbeyond_iatu.get_balance

Response:

{
   "balance":986834,
   "currency_code":"USD",
   "currency_symbol":"$",
   "currency_divisor":100
}

Topup

This is how you topup a phone in another country.

Example:

idtbeyond_iatu.post_topup "amount", "carrier_code", "country_code", "mobile_number"

Request:

idtbeyond_iatu.post_topup "1000", "Claro", "GT", "50212345678"

Response:

{
   "success":true,
   "client_transaction_id":"trans_id_12345",
   "transaction_id":"123345678",
   "amount":1000,
   "currency_divisor":"100",
   "currency_symbol":"$",
   "wholesaler_balance":0,
   "wholesaler_commission":100,
   "local_amount":7934,
   "local_currency":"GTQ",
   "local_divisor":"100",
   "plan":"Sandbox",
   "terminal_id":"kiosk 12",
   "carrier_code":"Claro",
   "country_code":"GT",
   "country_name":"Guatemala",
   "mobile_number":1234567890,
   "to_service_number":"0987654321",
   "from_service_number":"9999999999"
}
Your `clientTransactionId` is automatically generated by default using the `generateClientTransactionId` function.

####Parameters

ParameterRequiredTypeDescription
country_codetruestring2-digit code of the country in ISO 3166 format. (Ex: GT for Guatemala).
carrier_codetruestringName of the mobile carrier. (Ex: Claro).
amounttrueintegerThis is the amount, in cents, of the product you are purchasing. (Ex: 500 = $5.00).
mobile_numbertrueintegerMobile number to topup. VALIDATE prior to submission. (Ex: 50312345678).

##Topups Reports (all)

This will return both the totals report, and the transactions during the dates requested.

Example:

idtbeyond_iatu.get_all_topups "date_from", "date_to"

Request:

idtbeyond_iatu.get_all_topups "2015-01-04", "2015-01-05"

Response:

{
   "success":true,
   "totals":{
      "purchases":"0",
      "transfers":"-500",
      "commissions":"100",
      "transactions_count":"1",
      "actual_last_transaction_date":"2015-01-05T22:44:35",
      "query_start_date":"2015-01-04",
      "query_end_date":"2015-01-05"
   },
   "transactions":[
      {
         "mobile_number":"50212345678",
         "production_pin":"0000000001",
         "client_transaction_id":"Transaction123456",
         "currency_code":"US",
         "currency_symbol":"$",
         "currency_divisor":"100",
         "transaction_date":"2015-01-05T22:44:34",
         "transaction_method":"XFER",
         "transaction_description":"IMTU",
         "transaction_amount":"-500",
         "retail_amount":"-500",
         "retail_commission":"100",
         "account_start_balance":"60575",
         "account_end_balance":"60175",
         "product_name":"IMTU - CLARO UNIVERSAL $5"
      }
   ]
}

####Parameters

ParameterRequiredTypeDescription
date_fromtruestringYYYY-MM-DD format. Starts at 00:00:00 Eastern Time (ET). (Ex: 2015-12-01).
date_totruestringYYYY-MM-DD format. Ends at 23:59:59 Eastern Time (ET). (Ex: 2015-12-01).
Remember — All date_to and date_from queries are in Eastern Time (ET), by default.

##Topups Reports (Totals)

This returns a summary report of topups totals, within a given time period.

Example:

idtbeyond_iatu.get_all_topups_totals "date_from", "date_to"

Request:

idtbeyond_iatu.get_all_topups_totals "2015-01-01", "2015-01-02"

Response:

{
   "success":true,
   "totals":{
      "from_service_number":"133333333",
      "sales":"50000",
      "cost":"40000",
      "commissions":"10000",
      "transactions_count":"100",
      "actual_last_transaction_date":"2015-01-02T23:59:59",
      "query_start_date":"2015-01-01",
      "query_end_date":"2015-01-02",
      "currency_code":"US",
      "currency_symbol":"$",
      "currency_divisor":"100"
   }
}

####Parameters

ParameterRequiredTypeDescription
date_fromtruestringYYYY-MM-DD format. Starts at 00:00:00 Eastern Time (ET). (Ex: 2015-12-01).
date_totruestringYYYY-MM-DD format. Ends at 23:59:59 Eastern Time (ET). (Ex: 2015-12-01).
Remember — All date_to and date_from queries are in Eastern Time (ET), by default.

##Topups Reports (Search)

Search for transaction details using your client_transaction_id.

Example:

idtbeyond_iatu.client_transaction_id_search "client_transaction_id", "date_from", "date_to"

Request:

idtbeyond_iatu.client_transaction_id_search "my-client-trans-id", "2015-03-01", "2015-03-11"

Response:

{
   "success":true,
   "transaction_data":[
      {
         "currency_code":"USD",
         "currency_symbol":"$",
         "currency_divisor":"100",
         "client_transaction_id":"my-client-trans-id",
         "transaction_date":"3/1/2015 10:57:04 AM",
         "description":"Success",
         "commission":"100",
         "type":"IMTU - CLARO UNIVERSAL $5",
         "end_balance":"56915",
         "amount":"-500",
         "terminal_id":"testTerminalId",
         "transaction_status":"Success",
         "to_service_number":"117123456"
      }
   ]
}

####Parameters

ParameterRequiredTypeDescription
date_fromtruestringYYYY-MM-DD format. Starts at 00:00:00 Eastern Time (ET). (Ex: 2015-12-01).
date_totruestringYYYY-MM-DD format. Ends at 23:59:59 Eastern Time (ET). (Ex: 2015-12-01).
client_transaction_idtruestringA unique id you use to track topups (Limit of 20 characters).
Remember — All date_to and date_from queries are in Eastern Time (ET), by default.

##Topups Reports (Quick Status)

When you submit a transaction, we do some very detailed handling to complete the request. The to_service_number is a tracking method used to follow the status of this request, including the balance of the transaction handoff to the carrier. Use this endpoint to get a quick update on the status of the request.

Example:

idtbeyond_iatu.to_service_number_search "to_service_number"

Request:

idtbeyond_iatu.to_service_number_search "2712345678"

Response:

{
	"success": true,
	"transaction_data": {
		"balance": "0",
		"status": "Redeemed"
	}
}

####Parameters

ParameterRequiredTypeDescription
to_service_numbertruestringA unique IDT transaction number that gives the status of the transfer of funds from your account to the carrier.

##Topups (Reverse)

Use this method to search for the status of a particular topup transaction, using the unique clientTransactionId you supplied in the request, and use the toServiceNumber.

Occasionally, a carrier will not be able to successfully complete a topup request. In this case, we will attempt to automatically reverse the transaction for you, and return the money into your account. In the case when this is not possible, you may need to request a reverse on the transaction that has a status of "status": "Not Redeemed".

Example:

idtbeyond_iatu.reverse_topup "client_transaction_id", "to_service_number"

Request:

idtbeyond_iatu.reverse_topup "my-client-trans-id", "2712345678"

Response:

{
   "success":true,
   "account_id":"12345678",
   "client_transaction_id":"my-client-trans-id",
   "transaction_id":"111222333",
   "to_service_number":"2712345678",
   "remaining_amount":0,
   "currency_symbol":"$",
   "currency_divisor":"100"
}

####Parameters

ParameterRequiredTypeDescription
client_transaction_idtruestringA unique id you use to track topups (Limit of 16 characters).
to_service_numbertruestringThe service number of the financial transaction (moving the money between your balance and the carrier).

Charges Reports (all)

Returns a list of any credit card charges, wire-transfers, or credit adjustments on your application account. Request:

idtbeyond_iatu.get_all_charges "2015-03-01", "2015-03-11"

Response:

{
   "success":true,
   "totals":{
      "purchases":"0",
      "transfers":"0",
      "commissions":"0",
      "transactions_count":"1",
      "actual_last_transaction_date":"2015-03-02T20:04:45",
      "query_start_date":"2015-03-01",
      "query_end_date":"2015-03-11"
   },
   "transactions":[
      {
         "mobile_number":"",
         "production_pin":"",
         "client_transaction_id":"12345678",
         "currency_code":"US",
         "currency_symbol":"$",
         "currency_divisor":"100",
         "transaction_date":"2015-03-02T20:04:44",
         "transaction_method":"CREDIT_LOAD",
         "transaction_description":"Credit Load",
         "transaction_amount":"100000",
         "retail_commission":"0",
         "account_start_balance":"0",
         "account_end_balance":"100000",
         "product_name":"CREDIT_LOAD"
      }
   ]
}

####Parameters

ParameterRequiredTypeDescription
date_fromtruestringYYYY-MM-DD format. Starts at 00:00:00 Eastern Time (ET). (Ex: 2015-12-01).
date_totruestringYYYY-MM-DD format. Ends at 23:59:59 Eastern Time (ET). (Ex: 2015-12-01).
Remember — All date_to and date_from queries are in Eastern Time (ET), by default.

##Number Validator

This method validates that a phone number has a valid area code and number of digits for the selected country.

Request:

idtbeyond_iatu.validate_number "GT", "50212345678"

Response:

{
   "country_code":"GT",
   "mobile_number":"50212345678",
   "valid":true
}

####Parameters

ParameterRequiredTypeDescription
country_codetruestring2-digit code of the country in ISO 3166 format. (Ex: BR for Brazil).
mobile_numbertruestringMobile number to topup. VALIDATE prior to submission. (Ex: 5521983339000).

FAQs

Package last updated on 02 Apr 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc