@paystack/inline-js 2.25.0-dev.4 → 2.25.0-dev.6
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/README.md +55 -14
- package/dist/inline.js +78 -68
- package/es/inline.js +78 -68
- package/lib/inline.js +78 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ paystackInstance.newTransaction({
|
|
|
108
108
|
| id | Autogenerated id for the Popup instance | `String` |
|
|
109
109
|
| backgroundDiv | A placeholder div that shows a loading indicator when the main checkout iFrame is loading | `domElement` |
|
|
110
110
|
| checkoutIframe | The iframe where the payment happens | `domElement` |
|
|
111
|
-
| paymentRequestContainer | The div container for wallet payment buttons i.e Apple Pay
|
|
111
|
+
| paymentRequestContainer | The div container for wallet payment buttons i.e Apple Pay and Google Pay | `domElement` \| `null` |
|
|
112
112
|
|
|
113
113
|
## Object Methods
|
|
114
114
|
|
|
@@ -139,7 +139,7 @@ This method starts a new transaction on the checkout form.
|
|
|
139
139
|
| lastName | False | `String` | The last name of the customer |
|
|
140
140
|
| phone | False | `String` | The phone number of the customer |
|
|
141
141
|
| customerCode | False | `String` | A valid Paystack customer code. If provided, this overrides all the customer information above |
|
|
142
|
-
| channels | False | `Array` | An array of payment channels to use. By default, all options available in
|
|
142
|
+
| channels | False | `Array` | An array of payment channels to use. By default, all options available in PaystackPop.CHANNELS are used. `google_pay` has to be passed alongside `card`. On its own the transaction will not initialize |
|
|
143
143
|
| paymentRequest | False | `String` | A valid Paystack payment request id |
|
|
144
144
|
| paymentPage | False | `String` | A valid Paystack payment page id |
|
|
145
145
|
| metadata | False | Object | A valid object of extra information that you want to be saved to the transaction. To show this on the dashboard, see [Seeing your metadata on the dashboard](#tip-seeing-your-metadata-on-the-dashboard) |
|
|
@@ -318,7 +318,7 @@ try {
|
|
|
318
318
|
|
|
319
319
|
# PaystackPop.checkout({options})
|
|
320
320
|
|
|
321
|
-
This method loads a transaction on the checkout form
|
|
321
|
+
This method loads a transaction on the checkout form.
|
|
322
322
|
|
|
323
323
|
## Configuration Options
|
|
324
324
|
|
|
@@ -380,7 +380,7 @@ async function checkout(amount) {
|
|
|
380
380
|
|
|
381
381
|
# PaystackPop.paymentRequest({options})
|
|
382
382
|
|
|
383
|
-
This method mounts
|
|
383
|
+
This method mounts wallet payment buttons e.g Apple Pay, Google Pay on a provided div, and also provides the option to allow a provided button open the checkout form.
|
|
384
384
|
|
|
385
385
|
## General Configuration Options
|
|
386
386
|
|
|
@@ -390,15 +390,49 @@ All General and Custom configuration options that are accepted by [PaystackPop.n
|
|
|
390
390
|
|
|
391
391
|
| Option | Required | Type | Description |
|
|
392
392
|
| ----------------------------- | -------------- | --------------------| ---------------------------------------------------- |
|
|
393
|
-
| container | True | `String` | ID of div to mount the payment request
|
|
393
|
+
| container | True | `String` | ID of div to mount the payment request buttons |
|
|
394
394
|
| loadPaystackCheckoutButton | False | `String` | ID of button to open checkout form |
|
|
395
|
-
| styles | False | `Object` |
|
|
395
|
+
| styles | False | `Object` | Layout and button styling. See [Styling Options](#styling-options) |
|
|
396
|
+
|
|
397
|
+
### Styling Options
|
|
398
|
+
|
|
399
|
+
| Option | Type | Default | Description |
|
|
400
|
+
| ----------- | ----------------------------- | -------------- | -------------------------------------------------------------------------------------------------------- |
|
|
401
|
+
| theme | `'dark'` or `'light'` | `'dark'` | Sets both buttons to their black or white variant |
|
|
402
|
+
| orientation | `'horizontal'` or `'vertical'` | `'horizontal'` | Horizontal shares the row equally between the buttons. Vertical stacks them, each at its natural width |
|
|
403
|
+
| applePay | `Object` | See below | Apple Pay button styling |
|
|
404
|
+
| googlePay | `Object` | See below | Google Pay button styling |
|
|
405
|
+
|
|
406
|
+
#### styles.applePay
|
|
407
|
+
|
|
408
|
+
| Option | Type | Default |
|
|
409
|
+
| ------------ | -------- | --------- |
|
|
410
|
+
| width | `String` | `'auto'` |
|
|
411
|
+
| height | `String` | `'50px'` |
|
|
412
|
+
| borderRadius | `String` | `'3px'` |
|
|
413
|
+
| padding | `String` | `'10px'` |
|
|
414
|
+
| type | `String` | `'pay'` |
|
|
415
|
+
| locale | `String` | `'en'` |
|
|
416
|
+
|
|
417
|
+
#### styles.googlePay
|
|
418
|
+
|
|
419
|
+
`width` and `height` size the button. Every other key is passed straight through to Google's [`createButton`](https://developers.google.com/pay/api/web/reference/client#createButton), so anything it accepts works here, including overriding the defaults below.
|
|
420
|
+
|
|
421
|
+
| Option | Type | Default |
|
|
422
|
+
| -------------- | -------- | -------------------- |
|
|
423
|
+
| width | `String` | `'auto'` |
|
|
424
|
+
| height | `String` | `'50px'` |
|
|
425
|
+
| buttonType | `String` | `'pay'` |
|
|
426
|
+
| buttonRadius | `Number` | `3` |
|
|
427
|
+
| buttonColor | `String` | Follows `styles.theme` |
|
|
428
|
+
| buttonSizeMode | `String` | `'fill'` |
|
|
429
|
+
|
|
396
430
|
|
|
397
431
|
### Configuration Options for Callbacks
|
|
432
|
+
|
|
398
433
|
| Event name | Description | Response properties |
|
|
399
434
|
| ---------------------------- | -------------------------------------------------------- | -----------------------------------|
|
|
400
|
-
| onElementsMount | Called
|
|
401
|
-
|
|
435
|
+
| onElementsMount | Called once mounting has finished for both wallets | `{ applePay: Boolean, googlePay: Boolean }`, or `null` if mounting failed |
|
|
402
436
|
|
|
403
437
|
## Method Response
|
|
404
438
|
|
|
@@ -406,7 +440,7 @@ This method returns a Promise which resolves to a [PopupTransaction Instance](#t
|
|
|
406
440
|
|
|
407
441
|
## For Example
|
|
408
442
|
|
|
409
|
-
Mount
|
|
443
|
+
Mount the wallet buttons, and change the text of the button to open the checkout form if either of them appears
|
|
410
444
|
|
|
411
445
|
```html
|
|
412
446
|
<div id="payment-request-buttons"></div>
|
|
@@ -417,28 +451,35 @@ Mount a payment button and change the text of the button to open the checkout fo
|
|
|
417
451
|
const paystackPop = new PaystackPop();
|
|
418
452
|
|
|
419
453
|
const onElementsMount = (elements) => {
|
|
420
|
-
if (elements && elements.applePay) {
|
|
454
|
+
if (elements && (elements.applePay || elements.googlePay)) {
|
|
421
455
|
document.querySelector("#pay-button").innerText = "More Payment Options";
|
|
422
456
|
}
|
|
423
457
|
}
|
|
424
458
|
|
|
425
|
-
async function
|
|
459
|
+
async function loadPaymentRequestButtons() {
|
|
426
460
|
try {
|
|
427
461
|
await paystackPop.paymentRequest({
|
|
428
462
|
key: config.publicLiveKey,
|
|
429
463
|
email: 'testuser@paystack.com',
|
|
430
464
|
amount: 10000,
|
|
431
465
|
currency: "NGN",
|
|
466
|
+
// google_pay needs card alongside it to show
|
|
467
|
+
channels: ["card", "apple_pay", "google_pay"],
|
|
432
468
|
container: 'payment-request-buttons',
|
|
433
469
|
loadPaystackCheckoutButton: 'pay-button',
|
|
434
470
|
styles: {
|
|
435
471
|
theme: 'dark',
|
|
472
|
+
orientation: 'horizontal',
|
|
436
473
|
applePay: {
|
|
437
|
-
width: '100%',
|
|
438
474
|
height: '50px',
|
|
439
475
|
borderRadius: '3px',
|
|
440
476
|
type: 'plain',
|
|
441
477
|
locale: 'en'
|
|
478
|
+
},
|
|
479
|
+
googlePay: {
|
|
480
|
+
height: '50px',
|
|
481
|
+
buttonRadius: 3,
|
|
482
|
+
buttonType: 'pay'
|
|
442
483
|
}
|
|
443
484
|
},
|
|
444
485
|
onElementsMount,
|
|
@@ -448,7 +489,7 @@ async function loadApplePayButton() {
|
|
|
448
489
|
}
|
|
449
490
|
}
|
|
450
491
|
|
|
451
|
-
|
|
492
|
+
loadPaymentRequestButtons()
|
|
452
493
|
```
|
|
453
494
|
|
|
454
495
|
---
|
|
@@ -493,4 +534,4 @@ Paystack Inline is designed to support all recent versions of major browsers. Th
|
|
|
493
534
|
|
|
494
535
|
If you have an issue with Paystack Inline on a specific browser, kindly reach out to us so we can quickly resolve any issues.
|
|
495
536
|
|
|
496
|
-
* We don't support Opera Mini because Javascript is disabled in it. We support the Opera browser however, except in super saver mode where JS is disabled as well.
|
|
537
|
+
* We don't support Opera Mini because Javascript is disabled in it. We support the Opera browser however, except in super saver mode where JS is disabled as well.
|
package/dist/inline.js
CHANGED
|
@@ -387,7 +387,7 @@ var PaystackPop = (function () {
|
|
|
387
387
|
};
|
|
388
388
|
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
389
389
|
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
390
|
-
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n
|
|
390
|
+
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(isVertical ? '' : 'flex: 1 1 0;', "\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n");
|
|
391
391
|
};
|
|
392
392
|
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
393
393
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -948,7 +948,6 @@ var PaystackPop = (function () {
|
|
|
948
948
|
}));
|
|
949
949
|
var buttonContainer = document.createElement('div');
|
|
950
950
|
buttonContainer.id = 'google-pay-button-container';
|
|
951
|
-
container.appendChild(buttonContainer);
|
|
952
951
|
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
953
952
|
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
954
953
|
buttonColor: styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black',
|
|
@@ -959,6 +958,7 @@ var PaystackPop = (function () {
|
|
|
959
958
|
onClick: onClick,
|
|
960
959
|
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
961
960
|
}));
|
|
961
|
+
container.appendChild(buttonContainer);
|
|
962
962
|
var buttonWrapper = document.createElement('div');
|
|
963
963
|
buttonWrapper.id = 'google-pay-button';
|
|
964
964
|
buttonWrapper.appendChild(button);
|
|
@@ -1750,7 +1750,8 @@ var PaystackPop = (function () {
|
|
|
1750
1750
|
}();
|
|
1751
1751
|
|
|
1752
1752
|
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1753
|
-
_excluded2 = ["container", "styles", "onElementsMount"]
|
|
1753
|
+
_excluded2 = ["container", "styles", "onElementsMount"],
|
|
1754
|
+
_excluded3 = ["data"];
|
|
1754
1755
|
var inlineInstance;
|
|
1755
1756
|
function findResumableTransaction(transactions, parameters) {
|
|
1756
1757
|
if (!transactions.length) {
|
|
@@ -1864,8 +1865,9 @@ var PaystackPop = (function () {
|
|
|
1864
1865
|
transactionData = _ref.transactionData,
|
|
1865
1866
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
1866
1867
|
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1867
|
-
|
|
1868
|
-
|
|
1868
|
+
var activeTransaction = this.activeTransaction();
|
|
1869
|
+
if (activeTransaction && !hasPaymentRequestButtons && activeTransaction !== inlineTransaction) {
|
|
1870
|
+
activeTransaction.cancel();
|
|
1869
1871
|
}
|
|
1870
1872
|
if (inlineTransaction && transactionData) {
|
|
1871
1873
|
if (!this.transactions.includes(inlineTransaction)) {
|
|
@@ -1990,73 +1992,80 @@ var PaystackPop = (function () {
|
|
|
1990
1992
|
var _this3 = this;
|
|
1991
1993
|
var paymentMethod = 'google pay';
|
|
1992
1994
|
var transaction = this.activeTransaction();
|
|
1993
|
-
if (
|
|
1994
|
-
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
if (this.isCharging) {
|
|
1998
|
-
return;
|
|
1999
|
-
}
|
|
2000
|
-
this.isCharging = true;
|
|
2001
|
-
var analyticsPayload = {
|
|
2002
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2003
|
-
currency: transaction.response.currency,
|
|
2004
|
-
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2005
|
-
};
|
|
2006
|
-
transaction.logAttempt(paymentMethod);
|
|
2007
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2008
|
-
paymentMethod: paymentMethod
|
|
2009
|
-
}));
|
|
2010
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response.domain === TRANSACTION_DOMAIN.TEST));
|
|
2011
|
-
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2012
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2013
|
-
return chargeGooglePay({
|
|
2014
|
-
transactionId: transaction.id,
|
|
2015
|
-
paymentData: paymentData
|
|
2016
|
-
});
|
|
2017
|
-
}).then(function (response) {
|
|
2018
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2019
|
-
_this3.isCharging = false;
|
|
2020
|
-
transaction.logAPIResponse(response, paymentMethod);
|
|
2021
|
-
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2022
|
-
transaction.onSuccess(response);
|
|
2023
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2024
|
-
timeSpent: transaction.getTimeSpent()
|
|
2025
|
-
}));
|
|
1995
|
+
if (transaction) {
|
|
1996
|
+
if (this.isCharging) {
|
|
2026
1997
|
return;
|
|
2027
1998
|
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
// than leaving the customer holding a token with nowhere to go.
|
|
2031
|
-
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2032
|
-
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2033
|
-
message: message
|
|
2034
|
-
}));
|
|
2035
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1999
|
+
this.isCharging = true;
|
|
2000
|
+
var analyticsPayload = {
|
|
2036
2001
|
channel: CHANNELS.GOOGLE_PAY,
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2002
|
+
currency: transaction.response.currency,
|
|
2003
|
+
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2004
|
+
};
|
|
2005
|
+
try {
|
|
2006
|
+
transaction.logAttempt(paymentMethod);
|
|
2007
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2008
|
+
paymentMethod: paymentMethod
|
|
2009
|
+
}));
|
|
2010
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
2011
|
+
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2012
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2013
|
+
return chargeGooglePay({
|
|
2014
|
+
transactionId: transaction.id,
|
|
2015
|
+
paymentData: paymentData
|
|
2016
|
+
});
|
|
2017
|
+
}).then(function (response) {
|
|
2018
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2019
|
+
_this3.isCharging = false;
|
|
2020
|
+
transaction.logAPIResponse(response, paymentMethod);
|
|
2021
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2022
|
+
var data = response.data,
|
|
2023
|
+
envelope = _objectWithoutProperties(response, _excluded3);
|
|
2024
|
+
transaction.onSuccess(_objectSpread2(_objectSpread2({}, data), envelope));
|
|
2025
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2026
|
+
timeSpent: transaction.getTimeSpent()
|
|
2027
|
+
}));
|
|
2028
|
+
return;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
// `auth` means a step-up we cannot render here, so say so rather
|
|
2032
|
+
// than leaving the customer holding a token with nowhere to go.
|
|
2033
|
+
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2034
|
+
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2035
|
+
message: message
|
|
2036
|
+
}));
|
|
2037
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2038
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2039
|
+
message: message
|
|
2040
|
+
});
|
|
2041
|
+
}).catch(function (error) {
|
|
2042
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2043
|
+
_this3.isCharging = false;
|
|
2044
|
+
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2045
|
+
transaction.onCancel();
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
var statusCode = error && error.statusCode;
|
|
2049
|
+
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2050
|
+
logWarning("Google Pay: ".concat(statusCode, ". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));
|
|
2051
|
+
}
|
|
2052
|
+
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2053
|
+
transaction.onSetupError({
|
|
2054
|
+
status: false,
|
|
2055
|
+
message: message
|
|
2056
|
+
});
|
|
2057
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2058
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2059
|
+
message: message
|
|
2060
|
+
});
|
|
2061
|
+
});
|
|
2062
|
+
} catch (error) {
|
|
2063
|
+
this.isCharging = false;
|
|
2064
|
+
transaction.onSetupError(error);
|
|
2049
2065
|
}
|
|
2050
|
-
|
|
2051
|
-
transaction
|
|
2052
|
-
|
|
2053
|
-
message: message
|
|
2054
|
-
});
|
|
2055
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2056
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2057
|
-
message: message
|
|
2058
|
-
});
|
|
2059
|
-
});
|
|
2066
|
+
} else {
|
|
2067
|
+
handleError('Could not initiate google pay transaction');
|
|
2068
|
+
}
|
|
2060
2069
|
}
|
|
2061
2070
|
}, {
|
|
2062
2071
|
key: "startApplePay",
|
|
@@ -2102,6 +2111,7 @@ var PaystackPop = (function () {
|
|
|
2102
2111
|
}
|
|
2103
2112
|
transaction.logValidationResponse(response.message);
|
|
2104
2113
|
}).catch(function (error) {
|
|
2114
|
+
_this4.isCharging = false;
|
|
2105
2115
|
transaction.onSetupError(error);
|
|
2106
2116
|
});
|
|
2107
2117
|
};
|
package/es/inline.js
CHANGED
|
@@ -384,7 +384,7 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
|
384
384
|
};
|
|
385
385
|
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
386
386
|
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
387
|
-
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n
|
|
387
|
+
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(isVertical ? '' : 'flex: 1 1 0;', "\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n");
|
|
388
388
|
};
|
|
389
389
|
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
390
390
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -945,7 +945,6 @@ function mountGooglePayButton(container, _ref3) {
|
|
|
945
945
|
}));
|
|
946
946
|
var buttonContainer = document.createElement('div');
|
|
947
947
|
buttonContainer.id = 'google-pay-button-container';
|
|
948
|
-
container.appendChild(buttonContainer);
|
|
949
948
|
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
950
949
|
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
951
950
|
buttonColor: styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black',
|
|
@@ -956,6 +955,7 @@ function mountGooglePayButton(container, _ref3) {
|
|
|
956
955
|
onClick: onClick,
|
|
957
956
|
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
958
957
|
}));
|
|
958
|
+
container.appendChild(buttonContainer);
|
|
959
959
|
var buttonWrapper = document.createElement('div');
|
|
960
960
|
buttonWrapper.id = 'google-pay-button';
|
|
961
961
|
buttonWrapper.appendChild(button);
|
|
@@ -1747,7 +1747,8 @@ var InlineTransaction = /*#__PURE__*/function () {
|
|
|
1747
1747
|
}();
|
|
1748
1748
|
|
|
1749
1749
|
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1750
|
-
_excluded2 = ["container", "styles", "onElementsMount"]
|
|
1750
|
+
_excluded2 = ["container", "styles", "onElementsMount"],
|
|
1751
|
+
_excluded3 = ["data"];
|
|
1751
1752
|
var inlineInstance;
|
|
1752
1753
|
function findResumableTransaction(transactions, parameters) {
|
|
1753
1754
|
if (!transactions.length) {
|
|
@@ -1861,8 +1862,9 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1861
1862
|
transactionData = _ref.transactionData,
|
|
1862
1863
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
1863
1864
|
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1864
|
-
|
|
1865
|
-
|
|
1865
|
+
var activeTransaction = this.activeTransaction();
|
|
1866
|
+
if (activeTransaction && !hasPaymentRequestButtons && activeTransaction !== inlineTransaction) {
|
|
1867
|
+
activeTransaction.cancel();
|
|
1866
1868
|
}
|
|
1867
1869
|
if (inlineTransaction && transactionData) {
|
|
1868
1870
|
if (!this.transactions.includes(inlineTransaction)) {
|
|
@@ -1987,73 +1989,80 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1987
1989
|
var _this3 = this;
|
|
1988
1990
|
var paymentMethod = 'google pay';
|
|
1989
1991
|
var transaction = this.activeTransaction();
|
|
1990
|
-
if (
|
|
1991
|
-
|
|
1992
|
-
return;
|
|
1993
|
-
}
|
|
1994
|
-
if (this.isCharging) {
|
|
1995
|
-
return;
|
|
1996
|
-
}
|
|
1997
|
-
this.isCharging = true;
|
|
1998
|
-
var analyticsPayload = {
|
|
1999
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2000
|
-
currency: transaction.response.currency,
|
|
2001
|
-
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2002
|
-
};
|
|
2003
|
-
transaction.logAttempt(paymentMethod);
|
|
2004
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2005
|
-
paymentMethod: paymentMethod
|
|
2006
|
-
}));
|
|
2007
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response.domain === TRANSACTION_DOMAIN.TEST));
|
|
2008
|
-
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2009
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2010
|
-
return chargeGooglePay({
|
|
2011
|
-
transactionId: transaction.id,
|
|
2012
|
-
paymentData: paymentData
|
|
2013
|
-
});
|
|
2014
|
-
}).then(function (response) {
|
|
2015
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2016
|
-
_this3.isCharging = false;
|
|
2017
|
-
transaction.logAPIResponse(response, paymentMethod);
|
|
2018
|
-
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2019
|
-
transaction.onSuccess(response);
|
|
2020
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2021
|
-
timeSpent: transaction.getTimeSpent()
|
|
2022
|
-
}));
|
|
1992
|
+
if (transaction) {
|
|
1993
|
+
if (this.isCharging) {
|
|
2023
1994
|
return;
|
|
2024
1995
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
// than leaving the customer holding a token with nowhere to go.
|
|
2028
|
-
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2029
|
-
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2030
|
-
message: message
|
|
2031
|
-
}));
|
|
2032
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1996
|
+
this.isCharging = true;
|
|
1997
|
+
var analyticsPayload = {
|
|
2033
1998
|
channel: CHANNELS.GOOGLE_PAY,
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
1999
|
+
currency: transaction.response.currency,
|
|
2000
|
+
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2001
|
+
};
|
|
2002
|
+
try {
|
|
2003
|
+
transaction.logAttempt(paymentMethod);
|
|
2004
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2005
|
+
paymentMethod: paymentMethod
|
|
2006
|
+
}));
|
|
2007
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
2008
|
+
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2009
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2010
|
+
return chargeGooglePay({
|
|
2011
|
+
transactionId: transaction.id,
|
|
2012
|
+
paymentData: paymentData
|
|
2013
|
+
});
|
|
2014
|
+
}).then(function (response) {
|
|
2015
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2016
|
+
_this3.isCharging = false;
|
|
2017
|
+
transaction.logAPIResponse(response, paymentMethod);
|
|
2018
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2019
|
+
var data = response.data,
|
|
2020
|
+
envelope = _objectWithoutProperties(response, _excluded3);
|
|
2021
|
+
transaction.onSuccess(_objectSpread2(_objectSpread2({}, data), envelope));
|
|
2022
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2023
|
+
timeSpent: transaction.getTimeSpent()
|
|
2024
|
+
}));
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
|
|
2028
|
+
// `auth` means a step-up we cannot render here, so say so rather
|
|
2029
|
+
// than leaving the customer holding a token with nowhere to go.
|
|
2030
|
+
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2031
|
+
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2032
|
+
message: message
|
|
2033
|
+
}));
|
|
2034
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2035
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2036
|
+
message: message
|
|
2037
|
+
});
|
|
2038
|
+
}).catch(function (error) {
|
|
2039
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2040
|
+
_this3.isCharging = false;
|
|
2041
|
+
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2042
|
+
transaction.onCancel();
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
var statusCode = error && error.statusCode;
|
|
2046
|
+
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2047
|
+
logWarning("Google Pay: ".concat(statusCode, ". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));
|
|
2048
|
+
}
|
|
2049
|
+
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2050
|
+
transaction.onSetupError({
|
|
2051
|
+
status: false,
|
|
2052
|
+
message: message
|
|
2053
|
+
});
|
|
2054
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2055
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2056
|
+
message: message
|
|
2057
|
+
});
|
|
2058
|
+
});
|
|
2059
|
+
} catch (error) {
|
|
2060
|
+
this.isCharging = false;
|
|
2061
|
+
transaction.onSetupError(error);
|
|
2046
2062
|
}
|
|
2047
|
-
|
|
2048
|
-
transaction
|
|
2049
|
-
|
|
2050
|
-
message: message
|
|
2051
|
-
});
|
|
2052
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2053
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2054
|
-
message: message
|
|
2055
|
-
});
|
|
2056
|
-
});
|
|
2063
|
+
} else {
|
|
2064
|
+
handleError('Could not initiate google pay transaction');
|
|
2065
|
+
}
|
|
2057
2066
|
}
|
|
2058
2067
|
}, {
|
|
2059
2068
|
key: "startApplePay",
|
|
@@ -2099,6 +2108,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2099
2108
|
}
|
|
2100
2109
|
transaction.logValidationResponse(response.message);
|
|
2101
2110
|
}).catch(function (error) {
|
|
2111
|
+
_this4.isCharging = false;
|
|
2102
2112
|
transaction.onSetupError(error);
|
|
2103
2113
|
});
|
|
2104
2114
|
};
|
package/lib/inline.js
CHANGED
|
@@ -386,7 +386,7 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
|
386
386
|
};
|
|
387
387
|
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
388
388
|
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
389
|
-
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n
|
|
389
|
+
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(isVertical ? '' : 'flex: 1 1 0;', "\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n");
|
|
390
390
|
};
|
|
391
391
|
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
392
392
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -947,7 +947,6 @@ function mountGooglePayButton(container, _ref3) {
|
|
|
947
947
|
}));
|
|
948
948
|
var buttonContainer = document.createElement('div');
|
|
949
949
|
buttonContainer.id = 'google-pay-button-container';
|
|
950
|
-
container.appendChild(buttonContainer);
|
|
951
950
|
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
952
951
|
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
953
952
|
buttonColor: styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black',
|
|
@@ -958,6 +957,7 @@ function mountGooglePayButton(container, _ref3) {
|
|
|
958
957
|
onClick: onClick,
|
|
959
958
|
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
960
959
|
}));
|
|
960
|
+
container.appendChild(buttonContainer);
|
|
961
961
|
var buttonWrapper = document.createElement('div');
|
|
962
962
|
buttonWrapper.id = 'google-pay-button';
|
|
963
963
|
buttonWrapper.appendChild(button);
|
|
@@ -1749,7 +1749,8 @@ var InlineTransaction = /*#__PURE__*/function () {
|
|
|
1749
1749
|
}();
|
|
1750
1750
|
|
|
1751
1751
|
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1752
|
-
_excluded2 = ["container", "styles", "onElementsMount"]
|
|
1752
|
+
_excluded2 = ["container", "styles", "onElementsMount"],
|
|
1753
|
+
_excluded3 = ["data"];
|
|
1753
1754
|
var inlineInstance;
|
|
1754
1755
|
function findResumableTransaction(transactions, parameters) {
|
|
1755
1756
|
if (!transactions.length) {
|
|
@@ -1863,8 +1864,9 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1863
1864
|
transactionData = _ref.transactionData,
|
|
1864
1865
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
1865
1866
|
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1866
|
-
|
|
1867
|
-
|
|
1867
|
+
var activeTransaction = this.activeTransaction();
|
|
1868
|
+
if (activeTransaction && !hasPaymentRequestButtons && activeTransaction !== inlineTransaction) {
|
|
1869
|
+
activeTransaction.cancel();
|
|
1868
1870
|
}
|
|
1869
1871
|
if (inlineTransaction && transactionData) {
|
|
1870
1872
|
if (!this.transactions.includes(inlineTransaction)) {
|
|
@@ -1989,73 +1991,80 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1989
1991
|
var _this3 = this;
|
|
1990
1992
|
var paymentMethod = 'google pay';
|
|
1991
1993
|
var transaction = this.activeTransaction();
|
|
1992
|
-
if (
|
|
1993
|
-
|
|
1994
|
-
return;
|
|
1995
|
-
}
|
|
1996
|
-
if (this.isCharging) {
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
this.isCharging = true;
|
|
2000
|
-
var analyticsPayload = {
|
|
2001
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2002
|
-
currency: transaction.response.currency,
|
|
2003
|
-
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2004
|
-
};
|
|
2005
|
-
transaction.logAttempt(paymentMethod);
|
|
2006
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2007
|
-
paymentMethod: paymentMethod
|
|
2008
|
-
}));
|
|
2009
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response.domain === TRANSACTION_DOMAIN.TEST));
|
|
2010
|
-
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2011
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2012
|
-
return chargeGooglePay({
|
|
2013
|
-
transactionId: transaction.id,
|
|
2014
|
-
paymentData: paymentData
|
|
2015
|
-
});
|
|
2016
|
-
}).then(function (response) {
|
|
2017
|
-
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2018
|
-
_this3.isCharging = false;
|
|
2019
|
-
transaction.logAPIResponse(response, paymentMethod);
|
|
2020
|
-
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2021
|
-
transaction.onSuccess(response);
|
|
2022
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2023
|
-
timeSpent: transaction.getTimeSpent()
|
|
2024
|
-
}));
|
|
1994
|
+
if (transaction) {
|
|
1995
|
+
if (this.isCharging) {
|
|
2025
1996
|
return;
|
|
2026
1997
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
// than leaving the customer holding a token with nowhere to go.
|
|
2030
|
-
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2031
|
-
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2032
|
-
message: message
|
|
2033
|
-
}));
|
|
2034
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1998
|
+
this.isCharging = true;
|
|
1999
|
+
var analyticsPayload = {
|
|
2035
2000
|
channel: CHANNELS.GOOGLE_PAY,
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2001
|
+
currency: transaction.response.currency,
|
|
2002
|
+
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2003
|
+
};
|
|
2004
|
+
try {
|
|
2005
|
+
transaction.logAttempt(paymentMethod);
|
|
2006
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2007
|
+
paymentMethod: paymentMethod
|
|
2008
|
+
}));
|
|
2009
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
2010
|
+
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2011
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
2012
|
+
return chargeGooglePay({
|
|
2013
|
+
transactionId: transaction.id,
|
|
2014
|
+
paymentData: paymentData
|
|
2015
|
+
});
|
|
2016
|
+
}).then(function (response) {
|
|
2017
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2018
|
+
_this3.isCharging = false;
|
|
2019
|
+
transaction.logAPIResponse(response, paymentMethod);
|
|
2020
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2021
|
+
var data = response.data,
|
|
2022
|
+
envelope = _objectWithoutProperties(response, _excluded3);
|
|
2023
|
+
transaction.onSuccess(_objectSpread2(_objectSpread2({}, data), envelope));
|
|
2024
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2025
|
+
timeSpent: transaction.getTimeSpent()
|
|
2026
|
+
}));
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
// `auth` means a step-up we cannot render here, so say so rather
|
|
2031
|
+
// than leaving the customer holding a token with nowhere to go.
|
|
2032
|
+
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2033
|
+
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2034
|
+
message: message
|
|
2035
|
+
}));
|
|
2036
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2037
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2038
|
+
message: message
|
|
2039
|
+
});
|
|
2040
|
+
}).catch(function (error) {
|
|
2041
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2042
|
+
_this3.isCharging = false;
|
|
2043
|
+
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2044
|
+
transaction.onCancel();
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
var statusCode = error && error.statusCode;
|
|
2048
|
+
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2049
|
+
logWarning("Google Pay: ".concat(statusCode, ". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));
|
|
2050
|
+
}
|
|
2051
|
+
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2052
|
+
transaction.onSetupError({
|
|
2053
|
+
status: false,
|
|
2054
|
+
message: message
|
|
2055
|
+
});
|
|
2056
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2057
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2058
|
+
message: message
|
|
2059
|
+
});
|
|
2060
|
+
});
|
|
2061
|
+
} catch (error) {
|
|
2062
|
+
this.isCharging = false;
|
|
2063
|
+
transaction.onSetupError(error);
|
|
2048
2064
|
}
|
|
2049
|
-
|
|
2050
|
-
transaction
|
|
2051
|
-
|
|
2052
|
-
message: message
|
|
2053
|
-
});
|
|
2054
|
-
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2055
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2056
|
-
message: message
|
|
2057
|
-
});
|
|
2058
|
-
});
|
|
2065
|
+
} else {
|
|
2066
|
+
handleError('Could not initiate google pay transaction');
|
|
2067
|
+
}
|
|
2059
2068
|
}
|
|
2060
2069
|
}, {
|
|
2061
2070
|
key: "startApplePay",
|
|
@@ -2101,6 +2110,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
2101
2110
|
}
|
|
2102
2111
|
transaction.logValidationResponse(response.message);
|
|
2103
2112
|
}).catch(function (error) {
|
|
2113
|
+
_this4.isCharging = false;
|
|
2104
2114
|
transaction.onSetupError(error);
|
|
2105
2115
|
});
|
|
2106
2116
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paystack/inline-js",
|
|
3
|
-
"version": "2.25.0-dev.
|
|
3
|
+
"version": "2.25.0-dev.6",
|
|
4
4
|
"description": "Client-side library to load the Paystack checkout form",
|
|
5
5
|
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800",
|
|
6
6
|
"main": "lib/inline.js",
|