@paystack/checkout-js 1.19.0-dev.23 → 1.19.0-dev.25
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/checkout.js +523 -164
- package/es/checkout.js +523 -164
- package/lib/checkout.js +523 -164
- package/package.json +1 -1
package/lib/checkout.js
CHANGED
|
@@ -11647,7 +11647,7 @@ var PayattitudeAPI = {
|
|
|
11647
11647
|
}
|
|
11648
11648
|
};
|
|
11649
11649
|
|
|
11650
|
-
var paymentMethod$
|
|
11650
|
+
var paymentMethod$7 = 'payattitude';
|
|
11651
11651
|
var PayattitudeCharge = {
|
|
11652
11652
|
chargePayattitude: function chargePayattitude(_ref) {
|
|
11653
11653
|
var _this = this;
|
|
@@ -11658,7 +11658,7 @@ var PayattitudeCharge = {
|
|
|
11658
11658
|
phoneNumber: phoneNumber
|
|
11659
11659
|
};
|
|
11660
11660
|
return PayattitudeAPI.charge(params).then(function (response) {
|
|
11661
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
11661
|
+
_this.logAPIResponse(response, paymentMethod$7);
|
|
11662
11662
|
|
|
11663
11663
|
return response;
|
|
11664
11664
|
});
|
|
@@ -11666,7 +11666,7 @@ var PayattitudeCharge = {
|
|
|
11666
11666
|
listenForPayattitudeCharge: function listenForPayattitudeCharge(callback) {
|
|
11667
11667
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
11668
11668
|
var listenerOptions = {
|
|
11669
|
-
paymentMethod: paymentMethod$
|
|
11669
|
+
paymentMethod: paymentMethod$7,
|
|
11670
11670
|
channel: pusherChannel
|
|
11671
11671
|
};
|
|
11672
11672
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -11749,7 +11749,7 @@ var ApplePayAPI = {
|
|
|
11749
11749
|
}
|
|
11750
11750
|
};
|
|
11751
11751
|
|
|
11752
|
-
var paymentMethod$
|
|
11752
|
+
var paymentMethod$6 = 'apple pay';
|
|
11753
11753
|
var ApplePayCharge = {
|
|
11754
11754
|
validateApplePaySession: function validateApplePaySession(_ref) {
|
|
11755
11755
|
var _this = this;
|
|
@@ -11757,7 +11757,7 @@ var ApplePayCharge = {
|
|
|
11757
11757
|
var sessionUrl = _ref.sessionUrl,
|
|
11758
11758
|
displayName = _ref.displayName,
|
|
11759
11759
|
domainName = _ref.domainName;
|
|
11760
|
-
this.logAttempt(paymentMethod$
|
|
11760
|
+
this.logAttempt(paymentMethod$6);
|
|
11761
11761
|
return ApplePayAPI.validateApplePaySession({
|
|
11762
11762
|
sessionUrl: sessionUrl,
|
|
11763
11763
|
displayName: displayName,
|
|
@@ -11778,7 +11778,7 @@ var ApplePayCharge = {
|
|
|
11778
11778
|
device: this.deviceFingerprint,
|
|
11779
11779
|
paymentObject: paymentObject
|
|
11780
11780
|
}).then(function (response) {
|
|
11781
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11781
|
+
_this2.logAPIResponse(response, paymentMethod$6);
|
|
11782
11782
|
|
|
11783
11783
|
return response;
|
|
11784
11784
|
});
|
|
@@ -11834,12 +11834,12 @@ var PayPalAPI = {
|
|
|
11834
11834
|
}
|
|
11835
11835
|
};
|
|
11836
11836
|
|
|
11837
|
-
var paymentMethod$
|
|
11837
|
+
var paymentMethod$5 = 'paypal';
|
|
11838
11838
|
var PayPalCharge = {
|
|
11839
11839
|
createPayPalOrder: function createPayPalOrder() {
|
|
11840
11840
|
var _this = this;
|
|
11841
11841
|
|
|
11842
|
-
this.logAttempt(paymentMethod$
|
|
11842
|
+
this.logAttempt(paymentMethod$5);
|
|
11843
11843
|
return PayPalAPI.createOrder(this.id).then(function (response) {
|
|
11844
11844
|
_this.logAPIResponseMessage(response.message);
|
|
11845
11845
|
|
|
@@ -11850,7 +11850,7 @@ var PayPalCharge = {
|
|
|
11850
11850
|
var _this2 = this;
|
|
11851
11851
|
|
|
11852
11852
|
return PayPalAPI.captureOrder(this.id).then(function (response) {
|
|
11853
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
11853
|
+
_this2.logAPIResponse(response, paymentMethod$5);
|
|
11854
11854
|
|
|
11855
11855
|
return response;
|
|
11856
11856
|
});
|
|
@@ -17238,6 +17238,27 @@ function encrypt(toEncrypt) {
|
|
|
17238
17238
|
return jsEncrypt.encrypt(toEncrypt);
|
|
17239
17239
|
}
|
|
17240
17240
|
|
|
17241
|
+
var $$2 = _export;
|
|
17242
|
+
var $find = arrayIteration.find;
|
|
17243
|
+
var addToUnscopables = addToUnscopables$3;
|
|
17244
|
+
|
|
17245
|
+
var FIND = 'find';
|
|
17246
|
+
var SKIPS_HOLES = true;
|
|
17247
|
+
|
|
17248
|
+
// Shouldn't skip holes
|
|
17249
|
+
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
17250
|
+
|
|
17251
|
+
// `Array.prototype.find` method
|
|
17252
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
17253
|
+
$$2({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
17254
|
+
find: function find(callbackfn /* , that = undefined */) {
|
|
17255
|
+
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
17256
|
+
}
|
|
17257
|
+
});
|
|
17258
|
+
|
|
17259
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
17260
|
+
addToUnscopables(FIND);
|
|
17261
|
+
|
|
17241
17262
|
/*
|
|
17242
17263
|
* Luhn algorithm implementation in JavaScript
|
|
17243
17264
|
* Copyright (c) 2009 Nicholas C. Zakas
|
|
@@ -18214,90 +18235,18 @@ var objectToArray = {
|
|
|
18214
18235
|
values: createMethod(false)
|
|
18215
18236
|
};
|
|
18216
18237
|
|
|
18217
|
-
var $$
|
|
18238
|
+
var $$1 = _export;
|
|
18218
18239
|
var $values = objectToArray.values;
|
|
18219
18240
|
|
|
18220
18241
|
// `Object.values` method
|
|
18221
18242
|
// https://tc39.es/ecma262/#sec-object.values
|
|
18222
|
-
$$
|
|
18243
|
+
$$1({ target: 'Object', stat: true }, {
|
|
18223
18244
|
values: function values(O) {
|
|
18224
18245
|
return $values(O);
|
|
18225
18246
|
}
|
|
18226
18247
|
});
|
|
18227
18248
|
|
|
18228
|
-
var
|
|
18229
|
-
var $find = arrayIteration.find;
|
|
18230
|
-
var addToUnscopables = addToUnscopables$3;
|
|
18231
|
-
|
|
18232
|
-
var FIND = 'find';
|
|
18233
|
-
var SKIPS_HOLES = true;
|
|
18234
|
-
|
|
18235
|
-
// Shouldn't skip holes
|
|
18236
|
-
if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
|
|
18237
|
-
|
|
18238
|
-
// `Array.prototype.find` method
|
|
18239
|
-
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
18240
|
-
$$1({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
|
|
18241
|
-
find: function find(callbackfn /* , that = undefined */) {
|
|
18242
|
-
return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
18243
|
-
}
|
|
18244
|
-
});
|
|
18245
|
-
|
|
18246
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
18247
|
-
addToUnscopables(FIND);
|
|
18248
|
-
|
|
18249
|
-
var testCards = [{
|
|
18250
|
-
type: 'bank_auth',
|
|
18251
|
-
name: 'Bank authorization',
|
|
18252
|
-
number: '4084080000000409',
|
|
18253
|
-
cvv: '000',
|
|
18254
|
-
month: '01',
|
|
18255
|
-
year: '30'
|
|
18256
|
-
}, {
|
|
18257
|
-
type: 'success',
|
|
18258
|
-
name: 'Success',
|
|
18259
|
-
number: '4084084084084081',
|
|
18260
|
-
cvv: '408',
|
|
18261
|
-
month: '12',
|
|
18262
|
-
year: '30'
|
|
18263
|
-
}, {
|
|
18264
|
-
type: 'declined',
|
|
18265
|
-
name: 'Declined',
|
|
18266
|
-
number: '4084080000005408',
|
|
18267
|
-
cvv: '001',
|
|
18268
|
-
month: '12',
|
|
18269
|
-
year: '30'
|
|
18270
|
-
}, {
|
|
18271
|
-
type: 'pin',
|
|
18272
|
-
name: 'Pin only validation',
|
|
18273
|
-
number: '507850785078507812',
|
|
18274
|
-
cvv: '884',
|
|
18275
|
-
month: '01',
|
|
18276
|
-
year: '30'
|
|
18277
|
-
}, {
|
|
18278
|
-
type: 'pin+otp',
|
|
18279
|
-
name: 'Pin and OTP validation',
|
|
18280
|
-
number: '5060666666666666666',
|
|
18281
|
-
cvv: '123',
|
|
18282
|
-
month: '01',
|
|
18283
|
-
year: '30'
|
|
18284
|
-
}, {
|
|
18285
|
-
type: 'pin+phone+otp',
|
|
18286
|
-
name: 'Pin, phone and OTP validation',
|
|
18287
|
-
number: '507850785078507812',
|
|
18288
|
-
cvv: '884',
|
|
18289
|
-
month: '01',
|
|
18290
|
-
year: '30'
|
|
18291
|
-
}, {
|
|
18292
|
-
type: 'default',
|
|
18293
|
-
name: 'No validation',
|
|
18294
|
-
number: '4084084084084081',
|
|
18295
|
-
cvv: '408',
|
|
18296
|
-
month: '01',
|
|
18297
|
-
year: '30'
|
|
18298
|
-
}];
|
|
18299
|
-
|
|
18300
|
-
var Card$1 = {
|
|
18249
|
+
var Card$2 = {
|
|
18301
18250
|
getEncryptedPin: function getEncryptedPin(pin) {
|
|
18302
18251
|
return pin ? encrypt(pin) : undefined;
|
|
18303
18252
|
},
|
|
@@ -18356,7 +18305,7 @@ var Card$1 = {
|
|
|
18356
18305
|
return cardValidator.number(value);
|
|
18357
18306
|
},
|
|
18358
18307
|
isNumberValid: function isNumberValid(value) {
|
|
18359
|
-
return Card$
|
|
18308
|
+
return Card$2.validateNumber(value).isValid;
|
|
18360
18309
|
},
|
|
18361
18310
|
validateCVV: function validateCVV(cvv, cardType) {
|
|
18362
18311
|
var isAmexCard = cardType === 'american-express';
|
|
@@ -18364,7 +18313,7 @@ var Card$1 = {
|
|
|
18364
18313
|
return cardValidator.cvv(cvv, cvvLength);
|
|
18365
18314
|
},
|
|
18366
18315
|
isCvvValid: function isCvvValid(cvv, cardType) {
|
|
18367
|
-
return Card$
|
|
18316
|
+
return Card$2.validateCVV(cvv, cardType).isValid;
|
|
18368
18317
|
},
|
|
18369
18318
|
validateExpiry: function validateExpiry(value) {
|
|
18370
18319
|
if (_typeof$1(value) === 'object') {
|
|
@@ -18376,14 +18325,7 @@ var Card$1 = {
|
|
|
18376
18325
|
return cardValidator.expirationDate(value);
|
|
18377
18326
|
},
|
|
18378
18327
|
isExpiryValid: function isExpiryValid(value) {
|
|
18379
|
-
return Card$
|
|
18380
|
-
},
|
|
18381
|
-
generateTestCard: function generateTestCard(cardType) {
|
|
18382
|
-
var type = cardType || 'default';
|
|
18383
|
-
var cardParams = testCards.find(function (card) {
|
|
18384
|
-
return card.type === type;
|
|
18385
|
-
});
|
|
18386
|
-
return new Card$1(cardParams);
|
|
18328
|
+
return Card$2.validateExpiry(value).isValid;
|
|
18387
18329
|
}
|
|
18388
18330
|
};
|
|
18389
18331
|
|
|
@@ -18400,7 +18342,7 @@ cardValidator.creditCardType.addCard({
|
|
|
18400
18342
|
});
|
|
18401
18343
|
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
18402
18344
|
|
|
18403
|
-
var Card = /*#__PURE__*/function () {
|
|
18345
|
+
var Card$1 = /*#__PURE__*/function () {
|
|
18404
18346
|
function Card(_ref) {
|
|
18405
18347
|
var number = _ref.number,
|
|
18406
18348
|
cvv = _ref.cvv,
|
|
@@ -18420,17 +18362,17 @@ var Card = /*#__PURE__*/function () {
|
|
|
18420
18362
|
_createClass(Card, [{
|
|
18421
18363
|
key: "getEncryptedPin",
|
|
18422
18364
|
value: function getEncryptedPin() {
|
|
18423
|
-
return Card$
|
|
18365
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
18424
18366
|
}
|
|
18425
18367
|
}, {
|
|
18426
18368
|
key: "getLast4",
|
|
18427
18369
|
value: function getLast4() {
|
|
18428
|
-
return Card$
|
|
18370
|
+
return Card$2.getLast4(this.number);
|
|
18429
18371
|
}
|
|
18430
18372
|
}, {
|
|
18431
18373
|
key: "tokenize",
|
|
18432
18374
|
value: function tokenize() {
|
|
18433
|
-
return Card$
|
|
18375
|
+
return Card$2.tokenize({
|
|
18434
18376
|
number: this.number,
|
|
18435
18377
|
cvv: this.cvv,
|
|
18436
18378
|
month: this.month,
|
|
@@ -18440,7 +18382,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
18440
18382
|
}], [{
|
|
18441
18383
|
key: "getType",
|
|
18442
18384
|
value: function getType(value) {
|
|
18443
|
-
return Card$
|
|
18385
|
+
return Card$2.getType(value);
|
|
18444
18386
|
}
|
|
18445
18387
|
}, {
|
|
18446
18388
|
key: "validate",
|
|
@@ -18449,7 +18391,7 @@ var Card = /*#__PURE__*/function () {
|
|
|
18449
18391
|
cvv = _ref2.cvv,
|
|
18450
18392
|
month = _ref2.month,
|
|
18451
18393
|
year = _ref2.year;
|
|
18452
|
-
return Card$
|
|
18394
|
+
return Card$2.validate({
|
|
18453
18395
|
number: number,
|
|
18454
18396
|
cvv: cvv,
|
|
18455
18397
|
month: month,
|
|
@@ -18459,44 +18401,48 @@ var Card = /*#__PURE__*/function () {
|
|
|
18459
18401
|
}, {
|
|
18460
18402
|
key: "validateNumber",
|
|
18461
18403
|
value: function validateNumber(value) {
|
|
18462
|
-
return Card$
|
|
18404
|
+
return Card$2.validateNumber(value);
|
|
18463
18405
|
}
|
|
18464
18406
|
}, {
|
|
18465
18407
|
key: "isNumberValid",
|
|
18466
18408
|
value: function isNumberValid(value) {
|
|
18467
|
-
return Card$
|
|
18409
|
+
return Card$2.isNumberValid(value);
|
|
18468
18410
|
}
|
|
18469
18411
|
}, {
|
|
18470
18412
|
key: "validateCVV",
|
|
18471
18413
|
value: function validateCVV(cvv, cardType) {
|
|
18472
|
-
return Card$
|
|
18414
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
18473
18415
|
}
|
|
18474
18416
|
}, {
|
|
18475
18417
|
key: "isCvvValid",
|
|
18476
18418
|
value: function isCvvValid(cvv, cardType) {
|
|
18477
|
-
return Card$
|
|
18419
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
18478
18420
|
}
|
|
18479
18421
|
}, {
|
|
18480
18422
|
key: "validateExpiry",
|
|
18481
18423
|
value: function validateExpiry(value) {
|
|
18482
|
-
return Card$
|
|
18424
|
+
return Card$2.validateExpiry(value);
|
|
18483
18425
|
}
|
|
18484
18426
|
}, {
|
|
18485
18427
|
key: "isExpiryValid",
|
|
18486
18428
|
value: function isExpiryValid(value) {
|
|
18487
|
-
return Card$
|
|
18429
|
+
return Card$2.isExpiryValid(value);
|
|
18488
18430
|
}
|
|
18489
18431
|
}, {
|
|
18490
18432
|
key: "generateTestCard",
|
|
18491
18433
|
value: function generateTestCard(cardType) {
|
|
18492
|
-
|
|
18434
|
+
var type = cardType || 'default';
|
|
18435
|
+
var cardParams = testCards.find(function (card) {
|
|
18436
|
+
return card.type === type;
|
|
18437
|
+
});
|
|
18438
|
+
return new Card(cardParams);
|
|
18493
18439
|
}
|
|
18494
18440
|
}]);
|
|
18495
18441
|
|
|
18496
18442
|
return Card;
|
|
18497
18443
|
}();
|
|
18498
18444
|
|
|
18499
|
-
var CardAPI = {
|
|
18445
|
+
var CardAPI$1 = {
|
|
18500
18446
|
charge: function charge(_ref) {
|
|
18501
18447
|
var clientdata = _ref.clientdata,
|
|
18502
18448
|
last4 = _ref.last4,
|
|
@@ -18842,11 +18788,11 @@ var CardAPI = {
|
|
|
18842
18788
|
}
|
|
18843
18789
|
};
|
|
18844
18790
|
|
|
18845
|
-
var paymentMethod$
|
|
18791
|
+
var paymentMethod$4 = 'card';
|
|
18846
18792
|
|
|
18847
|
-
function validate$
|
|
18793
|
+
function validate$4(card, isSetter) {
|
|
18848
18794
|
return new Promise(function (resolve, reject) {
|
|
18849
|
-
var validation = Card.validate(card);
|
|
18795
|
+
var validation = Card$1.validate(card);
|
|
18850
18796
|
|
|
18851
18797
|
if (!validation.isValid) {
|
|
18852
18798
|
var throwValidation = isSetter || card.number;
|
|
@@ -18865,8 +18811,8 @@ var CardCharge = {
|
|
|
18865
18811
|
setCard: function setCard(params) {
|
|
18866
18812
|
var _this = this;
|
|
18867
18813
|
|
|
18868
|
-
return validate$
|
|
18869
|
-
_this.card = new Card(params);
|
|
18814
|
+
return validate$4(params, true).then(function () {
|
|
18815
|
+
_this.card = new Card$1(params);
|
|
18870
18816
|
});
|
|
18871
18817
|
},
|
|
18872
18818
|
rememberCard: function rememberCard() {
|
|
@@ -18881,8 +18827,8 @@ var CardCharge = {
|
|
|
18881
18827
|
return this.chargeCardWithPin(customFields);
|
|
18882
18828
|
}
|
|
18883
18829
|
|
|
18884
|
-
return validate$
|
|
18885
|
-
_this2.logAttempt(paymentMethod$
|
|
18830
|
+
return validate$4(this.card).then(function () {
|
|
18831
|
+
_this2.logAttempt(paymentMethod$4);
|
|
18886
18832
|
|
|
18887
18833
|
var chargeParams = {
|
|
18888
18834
|
clientdata: _this2.card.tokenize(),
|
|
@@ -18895,8 +18841,8 @@ var CardCharge = {
|
|
|
18895
18841
|
subscription: _this2.subscription,
|
|
18896
18842
|
customFields: customFields
|
|
18897
18843
|
};
|
|
18898
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18899
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
18844
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18845
|
+
_this2.logAPIResponse(response, paymentMethod$4);
|
|
18900
18846
|
|
|
18901
18847
|
return response;
|
|
18902
18848
|
});
|
|
@@ -18911,7 +18857,7 @@ var CardCharge = {
|
|
|
18911
18857
|
var _this3 = this;
|
|
18912
18858
|
|
|
18913
18859
|
var customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18914
|
-
this.logAttempt(paymentMethod$
|
|
18860
|
+
this.logAttempt(paymentMethod$4);
|
|
18915
18861
|
var chargeParams = {
|
|
18916
18862
|
pin: encrypt(this.card.pin),
|
|
18917
18863
|
trans: this.id,
|
|
@@ -18921,8 +18867,8 @@ var CardCharge = {
|
|
|
18921
18867
|
subscription: this.subscription,
|
|
18922
18868
|
customFields: customFields
|
|
18923
18869
|
};
|
|
18924
|
-
return CardAPI.charge(chargeParams).then(function (response) {
|
|
18925
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
18870
|
+
return CardAPI$1.charge(chargeParams).then(function (response) {
|
|
18871
|
+
_this3.logAPIResponse(response, paymentMethod$4);
|
|
18926
18872
|
|
|
18927
18873
|
return response;
|
|
18928
18874
|
});
|
|
@@ -18934,7 +18880,7 @@ var CardCharge = {
|
|
|
18934
18880
|
authorizationCode = _ref.authorizationCode,
|
|
18935
18881
|
cardLast4 = _ref.cardLast4,
|
|
18936
18882
|
pin = _ref.pin;
|
|
18937
|
-
this.logAttempt(paymentMethod$
|
|
18883
|
+
this.logAttempt(paymentMethod$4);
|
|
18938
18884
|
var encryptedPin = encrypt(pin);
|
|
18939
18885
|
var chargeParams = {
|
|
18940
18886
|
authorizationCode: authorizationCode,
|
|
@@ -18946,8 +18892,8 @@ var CardCharge = {
|
|
|
18946
18892
|
transactionType: this.transactionType,
|
|
18947
18893
|
subscription: this.subscription
|
|
18948
18894
|
};
|
|
18949
|
-
return CardAPI.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18950
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
18895
|
+
return CardAPI$1.chargeRememberedCard(chargeParams).then(function (response) {
|
|
18896
|
+
_this4.logAPIResponse(response, paymentMethod$4);
|
|
18951
18897
|
|
|
18952
18898
|
return response;
|
|
18953
18899
|
});
|
|
@@ -18965,8 +18911,8 @@ var CardCharge = {
|
|
|
18965
18911
|
device: this.deviceFingerprint
|
|
18966
18912
|
});
|
|
18967
18913
|
|
|
18968
|
-
return CardAPI.resumeCardCharge(params).then(function (response) {
|
|
18969
|
-
_this5.logAPIResponse(response, paymentMethod$
|
|
18914
|
+
return CardAPI$1.resumeCardCharge(params).then(function (response) {
|
|
18915
|
+
_this5.logAPIResponse(response, paymentMethod$4);
|
|
18970
18916
|
|
|
18971
18917
|
return response;
|
|
18972
18918
|
});
|
|
@@ -18978,8 +18924,8 @@ var CardCharge = {
|
|
|
18978
18924
|
authorizationId: authorizationId,
|
|
18979
18925
|
publicKey: this.merchant.key
|
|
18980
18926
|
};
|
|
18981
|
-
return CardAPI.forgetRememberedCard(params).then(function (response) {
|
|
18982
|
-
_this6.logAPIResponse(response, paymentMethod$
|
|
18927
|
+
return CardAPI$1.forgetRememberedCard(params).then(function (response) {
|
|
18928
|
+
_this6.logAPIResponse(response, paymentMethod$4);
|
|
18983
18929
|
|
|
18984
18930
|
return response;
|
|
18985
18931
|
});
|
|
@@ -18987,8 +18933,8 @@ var CardCharge = {
|
|
|
18987
18933
|
authenticateCard: function authenticateCard(token) {
|
|
18988
18934
|
var _this7 = this;
|
|
18989
18935
|
|
|
18990
|
-
return CardAPI.authenticate(this.id, token).then(function (response) {
|
|
18991
|
-
_this7.logAPIResponse(response, paymentMethod$
|
|
18936
|
+
return CardAPI$1.authenticate(this.id, token).then(function (response) {
|
|
18937
|
+
_this7.logAPIResponse(response, paymentMethod$4);
|
|
18992
18938
|
|
|
18993
18939
|
return response;
|
|
18994
18940
|
});
|
|
@@ -19007,8 +18953,8 @@ var CardCharge = {
|
|
|
19007
18953
|
zipCode: zipCode,
|
|
19008
18954
|
transactionId: this.id
|
|
19009
18955
|
};
|
|
19010
|
-
return CardAPI.verifyAddress(payload).then(function (response) {
|
|
19011
|
-
_this8.logAPIResponse(response, paymentMethod$
|
|
18956
|
+
return CardAPI$1.verifyAddress(payload).then(function (response) {
|
|
18957
|
+
_this8.logAPIResponse(response, paymentMethod$4);
|
|
19012
18958
|
|
|
19013
18959
|
return response;
|
|
19014
18960
|
});
|
|
@@ -19016,12 +18962,12 @@ var CardCharge = {
|
|
|
19016
18962
|
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
19017
18963
|
var listenerOptions = {
|
|
19018
18964
|
channel: "3DS_".concat(this.id),
|
|
19019
|
-
paymentMethod: paymentMethod$
|
|
18965
|
+
paymentMethod: paymentMethod$4
|
|
19020
18966
|
};
|
|
19021
18967
|
return this.listenForCharge(listenerOptions, callback);
|
|
19022
18968
|
},
|
|
19023
18969
|
requestSavedCardsOTP: function requestSavedCardsOTP(phoneNumber) {
|
|
19024
|
-
return CardAPI.requestSavedCardsOTP(phoneNumber);
|
|
18970
|
+
return CardAPI$1.requestSavedCardsOTP(phoneNumber);
|
|
19025
18971
|
},
|
|
19026
18972
|
verifySavedCardsOtp: function verifySavedCardsOtp(_ref4) {
|
|
19027
18973
|
var _this9 = this;
|
|
@@ -19040,7 +18986,7 @@ var CardCharge = {
|
|
|
19040
18986
|
};
|
|
19041
18987
|
_context.prev = 2;
|
|
19042
18988
|
_context.next = 5;
|
|
19043
|
-
return CardAPI.verifySavedCardsOtp(payload);
|
|
18989
|
+
return CardAPI$1.verifySavedCardsOtp(payload);
|
|
19044
18990
|
|
|
19045
18991
|
case 5:
|
|
19046
18992
|
response = _context.sent;
|
|
@@ -19062,19 +19008,19 @@ var CardCharge = {
|
|
|
19062
19008
|
}))();
|
|
19063
19009
|
},
|
|
19064
19010
|
getSavedCards: function getSavedCards() {
|
|
19065
|
-
return CardAPI.getSavedCards({
|
|
19011
|
+
return CardAPI$1.getSavedCards({
|
|
19066
19012
|
token: this.savedCardsToken
|
|
19067
19013
|
});
|
|
19068
19014
|
},
|
|
19069
19015
|
deleteSavedCard: function deleteSavedCard(cardCode) {
|
|
19070
|
-
return CardAPI.deleteSavedCard({
|
|
19016
|
+
return CardAPI$1.deleteSavedCard({
|
|
19071
19017
|
cardCode: cardCode,
|
|
19072
19018
|
token: this.savedCardsToken
|
|
19073
19019
|
});
|
|
19074
19020
|
},
|
|
19075
19021
|
chargeSavedCard: function chargeSavedCard(_ref5) {
|
|
19076
19022
|
var cardCode = _ref5.cardCode;
|
|
19077
|
-
return CardAPI.chargeSavedCard({
|
|
19023
|
+
return CardAPI$1.chargeSavedCard({
|
|
19078
19024
|
cardCode: cardCode,
|
|
19079
19025
|
transaction: this.id,
|
|
19080
19026
|
token: this.savedCardsToken,
|
|
@@ -19233,9 +19179,9 @@ var EMandateAPI = {
|
|
|
19233
19179
|
}
|
|
19234
19180
|
};
|
|
19235
19181
|
|
|
19236
|
-
var paymentMethod$
|
|
19182
|
+
var paymentMethod$3 = 'bank account';
|
|
19237
19183
|
|
|
19238
|
-
function validate$
|
|
19184
|
+
function validate$3(bankAccount, isSetter) {
|
|
19239
19185
|
return new Promise(function (resolve, reject) {
|
|
19240
19186
|
var validation = BankAccount.validate(bankAccount);
|
|
19241
19187
|
|
|
@@ -19253,15 +19199,15 @@ var EMandate = {
|
|
|
19253
19199
|
setBankAccount: function setBankAccount(params) {
|
|
19254
19200
|
var _this = this;
|
|
19255
19201
|
|
|
19256
|
-
return validate$
|
|
19202
|
+
return validate$3(params, true).then(function () {
|
|
19257
19203
|
_this.bankAccount = new BankAccount(params);
|
|
19258
19204
|
});
|
|
19259
19205
|
},
|
|
19260
19206
|
chargeBankAccount: function chargeBankAccount() {
|
|
19261
19207
|
var _this2 = this;
|
|
19262
19208
|
|
|
19263
|
-
return validate$
|
|
19264
|
-
_this2.logAttempt(paymentMethod$
|
|
19209
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19210
|
+
_this2.logAttempt(paymentMethod$3);
|
|
19265
19211
|
|
|
19266
19212
|
var verifyParams = {
|
|
19267
19213
|
bankId: _this2.bankAccount.bankId,
|
|
@@ -19270,7 +19216,7 @@ var EMandate = {
|
|
|
19270
19216
|
device: _this2.deviceFingerprint
|
|
19271
19217
|
};
|
|
19272
19218
|
return EMandateAPI.verify(verifyParams).then(function (response) {
|
|
19273
|
-
_this2.logAPIResponse(response, paymentMethod$
|
|
19219
|
+
_this2.logAPIResponse(response, paymentMethod$3);
|
|
19274
19220
|
|
|
19275
19221
|
return response;
|
|
19276
19222
|
});
|
|
@@ -19279,7 +19225,7 @@ var EMandate = {
|
|
|
19279
19225
|
registerBankAccount: function registerBankAccount(birthday) {
|
|
19280
19226
|
var _this3 = this;
|
|
19281
19227
|
|
|
19282
|
-
return validate$
|
|
19228
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19283
19229
|
var registerParams = {
|
|
19284
19230
|
bankId: _this3.bankAccount.bankId,
|
|
19285
19231
|
transactionId: _this3.id,
|
|
@@ -19287,7 +19233,7 @@ var EMandate = {
|
|
|
19287
19233
|
birthday: birthday
|
|
19288
19234
|
};
|
|
19289
19235
|
return EMandateAPI.register(registerParams).then(function (response) {
|
|
19290
|
-
_this3.logAPIResponse(response, paymentMethod$
|
|
19236
|
+
_this3.logAPIResponse(response, paymentMethod$3);
|
|
19291
19237
|
|
|
19292
19238
|
return response;
|
|
19293
19239
|
});
|
|
@@ -19296,7 +19242,7 @@ var EMandate = {
|
|
|
19296
19242
|
authenticateBankAccount: function authenticateBankAccount(token) {
|
|
19297
19243
|
var _this4 = this;
|
|
19298
19244
|
|
|
19299
|
-
return validate$
|
|
19245
|
+
return validate$3(this.bankAccount).then(function () {
|
|
19300
19246
|
var chargeParams = {
|
|
19301
19247
|
bankId: _this4.bankAccount.bankId,
|
|
19302
19248
|
transactionId: _this4.id,
|
|
@@ -19304,7 +19250,7 @@ var EMandate = {
|
|
|
19304
19250
|
device: _this4.deviceFingerprint
|
|
19305
19251
|
};
|
|
19306
19252
|
return EMandateAPI.authenticate(chargeParams).then(function (response) {
|
|
19307
|
-
_this4.logAPIResponse(response, paymentMethod$
|
|
19253
|
+
_this4.logAPIResponse(response, paymentMethod$3);
|
|
19308
19254
|
|
|
19309
19255
|
return response;
|
|
19310
19256
|
});
|
|
@@ -19365,7 +19311,7 @@ var DigitalBankMandateAPI = {
|
|
|
19365
19311
|
}
|
|
19366
19312
|
};
|
|
19367
19313
|
|
|
19368
|
-
var paymentMethod$
|
|
19314
|
+
var paymentMethod$2 = 'bank';
|
|
19369
19315
|
var DigitalBankMandate = {
|
|
19370
19316
|
chargeDigitalBankMandate: function chargeDigitalBankMandate(_ref) {
|
|
19371
19317
|
var _this = this;
|
|
@@ -19380,7 +19326,7 @@ var DigitalBankMandate = {
|
|
|
19380
19326
|
bankId: bankId
|
|
19381
19327
|
};
|
|
19382
19328
|
return DigitalBankMandateAPI.charge(params).then(function (response) {
|
|
19383
|
-
_this.logAPIResponse(response, paymentMethod$
|
|
19329
|
+
_this.logAPIResponse(response, paymentMethod$2);
|
|
19384
19330
|
|
|
19385
19331
|
return response;
|
|
19386
19332
|
});
|
|
@@ -19388,7 +19334,7 @@ var DigitalBankMandate = {
|
|
|
19388
19334
|
listenForDigitalBankMandateCharge: function listenForDigitalBankMandateCharge(callback) {
|
|
19389
19335
|
var pusherChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
19390
19336
|
var listenerOptions = {
|
|
19391
|
-
paymentMethod: paymentMethod$
|
|
19337
|
+
paymentMethod: paymentMethod$2,
|
|
19392
19338
|
channel: pusherChannel
|
|
19393
19339
|
};
|
|
19394
19340
|
return this.listenForCharge(listenerOptions, callback);
|
|
@@ -19521,7 +19467,7 @@ var QrAPI = {
|
|
|
19521
19467
|
}
|
|
19522
19468
|
};
|
|
19523
19469
|
|
|
19524
|
-
function validate$
|
|
19470
|
+
function validate$2(channel) {
|
|
19525
19471
|
return new Promise(function (resolve, reject) {
|
|
19526
19472
|
var allowedChannels = ['visa', 'MPASS_OLTI'];
|
|
19527
19473
|
|
|
@@ -19539,7 +19485,7 @@ var QRCharge = {
|
|
|
19539
19485
|
var _this = this;
|
|
19540
19486
|
|
|
19541
19487
|
var channel = _ref.channel;
|
|
19542
|
-
return validate$
|
|
19488
|
+
return validate$2(channel).then(function () {
|
|
19543
19489
|
if (_this.qr[channel]) {
|
|
19544
19490
|
return _this.qr[channel];
|
|
19545
19491
|
}
|
|
@@ -19561,7 +19507,7 @@ var QRCharge = {
|
|
|
19561
19507
|
var _this2 = this;
|
|
19562
19508
|
|
|
19563
19509
|
var channel = _ref2.channel;
|
|
19564
|
-
return validate$
|
|
19510
|
+
return validate$2(channel).then(function () {
|
|
19565
19511
|
if (!_this2.qr[channel]) {
|
|
19566
19512
|
return Promise.reject(Error('Please generate qr code with Transaction.getQRCode()'));
|
|
19567
19513
|
}
|
|
@@ -19682,7 +19628,7 @@ var MobileMoneyAPI = {
|
|
|
19682
19628
|
}
|
|
19683
19629
|
};
|
|
19684
19630
|
|
|
19685
|
-
function validate(phoneNumber) {
|
|
19631
|
+
function validate$1(phoneNumber) {
|
|
19686
19632
|
return new Promise(function (resolve, reject) {
|
|
19687
19633
|
var validation = PhoneNumber.validate(phoneNumber);
|
|
19688
19634
|
|
|
@@ -19703,7 +19649,7 @@ var MobileMoneyCharge = {
|
|
|
19703
19649
|
provider = _ref.provider,
|
|
19704
19650
|
voucher = _ref.voucher,
|
|
19705
19651
|
registrationToken = _ref.registrationToken;
|
|
19706
|
-
return validate(phoneNumber).then(function () {
|
|
19652
|
+
return validate$1(phoneNumber).then(function () {
|
|
19707
19653
|
_this.logAttempt('mobile money');
|
|
19708
19654
|
|
|
19709
19655
|
var params = {
|
|
@@ -19734,7 +19680,7 @@ var MobileMoneyCharge = {
|
|
|
19734
19680
|
var phoneNumber = payload.phoneNumber,
|
|
19735
19681
|
provider = payload.provider,
|
|
19736
19682
|
registrationToken = payload.registrationToken;
|
|
19737
|
-
return validate(phoneNumber).then(function () {
|
|
19683
|
+
return validate$1(phoneNumber).then(function () {
|
|
19738
19684
|
_this2.logMobileMoneyActions(payload);
|
|
19739
19685
|
|
|
19740
19686
|
var params = {
|
|
@@ -19874,7 +19820,7 @@ var DirectDebitAPI = {
|
|
|
19874
19820
|
}
|
|
19875
19821
|
};
|
|
19876
19822
|
|
|
19877
|
-
var paymentMethod = 'direct debit';
|
|
19823
|
+
var paymentMethod$1 = 'direct debit';
|
|
19878
19824
|
var DirectDebitCharge = {
|
|
19879
19825
|
loginToDirectDebitAccount: function loginToDirectDebitAccount(_ref) {
|
|
19880
19826
|
var _this = this;
|
|
@@ -19920,14 +19866,14 @@ var DirectDebitCharge = {
|
|
|
19920
19866
|
return Promise.reject(Error('Please login with Transaction.loginToDirectDebitAccount() to start a Direct debit charge'));
|
|
19921
19867
|
}
|
|
19922
19868
|
|
|
19923
|
-
this.logAttempt(paymentMethod);
|
|
19869
|
+
this.logAttempt(paymentMethod$1);
|
|
19924
19870
|
var params = {
|
|
19925
19871
|
account_code: accountCode,
|
|
19926
19872
|
transaction: this.id,
|
|
19927
19873
|
token: this.directDebit.token
|
|
19928
19874
|
};
|
|
19929
19875
|
return DirectDebitAPI.charge(params).then(function (response) {
|
|
19930
|
-
_this2.logAPIResponse(response, paymentMethod);
|
|
19876
|
+
_this2.logAPIResponse(response, paymentMethod$1);
|
|
19931
19877
|
|
|
19932
19878
|
if (response.status) {
|
|
19933
19879
|
_this2.directDebit.chargeResponse = response;
|
|
@@ -19940,7 +19886,7 @@ var DirectDebitCharge = {
|
|
|
19940
19886
|
var _this3 = this;
|
|
19941
19887
|
|
|
19942
19888
|
return DirectDebitAPI.getProvisionedAccounts(this.directDebit.token).then(function (response) {
|
|
19943
|
-
_this3.logAPIResponse(response, paymentMethod);
|
|
19889
|
+
_this3.logAPIResponse(response, paymentMethod$1);
|
|
19944
19890
|
|
|
19945
19891
|
var status = response.status,
|
|
19946
19892
|
data = response.data;
|
|
@@ -19965,7 +19911,7 @@ var DirectDebitCharge = {
|
|
|
19965
19911
|
token: this.directDebit.token
|
|
19966
19912
|
};
|
|
19967
19913
|
return DirectDebitAPI.authenticate(params).then(function (response) {
|
|
19968
|
-
_this4.logAPIResponse(response, paymentMethod);
|
|
19914
|
+
_this4.logAPIResponse(response, paymentMethod$1);
|
|
19969
19915
|
|
|
19970
19916
|
return response;
|
|
19971
19917
|
});
|
|
@@ -20751,6 +20697,417 @@ var Toolkit = /*#__PURE__*/function () {
|
|
|
20751
20697
|
return Toolkit;
|
|
20752
20698
|
}();
|
|
20753
20699
|
|
|
20700
|
+
cardValidator.creditCardType.addCard({
|
|
20701
|
+
niceType: 'Verve',
|
|
20702
|
+
type: 'verve',
|
|
20703
|
+
patterns: [[506000, 507999], [650000, 650009]],
|
|
20704
|
+
gaps: [4, 8, 12, 16],
|
|
20705
|
+
lengths: [16, 18, 19],
|
|
20706
|
+
code: {
|
|
20707
|
+
name: 'CVV',
|
|
20708
|
+
size: 3
|
|
20709
|
+
}
|
|
20710
|
+
});
|
|
20711
|
+
cardValidator.creditCardType.changeOrder('verve', 0);
|
|
20712
|
+
|
|
20713
|
+
var Card = /*#__PURE__*/function () {
|
|
20714
|
+
function Card(_ref) {
|
|
20715
|
+
var number = _ref.number,
|
|
20716
|
+
cvv = _ref.cvv,
|
|
20717
|
+
month = _ref.month,
|
|
20718
|
+
year = _ref.year,
|
|
20719
|
+
pin = _ref.pin;
|
|
20720
|
+
|
|
20721
|
+
_classCallCheck(this, Card);
|
|
20722
|
+
|
|
20723
|
+
this.number = number;
|
|
20724
|
+
this.cvv = cvv;
|
|
20725
|
+
this.month = month;
|
|
20726
|
+
this.year = year;
|
|
20727
|
+
this.pin = pin;
|
|
20728
|
+
}
|
|
20729
|
+
|
|
20730
|
+
_createClass(Card, [{
|
|
20731
|
+
key: "getEncryptedPin",
|
|
20732
|
+
value: function getEncryptedPin() {
|
|
20733
|
+
return Card$2.getEncryptedPin(this.pin);
|
|
20734
|
+
}
|
|
20735
|
+
}, {
|
|
20736
|
+
key: "getLast4",
|
|
20737
|
+
value: function getLast4() {
|
|
20738
|
+
return Card$2.getLast4(this.number);
|
|
20739
|
+
}
|
|
20740
|
+
}, {
|
|
20741
|
+
key: "tokenize",
|
|
20742
|
+
value: function tokenize() {
|
|
20743
|
+
return Card$2.tokenize({
|
|
20744
|
+
number: this.number,
|
|
20745
|
+
cvv: this.cvv,
|
|
20746
|
+
month: this.month,
|
|
20747
|
+
year: this.year
|
|
20748
|
+
});
|
|
20749
|
+
}
|
|
20750
|
+
}], [{
|
|
20751
|
+
key: "getType",
|
|
20752
|
+
value: function getType(value) {
|
|
20753
|
+
return Card$2.getType(value);
|
|
20754
|
+
}
|
|
20755
|
+
}, {
|
|
20756
|
+
key: "validate",
|
|
20757
|
+
value: function validate(_ref2) {
|
|
20758
|
+
var number = _ref2.number,
|
|
20759
|
+
cvv = _ref2.cvv,
|
|
20760
|
+
month = _ref2.month,
|
|
20761
|
+
year = _ref2.year;
|
|
20762
|
+
return Card$2.validate({
|
|
20763
|
+
number: number,
|
|
20764
|
+
cvv: cvv,
|
|
20765
|
+
month: month,
|
|
20766
|
+
year: year
|
|
20767
|
+
});
|
|
20768
|
+
}
|
|
20769
|
+
}, {
|
|
20770
|
+
key: "validateNumber",
|
|
20771
|
+
value: function validateNumber(value) {
|
|
20772
|
+
return Card$2.validateNumber(value);
|
|
20773
|
+
}
|
|
20774
|
+
}, {
|
|
20775
|
+
key: "isNumberValid",
|
|
20776
|
+
value: function isNumberValid(value) {
|
|
20777
|
+
return Card$2.isNumberValid(value);
|
|
20778
|
+
}
|
|
20779
|
+
}, {
|
|
20780
|
+
key: "validateCVV",
|
|
20781
|
+
value: function validateCVV(cvv, cardType) {
|
|
20782
|
+
return Card$2.validateCVV(cvv, cardType);
|
|
20783
|
+
}
|
|
20784
|
+
}, {
|
|
20785
|
+
key: "isCvvValid",
|
|
20786
|
+
value: function isCvvValid(cvv, cardType) {
|
|
20787
|
+
return Card$2.isCvvValid(cvv, cardType);
|
|
20788
|
+
}
|
|
20789
|
+
}, {
|
|
20790
|
+
key: "validateExpiry",
|
|
20791
|
+
value: function validateExpiry(value) {
|
|
20792
|
+
return Card$2.validateExpiry(value);
|
|
20793
|
+
}
|
|
20794
|
+
}, {
|
|
20795
|
+
key: "isExpiryValid",
|
|
20796
|
+
value: function isExpiryValid(value) {
|
|
20797
|
+
return Card$2.isExpiryValid(value);
|
|
20798
|
+
}
|
|
20799
|
+
}, {
|
|
20800
|
+
key: "generateTestCard",
|
|
20801
|
+
value: function generateTestCard(cardType) {
|
|
20802
|
+
var type = cardType || 'default';
|
|
20803
|
+
var cardParams = testCards.find(function (card) {
|
|
20804
|
+
return card.type === type;
|
|
20805
|
+
});
|
|
20806
|
+
return new Card(cardParams);
|
|
20807
|
+
}
|
|
20808
|
+
}]);
|
|
20809
|
+
|
|
20810
|
+
return Card;
|
|
20811
|
+
}();
|
|
20812
|
+
|
|
20813
|
+
var CardAPI = {
|
|
20814
|
+
reserve: function reserve(_ref) {
|
|
20815
|
+
var clientdata = _ref.clientdata,
|
|
20816
|
+
last4 = _ref.last4,
|
|
20817
|
+
preauthorizationId = _ref.preauthorizationId;
|
|
20818
|
+
var url = "".concat(configToUse.paystackApiUrl, "preauthorization/reserve");
|
|
20819
|
+
var language = getLanguage();
|
|
20820
|
+
|
|
20821
|
+
var headers = _objectSpread2({}, language && {
|
|
20822
|
+
'Accept-Language': language
|
|
20823
|
+
});
|
|
20824
|
+
|
|
20825
|
+
return axiosInstance.post(url, {
|
|
20826
|
+
clientdata: clientdata,
|
|
20827
|
+
last4: last4,
|
|
20828
|
+
preauthorization: preauthorizationId
|
|
20829
|
+
}, {
|
|
20830
|
+
headers: headers
|
|
20831
|
+
}).then(function (response) {
|
|
20832
|
+
return ChargeResponses.parse(response.data);
|
|
20833
|
+
});
|
|
20834
|
+
} // charge({
|
|
20835
|
+
// clientdata,
|
|
20836
|
+
// last4,
|
|
20837
|
+
// pin,
|
|
20838
|
+
// trans,
|
|
20839
|
+
// device,
|
|
20840
|
+
// rememberCard,
|
|
20841
|
+
// transactionType,
|
|
20842
|
+
// subscription,
|
|
20843
|
+
// customFields,
|
|
20844
|
+
// }) {
|
|
20845
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20846
|
+
// const language = getLanguage();
|
|
20847
|
+
// const headers = {
|
|
20848
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20849
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20850
|
+
// };
|
|
20851
|
+
// const chargeParams = {
|
|
20852
|
+
// clientdata,
|
|
20853
|
+
// last4,
|
|
20854
|
+
// trans,
|
|
20855
|
+
// device,
|
|
20856
|
+
// offset: new Date().getTimezoneOffset(),
|
|
20857
|
+
// remember_card: rememberCard,
|
|
20858
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20859
|
+
// ...(subscription && { subscription }),
|
|
20860
|
+
// ...(customFields && customFields),
|
|
20861
|
+
// };
|
|
20862
|
+
// if (pin) {
|
|
20863
|
+
// chargeParams.handle = pin;
|
|
20864
|
+
// }
|
|
20865
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20866
|
+
// return axiosInstance
|
|
20867
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20868
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20869
|
+
// },
|
|
20870
|
+
// resumeCardCharge({ device, accessCode, pin }) {
|
|
20871
|
+
// const url = `${config.paymentBaseUrl}charge/resume/${accessCode}`;
|
|
20872
|
+
// const language = getLanguage();
|
|
20873
|
+
// const headers = {
|
|
20874
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20875
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20876
|
+
// };
|
|
20877
|
+
// const data = { device, ...(pin && { handle: pin }) };
|
|
20878
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20879
|
+
// return axiosInstance
|
|
20880
|
+
// .post(url, urlEncodedData, { headers })
|
|
20881
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20882
|
+
// },
|
|
20883
|
+
// chargeRememberedCard({
|
|
20884
|
+
// last4,
|
|
20885
|
+
// trans,
|
|
20886
|
+
// device,
|
|
20887
|
+
// authorizationCode,
|
|
20888
|
+
// cvv,
|
|
20889
|
+
// pin,
|
|
20890
|
+
// transactionType,
|
|
20891
|
+
// subscription,
|
|
20892
|
+
// }) {
|
|
20893
|
+
// const url = `${config.paymentBaseUrl}charge/`;
|
|
20894
|
+
// const language = getLanguage();
|
|
20895
|
+
// const headers = {
|
|
20896
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20897
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20898
|
+
// };
|
|
20899
|
+
// const chargeParams = {
|
|
20900
|
+
// last4,
|
|
20901
|
+
// trans,
|
|
20902
|
+
// device,
|
|
20903
|
+
// cvv,
|
|
20904
|
+
// handle: pin,
|
|
20905
|
+
// authorization_code: authorizationCode,
|
|
20906
|
+
// ...(transactionType && { transaction_type: transactionType }),
|
|
20907
|
+
// ...(subscription && { subscription }),
|
|
20908
|
+
// };
|
|
20909
|
+
// const urlEncodedParams = formurlencoded(chargeParams);
|
|
20910
|
+
// return axiosInstance
|
|
20911
|
+
// .post(url, urlEncodedParams, { headers })
|
|
20912
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20913
|
+
// },
|
|
20914
|
+
// verifyAddress({ address, city, state, zipCode, transactionId }) {
|
|
20915
|
+
// const url = `${config.paymentBaseUrl}charge/avs`;
|
|
20916
|
+
// const language = getLanguage();
|
|
20917
|
+
// const headers = {
|
|
20918
|
+
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
20919
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20920
|
+
// };
|
|
20921
|
+
// const data = {
|
|
20922
|
+
// city,
|
|
20923
|
+
// state,
|
|
20924
|
+
// address,
|
|
20925
|
+
// zip_code: zipCode,
|
|
20926
|
+
// trans: transactionId,
|
|
20927
|
+
// };
|
|
20928
|
+
// const urlEncodedData = formurlencoded(data);
|
|
20929
|
+
// return axiosInstance
|
|
20930
|
+
// .post(url, urlEncodedData, { headers })
|
|
20931
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20932
|
+
// },
|
|
20933
|
+
// forgetRememberedCard({ authorizationId, publicKey }) {
|
|
20934
|
+
// const language = getLanguage();
|
|
20935
|
+
// const headers = {
|
|
20936
|
+
// Authorization: `Bearer ${publicKey}`,
|
|
20937
|
+
// ...(language && { 'Accept-Language': language }),
|
|
20938
|
+
// };
|
|
20939
|
+
// const params = {
|
|
20940
|
+
// authorization_id: authorizationId,
|
|
20941
|
+
// };
|
|
20942
|
+
// const url = `${config.paystackApiUrl}rememberme/forget_card`;
|
|
20943
|
+
// return axiosInstance
|
|
20944
|
+
// .post(url, params, { headers })
|
|
20945
|
+
// .then((response) => ChargeResponses.parse(response.data));
|
|
20946
|
+
// },
|
|
20947
|
+
|
|
20948
|
+
};
|
|
20949
|
+
|
|
20950
|
+
var paymentMethod = 'card';
|
|
20951
|
+
|
|
20952
|
+
function validate(card, isSetter) {
|
|
20953
|
+
return new Promise(function (resolve, reject) {
|
|
20954
|
+
var validation = Card.validate(card);
|
|
20955
|
+
|
|
20956
|
+
if (!validation.isValid) {
|
|
20957
|
+
var throwValidation = isSetter || card.number;
|
|
20958
|
+
var errors = Object.keys(validation.result).filter(function (value) {
|
|
20959
|
+
return validation.result[value] === false;
|
|
20960
|
+
});
|
|
20961
|
+
var errorMessage = "Invalid card details: ".concat(errors.join(', '));
|
|
20962
|
+
reject(Error(throwValidation ? errorMessage : 'Please set a valid card with setCard()'));
|
|
20963
|
+
}
|
|
20964
|
+
|
|
20965
|
+
resolve();
|
|
20966
|
+
});
|
|
20967
|
+
}
|
|
20968
|
+
|
|
20969
|
+
var ReserveCardFunds = {
|
|
20970
|
+
setCard: function setCard(params) {
|
|
20971
|
+
var _this = this;
|
|
20972
|
+
|
|
20973
|
+
return validate(params, true).then(function () {
|
|
20974
|
+
_this.card = new Card(params);
|
|
20975
|
+
});
|
|
20976
|
+
},
|
|
20977
|
+
reserve: function reserve(preauthorizationId) {
|
|
20978
|
+
var _this2 = this;
|
|
20979
|
+
|
|
20980
|
+
var customFields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20981
|
+
// TODO: Log payment method
|
|
20982
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20983
|
+
return validate(this.card).then(function () {
|
|
20984
|
+
var chargeParams = {
|
|
20985
|
+
clientdata: _this2.card.tokenize(),
|
|
20986
|
+
last4: _this2.card.getLast4(),
|
|
20987
|
+
preauthorization: preauthorizationId,
|
|
20988
|
+
customFields: customFields
|
|
20989
|
+
};
|
|
20990
|
+
return CardAPI.charge(chargeParams).then(function (response) {
|
|
20991
|
+
// TODO: Log API Response
|
|
20992
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
20993
|
+
return response;
|
|
20994
|
+
});
|
|
20995
|
+
});
|
|
20996
|
+
},
|
|
20997
|
+
listenFor3DSCharge: function listenFor3DSCharge(callback) {
|
|
20998
|
+
var listenerOptions = {
|
|
20999
|
+
channel: "3DS_".concat(this.id),
|
|
21000
|
+
paymentMethod: paymentMethod
|
|
21001
|
+
};
|
|
21002
|
+
return this.listenForCharge(listenerOptions, callback);
|
|
21003
|
+
} // rememberCard() {
|
|
21004
|
+
// this.remember_card = true;
|
|
21005
|
+
// },
|
|
21006
|
+
// chargeCard(customFields = {}) {
|
|
21007
|
+
// if (!this.card.number && this.card.pin) {
|
|
21008
|
+
// return this.chargeCardWithPin(customFields);
|
|
21009
|
+
// }
|
|
21010
|
+
// return validate(this.card).then(() => {
|
|
21011
|
+
// this.logAttempt(paymentMethod);
|
|
21012
|
+
// const chargeParams = {
|
|
21013
|
+
// clientdata: this.card.tokenize(),
|
|
21014
|
+
// last4: this.card.getLast4(),
|
|
21015
|
+
// pin: this.card.getEncryptedPin(),
|
|
21016
|
+
// trans: this.id,
|
|
21017
|
+
// device: this.deviceFingerprint,
|
|
21018
|
+
// rememberCard: this.remember_card,
|
|
21019
|
+
// transactionType: this.transactionType,
|
|
21020
|
+
// subscription: this.subscription,
|
|
21021
|
+
// customFields,
|
|
21022
|
+
// };
|
|
21023
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21024
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21025
|
+
// return response;
|
|
21026
|
+
// });
|
|
21027
|
+
// });
|
|
21028
|
+
// },
|
|
21029
|
+
|
|
21030
|
+
/**
|
|
21031
|
+
* Handles submitting a card pin after
|
|
21032
|
+
* other card details have been previously submitted.
|
|
21033
|
+
*/
|
|
21034
|
+
// chargeCardWithPin(customFields = {}) {
|
|
21035
|
+
// this.logAttempt(paymentMethod);
|
|
21036
|
+
// const chargeParams = {
|
|
21037
|
+
// pin: encrypt(this.card.pin),
|
|
21038
|
+
// trans: this.id,
|
|
21039
|
+
// device: this.deviceFingerprint,
|
|
21040
|
+
// rememberCard: this.remember_card,
|
|
21041
|
+
// transactionType: this.transactionType,
|
|
21042
|
+
// subscription: this.subscription,
|
|
21043
|
+
// customFields,
|
|
21044
|
+
// };
|
|
21045
|
+
// return CardAPI.charge(chargeParams).then((response) => {
|
|
21046
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21047
|
+
// return response;
|
|
21048
|
+
// });
|
|
21049
|
+
// },
|
|
21050
|
+
// chargeRememberedCard({ cvv, authorizationCode, cardLast4, pin }) {
|
|
21051
|
+
// this.logAttempt(paymentMethod);
|
|
21052
|
+
// const encryptedPin = encrypt(pin);
|
|
21053
|
+
// const chargeParams = {
|
|
21054
|
+
// authorizationCode,
|
|
21055
|
+
// cvv,
|
|
21056
|
+
// last4: cardLast4,
|
|
21057
|
+
// trans: this.id,
|
|
21058
|
+
// device: this.deviceFingerprint,
|
|
21059
|
+
// pin: encryptedPin,
|
|
21060
|
+
// transactionType: this.transactionType,
|
|
21061
|
+
// subscription: this.subscription,
|
|
21062
|
+
// };
|
|
21063
|
+
// return CardAPI.chargeRememberedCard(chargeParams).then((response) => {
|
|
21064
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21065
|
+
// return response;
|
|
21066
|
+
// });
|
|
21067
|
+
// },
|
|
21068
|
+
// resumeCardCharge({ accessCode, pin }) {
|
|
21069
|
+
// const params = {
|
|
21070
|
+
// ...(pin && { pin: encrypt(pin) }),
|
|
21071
|
+
// accessCode,
|
|
21072
|
+
// device: this.deviceFingerprint,
|
|
21073
|
+
// };
|
|
21074
|
+
// return CardAPI.resumeCardCharge(params).then((response) => {
|
|
21075
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21076
|
+
// return response;
|
|
21077
|
+
// });
|
|
21078
|
+
// },
|
|
21079
|
+
// forgetRememberedCard(authorizationId) {
|
|
21080
|
+
// const params = {
|
|
21081
|
+
// authorizationId,
|
|
21082
|
+
// publicKey: this.merchant.key,
|
|
21083
|
+
// };
|
|
21084
|
+
// return CardAPI.forgetRememberedCard(params).then((response) => {
|
|
21085
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21086
|
+
// return response;
|
|
21087
|
+
// });
|
|
21088
|
+
// },
|
|
21089
|
+
// authenticateCard(token) {
|
|
21090
|
+
// return CardAPI.authenticate(this.id, token).then((response) => {
|
|
21091
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21092
|
+
// return response;
|
|
21093
|
+
// });
|
|
21094
|
+
// },
|
|
21095
|
+
// verifyAddress({ address, city, state, zipCode }) {
|
|
21096
|
+
// const payload = {
|
|
21097
|
+
// city,
|
|
21098
|
+
// state,
|
|
21099
|
+
// address,
|
|
21100
|
+
// zipCode,
|
|
21101
|
+
// transactionId: this.id,
|
|
21102
|
+
// };
|
|
21103
|
+
// return CardAPI.verifyAddress(payload).then((response) => {
|
|
21104
|
+
// this.logAPIResponse(response, paymentMethod);
|
|
21105
|
+
// return response;
|
|
21106
|
+
// });
|
|
21107
|
+
// },
|
|
21108
|
+
|
|
21109
|
+
};
|
|
21110
|
+
|
|
20754
21111
|
var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
20755
21112
|
function PreauthorizationInstance(data) {
|
|
20756
21113
|
_classCallCheck(this, PreauthorizationInstance);
|
|
@@ -20770,8 +21127,10 @@ var PreauthorizationInstance = /*#__PURE__*/function () {
|
|
|
20770
21127
|
name: data.merchant_name,
|
|
20771
21128
|
key: data.merchant_key
|
|
20772
21129
|
};
|
|
20773
|
-
loadPusher(); // TODO:
|
|
20774
|
-
// https://paystack.atlassian.net/browse/RAILS-
|
|
21130
|
+
loadPusher(); // TODO: Analytics
|
|
21131
|
+
// https://paystack.atlassian.net/browse/RAILS-3070
|
|
21132
|
+
|
|
21133
|
+
Object.assign(this, ReserveCardFunds);
|
|
20775
21134
|
}
|
|
20776
21135
|
|
|
20777
21136
|
_createClass(PreauthorizationInstance, [{
|
|
@@ -20853,7 +21212,7 @@ var Preauthorization = {
|
|
|
20853
21212
|
};
|
|
20854
21213
|
|
|
20855
21214
|
exports.BankAccount = BankAccount;
|
|
20856
|
-
exports.Card = Card;
|
|
21215
|
+
exports.Card = Card$1;
|
|
20857
21216
|
exports.Preauthorization = Preauthorization;
|
|
20858
21217
|
exports.Toolkit = Toolkit;
|
|
20859
21218
|
exports.Transaction = Transaction;
|