Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

africastalking

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

africastalking - npm Package Compare versions

Comparing version 0.6.4 to 0.6.5

43

lib/airtime.js

@@ -5,3 +5,2 @@ 'use strict';

const { phoneValidator } = require('./utils');
const initializeAxios = require('./customAxios');

@@ -53,15 +52,37 @@

findTransactionStatus(transactionId) {
return new Promise((resolve, reject) => {
if(!transactionId){
throw new Error(`transactionId should be provided`);
}
const { airtime } = initializeAxios(this.config);
airtime.findTransactionStatus(transactionId)
.then(function (resp) {
const httpStatus = resp.status;
if (httpStatus === 200) {
resolve(resp.data);
} else {
reject(resp.data);
};
}).catch(function (error) {
return reject(error);
});
})
}
validateOptions(options) {
const schema = Joi.object().keys({
idempotencyKey: Joi.string().optional(),
recipients: Joi.array().items(
Joi.object({
phoneNumber:Joi.string().required().custom((value)=>{
return phoneValidator(value).isValid? value : new Error(`the phone number ${value} is invalid`);
idempotencyKey: Joi.string().optional(),
recipients: Joi.array().items(
Joi.object({
phoneNumber:Joi.string().required().custom((value)=>{
return phoneValidator(value).isValid? value : new Error(`the phone number ${value} is invalid`);
}),
currencyCode: Joi.string().required(),
amount: Joi.number().required(),
}),
currencyCode: Joi.string().required(),
amount: Joi.number().required(),
}),
).min(1).required(),
maxNumRetry: Joi.number().optional(),
).min(1).required(),
maxNumRetry: Joi.number().optional(),
}).required();

@@ -68,0 +89,0 @@

@@ -11,2 +11,10 @@ const qs = require('querystring');

},
findTransactionStatus: transactionId => {
return createAxiosInstance('application/json').get(endpoints.FIND_AIRTIME_TRANSACTION, {
params: {
transactionId,
username,
}
});
}
};

@@ -13,0 +21,0 @@ };

@@ -9,4 +9,4 @@ const axios = require('axios');

const baseURL = username === 'sandbox'
? 'https://api.sandbox.africastalking.com/version1'
: 'https://api.africastalking.com/version1/';
? 'https://api.sandbox.africastalking.com'
: 'https://api.africastalking.com';

@@ -29,4 +29,5 @@ const createAxiosInstance = (contentType = 'application/x-www-form-urlencoded') => {

const endpoints = {
SEND_AIRTIME: '/airtime/send',
GET_APPLICATION_DATA: '/user',
SEND_AIRTIME: '/version1/airtime/send',
FIND_AIRTIME_TRANSACTION: '/query/transaction/find',
GET_APPLICATION_DATA: '/version1/user',
};

@@ -33,0 +34,0 @@

{
"name": "africastalking",
"version": "0.6.4",
"version": "0.6.5",
"description": "Official AfricasTalking node.js API wrapper",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -132,3 +132,7 @@ # Africa's Talking Node.js SDK

- `findTransactionStatus(transactionId)`: Find the status of a given airtime transaction.
- `transactionId`: ID of the transaction you would like to find.
For more information, please read [https://developers.africastalking.com/docs/airtime/sending](https://developers.africastalking.com/docs/airtime/sending)

@@ -135,0 +139,0 @@

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