elarian
Advanced tools
Comparing version 0.2.9-alpha to 0.2.9-alpha2
@@ -331,3 +331,3 @@ ## Classes | ||
* [.sendMessageByTag(tag, channelNumber, message)](#Elarian+sendMessageByTag) ⇒ <code>TagUpdateReply</code> | ||
* [.initiatePayment(debitParty, creditParty, value)](#Elarian+initiatePayment) ⇒ <code>InitiatePaymentReply</code> | ||
* [.initiatePayment(debitParty, creditParty, value, mode)](#Elarian+initiatePayment) ⇒ <code>InitiatePaymentReply</code> | ||
* [.addCustomerReminderByTag(tag, reminder)](#Elarian+addCustomerReminderByTag) ⇒ <code>TagUpdateReply</code> | ||
@@ -381,3 +381,3 @@ * [.cancelCustomerReminderByTag(tag, key)](#Elarian+cancelCustomerReminderByTag) ⇒ <code>TagUpdateReply</code> | ||
### elarian.initiatePayment(debitParty, creditParty, value) ⇒ <code>InitiatePaymentReply</code> | ||
### elarian.initiatePayment(debitParty, creditParty, value, mode) ⇒ <code>InitiatePaymentReply</code> | ||
<p>Initiate a payment transaction</p> | ||
@@ -387,7 +387,8 @@ | ||
| Param | Type | | ||
| --- | --- | | ||
| debitParty | <code>CustomerPayment</code> \| <code>Wallet</code> \| <code>Purse</code> \| <code>ChannelPayment</code> | | ||
| creditParty | <code>CustomerPayment</code> \| <code>Wallet</code> \| <code>Purse</code> \| <code>ChannelPayment</code> | | ||
| value | <code>Cash</code> | | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| debitParty | <code>CustomerPayment</code> \| <code>Wallet</code> \| <code>Purse</code> \| <code>ChannelPayment</code> | | | ||
| creditParty | <code>CustomerPayment</code> \| <code>Wallet</code> \| <code>Purse</code> \| <code>ChannelPayment</code> | | | ||
| value | <code>Cash</code> | | | ||
| mode | <code>string</code> | <p>on of [hosted, virtual]</p> | | ||
@@ -394,0 +395,0 @@ <a name="Elarian+addCustomerReminderByTag"></a> |
@@ -22,2 +22,3 @@ /* eslint-disable max-len */ | ||
AppDataUpdate, | ||
PaymentMode, | ||
DataMapValue, | ||
@@ -27,4 +28,4 @@ PaymentStatus, | ||
ActivityChannel, | ||
VoiceCallStatus, | ||
MessagingChannel, | ||
VoiceCallStatus, | ||
UssdSessionStatus, | ||
@@ -345,2 +346,3 @@ VoiceCallHangupCause, | ||
data.status = getStatusString(data.status, PaymentStatus); | ||
data.mode = getChannelProviderString(data.mode, PaymentMode); | ||
data.channelNumber = { | ||
@@ -395,6 +397,11 @@ number: data.channelNumber.number, | ||
} | ||
data.channelNumber = { | ||
number: data.channelNumber.number, | ||
channel: getChannelProviderString(data.channelNumber.channel, PaymentChannel), | ||
}; | ||
if (data.channelNumber) { | ||
data.channelNumber = { | ||
number: data.channelNumber.number, | ||
channel: getChannelProviderString(data.channelNumber.channel, PaymentChannel), | ||
}; | ||
} | ||
if (data.channel) { | ||
data.channel = getChannelProviderString(data.channel, PaymentChannel); | ||
} | ||
break; | ||
@@ -401,0 +408,0 @@ default: |
const { | ||
ElarianMessages, | ||
addCashValue, | ||
getStatusString, | ||
getChannelProvider, | ||
addPaymentCounterParty, | ||
getStatusString, | ||
} = require('./utils'); | ||
@@ -12,2 +13,3 @@ | ||
PaymentStatus, | ||
PaymentMode, | ||
AppToServerCommand, | ||
@@ -23,6 +25,7 @@ AppToServerCommandReply, | ||
* @param {Cash} value | ||
* @param {string} mode on of [hosted, virtual] | ||
* @returns {InitiatePaymentReply} | ||
* @memberof Elarian | ||
*/ | ||
Elarian.prototype.initiatePayment = function initiatePayment(debitParty, creditParty, value) { | ||
Elarian.prototype.initiatePayment = function initiatePayment(debitParty, creditParty, value, mode) { | ||
const socket = this.getSocket(); | ||
@@ -34,2 +37,8 @@ | ||
cmd = addCashValue(cmd, value); | ||
cmd = cmd.setMode( | ||
getChannelProvider( | ||
mode, | ||
PaymentMode, | ||
), | ||
); | ||
const req = new AppToServerCommand() | ||
@@ -36,0 +45,0 @@ .setInitiatePayment(cmd); |
@@ -236,3 +236,3 @@ const { RSocketClient } = require('rsocket-core'); | ||
const customer = partyOpts.customerNumber || undefined; | ||
const channel = partyOpts.channelCode || undefined; | ||
const channel = partyOpts.channel || undefined; | ||
@@ -270,12 +270,10 @@ if (wallet) { | ||
.setChannelCode(partyOpts.channelCode) | ||
.setChannelNumber( | ||
new PaymentChannelNumber() | ||
.setNumber(partyOpts.channelNumber.number) | ||
.setChannel( | ||
getChannelProvider( | ||
partyOpts.channelNumber.channel, | ||
PaymentChannel, | ||
), | ||
), | ||
.setChannel( | ||
getChannelProvider( | ||
partyOpts.channel, | ||
PaymentChannel, | ||
), | ||
) | ||
.setSource(partyOpts.source) | ||
.setDestination(partyOpts.destination) | ||
.setAccount(new StringValue().setValue(partyOpts.account)), | ||
@@ -654,4 +652,10 @@ ); | ||
onComplete: (socket) => { | ||
handleConnected(socket); | ||
resolve({ client }); | ||
setTimeout(() => { | ||
if (transport.getConnectionState().kind === 'CONNECTED') { | ||
handleConnected(socket); | ||
resolve({ client }); | ||
} else { | ||
reject(new Error(`Failed to connect: ${transport.getConnectionState().kind}`)); | ||
} | ||
}, 1000); | ||
}, | ||
@@ -658,0 +662,0 @@ onError: (error) => { |
@@ -364,3 +364,3 @@ /* eslint-disable max-len */ | ||
* @property {string} transactionId | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, pass_through, failed, throttled, expired, rejected, reversed] | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, failed, throttled, expired, rejected, reversed] | ||
*/ | ||
@@ -376,3 +376,3 @@ | ||
* @property {Cash} value | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, pass_through, failed, throttled, expired, rejected, reversed] | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, failed, throttled, expired, rejected, reversed] | ||
*/ | ||
@@ -385,3 +385,3 @@ | ||
* @property {string} transactionId | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, pass_through, failed, throttled, expired, rejected, reversed] | ||
* @property {string} status one of [queued, pending_confirmation, pending_validation, validated, invalid_request, not_supported, insufficient_funds, application_error, not_allowed, duplicate_request, invalid_purse, invalid_wallet, decommissioned_customer_id, success, failed, throttled, expired, rejected, reversed] | ||
*/ | ||
@@ -574,3 +574,3 @@ | ||
* @property {string} number | ||
* @property {string} channel number provider. Must be one of ['cellular'] | ||
* @property {string} channel number provider. Must be one of ['cellular', 'airtime'] | ||
*/ | ||
@@ -577,0 +577,0 @@ |
{ | ||
"name": "elarian", | ||
"version": "0.2.9-alpha", | ||
"version": "0.2.9-alpha2", | ||
"description": "Elarian JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
9973092
173106