@tap-payments/apple-pay-button 0.0.60-development → 0.0.61-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.
- package/build/hooks/useApplePay.js +12 -12
- package/package.json +1 -1
|
@@ -129,16 +129,16 @@ export var useApplePay = function (_a) {
|
|
|
129
129
|
}, [mappedProps]);
|
|
130
130
|
var initialize = function (metaData) { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
131
|
var merchantProfile, payment_options, headers_1, data, err_1;
|
|
132
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
133
|
-
return __generator(this, function (
|
|
134
|
-
switch (
|
|
132
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
133
|
+
return __generator(this, function (_o) {
|
|
134
|
+
switch (_o.label) {
|
|
135
135
|
case 0:
|
|
136
136
|
setLoading(true);
|
|
137
137
|
appService.setEnv(environment);
|
|
138
138
|
appService.setBaseUrl();
|
|
139
|
-
|
|
139
|
+
_o.label = 1;
|
|
140
140
|
case 1:
|
|
141
|
-
|
|
141
|
+
_o.trys.push([1, 7, 8, 9]);
|
|
142
142
|
if (metaData) {
|
|
143
143
|
merchantProfile = metaData.merchant, payment_options = metaData.payment_options, headers_1 = metaData.headers;
|
|
144
144
|
setAxiosGlobalHeaders(__assign({}, headers_1));
|
|
@@ -148,7 +148,7 @@ export var useApplePay = function (_a) {
|
|
|
148
148
|
if (!headers) return [3, 3];
|
|
149
149
|
return [4, appService.setHttpHeaders(__assign(__assign({}, headers), { authorization: operator.publicKey }))];
|
|
150
150
|
case 2:
|
|
151
|
-
|
|
151
|
+
_o.sent();
|
|
152
152
|
return [3, 5];
|
|
153
153
|
case 3: return [4, appService.setBrowserHeaders({
|
|
154
154
|
locale: interfaceObj === null || interfaceObj === void 0 ? void 0 : interfaceObj.locale,
|
|
@@ -156,8 +156,8 @@ export var useApplePay = function (_a) {
|
|
|
156
156
|
pk: operator.publicKey
|
|
157
157
|
})];
|
|
158
158
|
case 4:
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
_o.sent();
|
|
160
|
+
_o.label = 5;
|
|
161
161
|
case 5: return [4, appService.checkoutProfile({
|
|
162
162
|
supported_payment_methods: ['APPLE_PAY'],
|
|
163
163
|
supported_currencies: [order.currency],
|
|
@@ -189,7 +189,7 @@ export var useApplePay = function (_a) {
|
|
|
189
189
|
] })
|
|
190
190
|
})];
|
|
191
191
|
case 6:
|
|
192
|
-
data =
|
|
192
|
+
data = _o.sent();
|
|
193
193
|
if (debug)
|
|
194
194
|
console.log('merchant configuration: ', data);
|
|
195
195
|
setProfile(data);
|
|
@@ -198,11 +198,11 @@ export var useApplePay = function (_a) {
|
|
|
198
198
|
setApplePayRequestConfiguration({
|
|
199
199
|
BASE_URL: appService.getBaseUrl(),
|
|
200
200
|
headers: getAxiosGlobalHeaders(),
|
|
201
|
-
merchant: data.merchant
|
|
201
|
+
merchant: __assign(__assign({}, data.merchant), { id: merchant.id || ((_m = data.merchant) === null || _m === void 0 ? void 0 : _m.id) })
|
|
202
202
|
});
|
|
203
203
|
return [3, 9];
|
|
204
204
|
case 7:
|
|
205
|
-
err_1 =
|
|
205
|
+
err_1 = _o.sent();
|
|
206
206
|
onError === null || onError === void 0 ? void 0 : onError(err_1.errors || err_1);
|
|
207
207
|
console.log('error in initialize', err_1);
|
|
208
208
|
return [3, 9];
|
|
@@ -255,7 +255,7 @@ export var useApplePay = function (_a) {
|
|
|
255
255
|
if (debug) {
|
|
256
256
|
console.info("creating merchant session for merchantData: ".concat(JSON.stringify(profileData.merchant), " and validationURL: ").concat(event.validationURL, " and merchant.domain: ").concat(window.location.origin));
|
|
257
257
|
}
|
|
258
|
-
return [4, appService.appleSession(__assign(__assign({}, profileData.merchant), { id: merchant.id }), event.validationURL, window.location.origin)];
|
|
258
|
+
return [4, appService.appleSession(__assign(__assign({}, profileData.merchant), { id: merchant.id || profileData.merchant.id }), event.validationURL, window.location.origin)];
|
|
259
259
|
case 2:
|
|
260
260
|
merchantSession = _a.sent();
|
|
261
261
|
if (debug)
|