Skip to content

Commit 9fd395d

Browse files
committed
[REF] add missing parameters to paypro response
1 parent 67a9ecc commit 9fd395d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

packages/bitcore-wallet-client/src/lib/payproV2.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -446,31 +446,33 @@ export class PayProV2 {
446446

447447
static processResponse(responseData) {
448448
let payProDetails: any = {
449+
paymentId: responseData.paymentId,
449450
payProUrl: responseData.paymentUrl,
450451
memo: responseData.memo
451452
};
452453

453454
// otherwise, it returns err.
454455
payProDetails.verified = true;
455456

456-
// getPaymentOptions
457457
if (responseData.paymentOptions) {
458458
payProDetails.paymentOptions = responseData.paymentOptions;
459459
payProDetails.paymentOptions.forEach(option => {
460460
option.network = NetworkMap[option.network];
461461
});
462462
}
463463

464-
// network
465464
if (responseData.network) {
466465
payProDetails.network = NetworkMap[responseData.network];
467466
}
468467

469468
if (responseData.chain) {
470-
payProDetails.coin = responseData.chain?.toLowerCase(); // TODO responseData.coin ???
471469
payProDetails.chain = responseData.chain?.toLowerCase();
472470
}
473471

472+
if (responseData.currency) {
473+
payProDetails.currency = responseData.currency;
474+
}
475+
474476
if (responseData.expires) {
475477
try {
476478
payProDetails.expires = new Date(responseData.expires).toISOString();
@@ -479,6 +481,14 @@ export class PayProV2 {
479481
}
480482
}
481483

484+
if (responseData.time) {
485+
try {
486+
payProDetails.time = new Date(responseData.time).toISOString();
487+
} catch (e) {
488+
throw new Error('Bad time');
489+
}
490+
}
491+
482492
if (responseData.instructions) {
483493
payProDetails.instructions = responseData.instructions;
484494
payProDetails.instructions.forEach(output => {

0 commit comments

Comments
 (0)