@singularity-payments/core 1.3.0 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +20 -5
- package/dist/index.mjs +20 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -263,7 +263,7 @@ interface DynamicQRResponse {
|
|
|
263
263
|
QRCode: string;
|
|
264
264
|
}
|
|
265
265
|
interface C2BSimulateRequest {
|
|
266
|
-
|
|
266
|
+
shortCode?: string;
|
|
267
267
|
amount: number;
|
|
268
268
|
phoneNumber: string;
|
|
269
269
|
billRefNumber: string;
|
|
@@ -318,6 +318,13 @@ interface CallbackHandlerOptions {
|
|
|
318
318
|
isSuccess: boolean;
|
|
319
319
|
transactionId?: string;
|
|
320
320
|
amount?: number;
|
|
321
|
+
conversationId?: string;
|
|
322
|
+
originatorConversationId?: string;
|
|
323
|
+
debitAccountBalance?: string;
|
|
324
|
+
debitPartyAffectedAccountBalance?: string;
|
|
325
|
+
transactionCompletedTime?: string;
|
|
326
|
+
receiverPartyPublicName?: string;
|
|
327
|
+
currency?: string;
|
|
321
328
|
errorMessage?: string;
|
|
322
329
|
}) => void | Promise<void>;
|
|
323
330
|
onAccountBalanceResult?: (data: {
|
|
@@ -416,6 +423,13 @@ declare class MpesaCallbackHandler {
|
|
|
416
423
|
isSuccess: boolean;
|
|
417
424
|
transactionId?: string;
|
|
418
425
|
amount?: number;
|
|
426
|
+
conversationId?: string;
|
|
427
|
+
originatorConversationId?: string;
|
|
428
|
+
debitAccountBalance?: string;
|
|
429
|
+
debitPartyAffectedAccountBalance?: string;
|
|
430
|
+
transactionCompletedTime?: string;
|
|
431
|
+
receiverPartyPublicName?: string;
|
|
432
|
+
currency?: string;
|
|
419
433
|
errorMessage?: string;
|
|
420
434
|
};
|
|
421
435
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -263,7 +263,7 @@ interface DynamicQRResponse {
|
|
|
263
263
|
QRCode: string;
|
|
264
264
|
}
|
|
265
265
|
interface C2BSimulateRequest {
|
|
266
|
-
|
|
266
|
+
shortCode?: string;
|
|
267
267
|
amount: number;
|
|
268
268
|
phoneNumber: string;
|
|
269
269
|
billRefNumber: string;
|
|
@@ -318,6 +318,13 @@ interface CallbackHandlerOptions {
|
|
|
318
318
|
isSuccess: boolean;
|
|
319
319
|
transactionId?: string;
|
|
320
320
|
amount?: number;
|
|
321
|
+
conversationId?: string;
|
|
322
|
+
originatorConversationId?: string;
|
|
323
|
+
debitAccountBalance?: string;
|
|
324
|
+
debitPartyAffectedAccountBalance?: string;
|
|
325
|
+
transactionCompletedTime?: string;
|
|
326
|
+
receiverPartyPublicName?: string;
|
|
327
|
+
currency?: string;
|
|
321
328
|
errorMessage?: string;
|
|
322
329
|
}) => void | Promise<void>;
|
|
323
330
|
onAccountBalanceResult?: (data: {
|
|
@@ -416,6 +423,13 @@ declare class MpesaCallbackHandler {
|
|
|
416
423
|
isSuccess: boolean;
|
|
417
424
|
transactionId?: string;
|
|
418
425
|
amount?: number;
|
|
426
|
+
conversationId?: string;
|
|
427
|
+
originatorConversationId?: string;
|
|
428
|
+
debitAccountBalance?: string;
|
|
429
|
+
debitPartyAffectedAccountBalance?: string;
|
|
430
|
+
transactionCompletedTime?: string;
|
|
431
|
+
receiverPartyPublicName?: string;
|
|
432
|
+
currency?: string;
|
|
419
433
|
errorMessage?: string;
|
|
420
434
|
};
|
|
421
435
|
/**
|
package/dist/index.js
CHANGED
|
@@ -512,17 +512,32 @@ var MpesaCallbackHandler = class {
|
|
|
512
512
|
const result = callback.Result;
|
|
513
513
|
const parsed = {
|
|
514
514
|
isSuccess: result.ResultCode === 0,
|
|
515
|
+
transactionId: result.TransactionID,
|
|
516
|
+
conversationId: result.ConversationID,
|
|
517
|
+
originatorConversationId: result.OriginatorConversationID,
|
|
515
518
|
errorMessage: result.ResultCode !== 0 ? this.getErrorMessage(result.ResultCode) : void 0
|
|
516
519
|
};
|
|
517
520
|
if (result.ResultCode === 0 && result.ResultParameters) {
|
|
518
521
|
result.ResultParameters.ResultParameter.forEach((param) => {
|
|
519
522
|
switch (param.Key) {
|
|
520
|
-
case "
|
|
521
|
-
parsed.transactionId = String(param.Value);
|
|
522
|
-
break;
|
|
523
|
-
case "TransactionAmount":
|
|
523
|
+
case "Amount":
|
|
524
524
|
parsed.amount = Number(param.Value);
|
|
525
525
|
break;
|
|
526
|
+
case "DebitAccountBalance":
|
|
527
|
+
parsed.debitAccountBalance = String(param.Value);
|
|
528
|
+
break;
|
|
529
|
+
case "DebitPartyAffectedAccountBalance":
|
|
530
|
+
parsed.debitPartyAffectedAccountBalance = String(param.Value);
|
|
531
|
+
break;
|
|
532
|
+
case "TransCompletedTime":
|
|
533
|
+
parsed.transactionCompletedTime = String(param.Value);
|
|
534
|
+
break;
|
|
535
|
+
case "ReceiverPartyPublicName":
|
|
536
|
+
parsed.receiverPartyPublicName = String(param.Value);
|
|
537
|
+
break;
|
|
538
|
+
case "Currency":
|
|
539
|
+
parsed.currency = String(param.Value);
|
|
540
|
+
break;
|
|
526
541
|
}
|
|
527
542
|
});
|
|
528
543
|
}
|
|
@@ -1206,7 +1221,7 @@ var MpesaClient = class {
|
|
|
1206
1221
|
}
|
|
1207
1222
|
const phone = this.validateAndFormatPhone(request.phoneNumber);
|
|
1208
1223
|
const payload = {
|
|
1209
|
-
ShortCode: request.
|
|
1224
|
+
ShortCode: request.shortCode || this.config.shortcode,
|
|
1210
1225
|
CommandID: request.commandID || "CustomerPayBillOnline",
|
|
1211
1226
|
Amount: Math.floor(request.amount),
|
|
1212
1227
|
Msisdn: phone,
|
package/dist/index.mjs
CHANGED
|
@@ -463,17 +463,32 @@ var MpesaCallbackHandler = class {
|
|
|
463
463
|
const result = callback.Result;
|
|
464
464
|
const parsed = {
|
|
465
465
|
isSuccess: result.ResultCode === 0,
|
|
466
|
+
transactionId: result.TransactionID,
|
|
467
|
+
conversationId: result.ConversationID,
|
|
468
|
+
originatorConversationId: result.OriginatorConversationID,
|
|
466
469
|
errorMessage: result.ResultCode !== 0 ? this.getErrorMessage(result.ResultCode) : void 0
|
|
467
470
|
};
|
|
468
471
|
if (result.ResultCode === 0 && result.ResultParameters) {
|
|
469
472
|
result.ResultParameters.ResultParameter.forEach((param) => {
|
|
470
473
|
switch (param.Key) {
|
|
471
|
-
case "
|
|
472
|
-
parsed.transactionId = String(param.Value);
|
|
473
|
-
break;
|
|
474
|
-
case "TransactionAmount":
|
|
474
|
+
case "Amount":
|
|
475
475
|
parsed.amount = Number(param.Value);
|
|
476
476
|
break;
|
|
477
|
+
case "DebitAccountBalance":
|
|
478
|
+
parsed.debitAccountBalance = String(param.Value);
|
|
479
|
+
break;
|
|
480
|
+
case "DebitPartyAffectedAccountBalance":
|
|
481
|
+
parsed.debitPartyAffectedAccountBalance = String(param.Value);
|
|
482
|
+
break;
|
|
483
|
+
case "TransCompletedTime":
|
|
484
|
+
parsed.transactionCompletedTime = String(param.Value);
|
|
485
|
+
break;
|
|
486
|
+
case "ReceiverPartyPublicName":
|
|
487
|
+
parsed.receiverPartyPublicName = String(param.Value);
|
|
488
|
+
break;
|
|
489
|
+
case "Currency":
|
|
490
|
+
parsed.currency = String(param.Value);
|
|
491
|
+
break;
|
|
477
492
|
}
|
|
478
493
|
});
|
|
479
494
|
}
|
|
@@ -1157,7 +1172,7 @@ var MpesaClient = class {
|
|
|
1157
1172
|
}
|
|
1158
1173
|
const phone = this.validateAndFormatPhone(request.phoneNumber);
|
|
1159
1174
|
const payload = {
|
|
1160
|
-
ShortCode: request.
|
|
1175
|
+
ShortCode: request.shortCode || this.config.shortcode,
|
|
1161
1176
|
CommandID: request.commandID || "CustomerPayBillOnline",
|
|
1162
1177
|
Amount: Math.floor(request.amount),
|
|
1163
1178
|
Msisdn: phone,
|