@tap-payments/apple-pay-button 0.0.49-development → 0.0.50-development
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.
|
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
import {
|
|
48
|
+
import { useEffect, useState } from 'react';
|
|
49
49
|
import appService from '../api/app.service';
|
|
50
50
|
import { ApplePayVersion, Scope } from '../constants';
|
|
51
51
|
import { getAxiosGlobalHeaders, setAxiosGlobalHeaders } from '../api/httpClient';
|
|
@@ -61,6 +61,8 @@ export var useApplePay = function (_a) {
|
|
|
61
61
|
var prepareApplePayRequest = function (_a) {
|
|
62
62
|
var payment_options = _a.payment_options, merchant = _a.merchant;
|
|
63
63
|
var paymentMethod = getApplePayPaymentMethod(payment_options.payment_methods || []);
|
|
64
|
+
if (debug)
|
|
65
|
+
console.log('payment method: ', paymentMethod);
|
|
64
66
|
var supportedNetworks = validateSupportedNetworks(paymentMethod.supported_card_brands, acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedSchemes);
|
|
65
67
|
var request = getApplePayRequest({
|
|
66
68
|
countryCode: merchant.country_code,
|
|
@@ -70,9 +72,11 @@ export var useApplePay = function (_a) {
|
|
|
70
72
|
merchantCapabilities: getMerchantCapabilities(acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedFundSource),
|
|
71
73
|
name: merchant.name
|
|
72
74
|
});
|
|
75
|
+
if (debug)
|
|
76
|
+
console.log('apple pay request data: ', request);
|
|
73
77
|
setApplePayRequestData(request);
|
|
74
78
|
};
|
|
75
|
-
var initialize =
|
|
79
|
+
var initialize = function (metaData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
80
|
var merchantProfile, payment_options, headers_1, data, err_1;
|
|
77
81
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
78
82
|
return __generator(this, function (_m) {
|
|
@@ -157,10 +161,10 @@ export var useApplePay = function (_a) {
|
|
|
157
161
|
case 9: return [2];
|
|
158
162
|
}
|
|
159
163
|
});
|
|
160
|
-
}); }
|
|
164
|
+
}); };
|
|
161
165
|
useEffect(function () {
|
|
162
166
|
initialize(metaData);
|
|
163
|
-
}, [
|
|
167
|
+
}, []);
|
|
164
168
|
var onApplePayButtonClicked = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
165
169
|
var ApplePaySession, session_1;
|
|
166
170
|
var _a;
|