@justifi/webcomponents 6.0.0-rc.16 → 6.0.0-rc.18
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/cjs/{check-pkg-version-DfzaKEDg.js → check-pkg-version-BIRpFWjW.js} +1 -1
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/justifi-apple-pay.cjs.entry.js +341 -35
- package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkout-summary_7.cjs.entry.js +3 -4
- package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +2 -2
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
- package/dist/cjs/{package-CHNXn8wx.js → package-BVAhjheJ.js} +1 -1
- package/dist/collection/components/modular-checkout/modular-checkout.js +1 -2
- package/dist/collection/components/modular-checkout/sub-components/apple-pay.js +8 -35
- package/dist/docs.json +1 -1
- package/dist/esm/{check-pkg-version-Cz8T6Ux8.js → check-pkg-version-DHG-pLKx.js} +1 -1
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/justifi-apple-pay.entry.js +341 -35
- package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +2 -2
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form.entry.js +2 -2
- package/dist/esm/justifi-checkout-summary_7.entry.js +3 -4
- package/dist/esm/justifi-checkout.entry.js +2 -2
- package/dist/esm/justifi-checkouts-list.entry.js +2 -2
- package/dist/esm/justifi-dispute-management.entry.js +2 -2
- package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-order-terminals.entry.js +2 -2
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
- package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +2 -2
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +2 -2
- package/dist/esm/justifi-refund-payment.entry.js +2 -2
- package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
- package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +2 -2
- package/dist/esm/{package-BiTF1__F.js → package-D34B0fIu.js} +1 -1
- package/dist/module/justifi-apple-pay.js +338 -32
- package/dist/module/modular-checkout.js +1 -2
- package/dist/module/package.js +1 -1
- package/dist/webcomponents/{p-c3cfcd4b.entry.js → p-00ce804c.entry.js} +1 -1
- package/dist/webcomponents/{p-2b47ddd8.entry.js → p-1a00ae1a.entry.js} +1 -1
- package/dist/webcomponents/p-387951b7.entry.js +1 -0
- package/dist/webcomponents/{p-3d94c845.entry.js → p-39caca63.entry.js} +1 -1
- package/dist/webcomponents/{p-3a34e4f9.entry.js → p-43929b3f.entry.js} +1 -1
- package/dist/webcomponents/{p-0913a57b.entry.js → p-52453823.entry.js} +1 -1
- package/dist/webcomponents/{p-a65d751d.entry.js → p-5d604178.entry.js} +1 -1
- package/dist/webcomponents/{p-995c2cbf.entry.js → p-5fbcf154.entry.js} +1 -1
- package/dist/webcomponents/{p-07c3c25e.entry.js → p-611a013a.entry.js} +1 -1
- package/dist/webcomponents/p-66b1a1be.entry.js +1 -0
- package/dist/webcomponents/p-857ed314.entry.js +1 -0
- package/dist/webcomponents/{p-225da0b5.entry.js → p-8e3be834.entry.js} +1 -1
- package/dist/webcomponents/{p-eabaeaf6.entry.js → p-9080a91c.entry.js} +1 -1
- package/dist/webcomponents/{p-ce272d8a.entry.js → p-91110a56.entry.js} +1 -1
- package/dist/webcomponents/{p-f6e3f1ca.entry.js → p-91753cd0.entry.js} +1 -1
- package/dist/webcomponents/{p-a53710c4.entry.js → p-95279d6b.entry.js} +1 -1
- package/dist/webcomponents/p-D34B0fIu.js +1 -0
- package/dist/webcomponents/{p-BcAsEqa5.js → p-DWOdLN23.js} +1 -1
- package/dist/webcomponents/p-ad6df3f2.entry.js +1 -0
- package/dist/webcomponents/p-b37c187c.entry.js +1 -0
- package/dist/webcomponents/{p-e7921c1f.entry.js → p-b4cb8091.entry.js} +1 -1
- package/dist/webcomponents/{p-3caee9d2.entry.js → p-ccc932f5.entry.js} +1 -1
- package/dist/webcomponents/{p-0bba0dd0.entry.js → p-cef742c4.entry.js} +1 -1
- package/dist/webcomponents/{p-b9ab3803.entry.js → p-dd481752.entry.js} +1 -1
- package/dist/webcomponents/p-eab855aa.entry.js +1 -0
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webcomponents/p-099e96ba.entry.js +0 -1
- package/dist/webcomponents/p-4abf0877.entry.js +0 -1
- package/dist/webcomponents/p-5a3fc339.entry.js +0 -1
- package/dist/webcomponents/p-69bf5e32.entry.js +0 -1
- package/dist/webcomponents/p-73dd0306.entry.js +0 -1
- package/dist/webcomponents/p-BiTF1__F.js +0 -1
- package/dist/webcomponents/p-a7712cea.entry.js +0 -1
|
@@ -5,7 +5,7 @@ var index = require('./index-B32W0A3m.js');
|
|
|
5
5
|
var parts = require('./parts-9jMf1erK.js');
|
|
6
6
|
var _commonjsHelpers = require('./_commonjsHelpers-BJu3ubxk.js');
|
|
7
7
|
var formControlErrorText = require('./form-control-error-text-B-P5UDhm.js');
|
|
8
|
-
var _package = require('./package-
|
|
8
|
+
var _package = require('./package-BVAhjheJ.js');
|
|
9
9
|
|
|
10
10
|
const iframeInputStylesStore = index.createStore({
|
|
11
11
|
focused: {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-C9hBD-32.js');
|
|
4
|
+
var Api = require('./Api-DyimBzKT.js');
|
|
4
5
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
5
6
|
require('./event-types-YOY5TKUN.js');
|
|
6
7
|
var skeleton = require('./skeleton-C7DQRD6r.js');
|
|
7
8
|
var checkout_store = require('./checkout.store-DJEc-So8.js');
|
|
8
|
-
require('./parts-9jMf1erK.js');
|
|
9
|
-
require('./index-B32W0A3m.js');
|
|
10
9
|
require('./config-state-BBOZIS8x.js');
|
|
10
|
+
require('./index-B32W0A3m.js');
|
|
11
|
+
require('./utils-ChCUZgUy.js');
|
|
11
12
|
require('./dinero-BwNN_k7x.js');
|
|
13
|
+
require('./parts-9jMf1erK.js');
|
|
12
14
|
require('./ComponentError-D4OLnOkg.js');
|
|
13
15
|
require('./Refund-BefKONu4.js');
|
|
14
|
-
require('./utils-ChCUZgUy.js');
|
|
15
16
|
require('./Dispute-CruQTF6_.js');
|
|
16
17
|
require('./Pagination-Dediz133.js');
|
|
17
18
|
require('./Business-DCRzZf0w.js');
|
|
@@ -47,6 +48,45 @@ var ApplePayMerchantCapability;
|
|
|
47
48
|
ApplePayMerchantCapability["SUPPORTS_CREDIT"] = "supportsCredit";
|
|
48
49
|
ApplePayMerchantCapability["SUPPORTS_DEBIT"] = "supportsDebit";
|
|
49
50
|
})(ApplePayMerchantCapability || (ApplePayMerchantCapability = {}));
|
|
51
|
+
class ApplePayConfig {
|
|
52
|
+
constructor(data) {
|
|
53
|
+
this.merchantIdentifier = data.merchantIdentifier;
|
|
54
|
+
this.displayName = data.displayName;
|
|
55
|
+
this.initiative = data.initiative;
|
|
56
|
+
this.initiativeContext = data.initiativeContext;
|
|
57
|
+
this.buttonType = data.buttonType || ApplePayButtonType.PLAIN;
|
|
58
|
+
this.buttonStyle = data.buttonStyle || ApplePayButtonStyle.BLACK;
|
|
59
|
+
this.buttonLocale = data.buttonLocale || 'en-US';
|
|
60
|
+
}
|
|
61
|
+
get isValid() {
|
|
62
|
+
return !!(this.merchantIdentifier &&
|
|
63
|
+
this.displayName &&
|
|
64
|
+
this.initiative &&
|
|
65
|
+
this.initiativeContext);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class ApplePayPaymentRequest {
|
|
69
|
+
constructor(data) {
|
|
70
|
+
this.countryCode = data.countryCode;
|
|
71
|
+
this.currencyCode = data.currencyCode;
|
|
72
|
+
this.merchantCapabilities = data.merchantCapabilities;
|
|
73
|
+
this.supportedNetworks = data.supportedNetworks;
|
|
74
|
+
this.total = data.total;
|
|
75
|
+
this.lineItems = data.lineItems;
|
|
76
|
+
this.shippingMethods = data.shippingMethods;
|
|
77
|
+
this.applicationData = data.applicationData;
|
|
78
|
+
this.supportedCountries = data.supportedCountries;
|
|
79
|
+
}
|
|
80
|
+
get isValid() {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
return !!(this.countryCode &&
|
|
83
|
+
this.currencyCode &&
|
|
84
|
+
((_a = this.merchantCapabilities) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
85
|
+
((_b = this.supportedNetworks) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
86
|
+
((_c = this.total) === null || _c === void 0 ? void 0 : _c.label) &&
|
|
87
|
+
((_d = this.total) === null || _d === void 0 ? void 0 : _d.amount));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
50
90
|
class ApplePayHelpers {
|
|
51
91
|
static isApplePaySupported() {
|
|
52
92
|
var _a;
|
|
@@ -100,6 +140,298 @@ class ApplePayHelpers {
|
|
|
100
140
|
}
|
|
101
141
|
}
|
|
102
142
|
|
|
143
|
+
class ApplePayService {
|
|
144
|
+
constructor() {
|
|
145
|
+
this.api = Api.Api();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Initialize Apple Pay configuration
|
|
149
|
+
*/
|
|
150
|
+
initialize(applePayConfig) {
|
|
151
|
+
this.applePayConfig = new ApplePayConfig(applePayConfig);
|
|
152
|
+
if (!this.applePayConfig.isValid) {
|
|
153
|
+
throw new Error('Invalid Apple Pay configuration provided');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Validate merchant with Apple Pay servers via API
|
|
158
|
+
*/
|
|
159
|
+
async validateMerchant(authToken, accountId) {
|
|
160
|
+
const endpoint = 'apple_pay/merchant_session';
|
|
161
|
+
try {
|
|
162
|
+
const response = await this.api.post({
|
|
163
|
+
endpoint,
|
|
164
|
+
authToken,
|
|
165
|
+
headers: {
|
|
166
|
+
'Sub-Account': accountId,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
return response;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error('Backend validation failed:', error);
|
|
173
|
+
throw new Error('Merchant validation failed');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Process Apple Pay payment via API (fixed to match original logic)
|
|
178
|
+
*/
|
|
179
|
+
async processPayment(authToken, accountId, payload) {
|
|
180
|
+
const endpoint = 'apple_pay/process_token';
|
|
181
|
+
const result = await this.api.post({
|
|
182
|
+
endpoint,
|
|
183
|
+
authToken,
|
|
184
|
+
body: payload,
|
|
185
|
+
headers: {
|
|
186
|
+
'Sub-Account': accountId,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
return {
|
|
190
|
+
success: result.id && !!result.data.token,
|
|
191
|
+
data: result,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if Apple Pay is available on this device/browser
|
|
196
|
+
*/
|
|
197
|
+
isAvailable() {
|
|
198
|
+
return (ApplePayHelpers.isApplePaySupported() && ApplePayHelpers.canMakePayments());
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Check if the user has an active card for the merchant
|
|
202
|
+
*/
|
|
203
|
+
async canMakePaymentsWithActiveCard() {
|
|
204
|
+
if (!this.applePayConfig) {
|
|
205
|
+
throw new Error('Apple Pay not initialized. Call initialize() first.');
|
|
206
|
+
}
|
|
207
|
+
return await ApplePayHelpers.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Start Apple Pay session
|
|
211
|
+
*/
|
|
212
|
+
async startPaymentSession(paymentRequest, authToken, accountId) {
|
|
213
|
+
if (!this.applePayConfig) {
|
|
214
|
+
throw new Error('Apple Pay not initialized. Call initialize() first.');
|
|
215
|
+
}
|
|
216
|
+
// if (!this.isAvailable()) {
|
|
217
|
+
// throw new Error('Apple Pay is not available on this device/browser');
|
|
218
|
+
// }
|
|
219
|
+
const request = new ApplePayPaymentRequest(paymentRequest);
|
|
220
|
+
if (!request.isValid) {
|
|
221
|
+
throw new Error('Invalid payment request provided');
|
|
222
|
+
}
|
|
223
|
+
this.currentPaymentRequest = request;
|
|
224
|
+
return new Promise((resolve, reject) => {
|
|
225
|
+
try {
|
|
226
|
+
this.currentSession = new window.ApplePaySession(3, request);
|
|
227
|
+
this.setupSessionEventHandlers(resolve, reject, authToken, accountId);
|
|
228
|
+
this.currentSession.begin();
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
reject({
|
|
232
|
+
success: false,
|
|
233
|
+
error: {
|
|
234
|
+
code: 'SESSION_ERROR',
|
|
235
|
+
message: error instanceof Error
|
|
236
|
+
? error.message
|
|
237
|
+
: 'Failed to start Apple Pay session',
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Abort current Apple Pay session
|
|
245
|
+
*/
|
|
246
|
+
abortPaymentSession() {
|
|
247
|
+
if (this.currentSession) {
|
|
248
|
+
this.currentSession.abort();
|
|
249
|
+
this.currentSession = undefined;
|
|
250
|
+
this.currentPaymentRequest = undefined;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Setup Apple Pay session event handlers
|
|
255
|
+
*/
|
|
256
|
+
setupSessionEventHandlers(resolve, reject, authToken, accountId) {
|
|
257
|
+
if (!this.currentSession ||
|
|
258
|
+
!this.applePayConfig ||
|
|
259
|
+
!this.currentPaymentRequest) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.currentSession.onvalidatemerchant = async () => {
|
|
263
|
+
try {
|
|
264
|
+
if (!authToken) {
|
|
265
|
+
throw new Error('Authentication token not provided.');
|
|
266
|
+
}
|
|
267
|
+
const merchantSession = await this.validateMerchant(authToken, accountId);
|
|
268
|
+
try {
|
|
269
|
+
this.currentSession.completeMerchantValidation(merchantSession);
|
|
270
|
+
}
|
|
271
|
+
catch (completionError) {
|
|
272
|
+
console.error('Error calling completeMerchantValidation:', completionError);
|
|
273
|
+
throw completionError;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
console.error('=== MERCHANT VALIDATION ERROR ===');
|
|
278
|
+
console.error('Error during merchant validation:', error);
|
|
279
|
+
console.error('Error stack:', error.stack);
|
|
280
|
+
this.currentSession.abort();
|
|
281
|
+
reject({
|
|
282
|
+
success: false,
|
|
283
|
+
error: {
|
|
284
|
+
code: 'MERCHANT_VALIDATION_ERROR',
|
|
285
|
+
message: error instanceof Error
|
|
286
|
+
? error.message
|
|
287
|
+
: 'Merchant validation failed',
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
this.currentSession.onpaymentauthorized = async (event) => {
|
|
293
|
+
try {
|
|
294
|
+
const payment = event.payment;
|
|
295
|
+
const paymentPayload = Object.assign(Object.assign({}, payment.token), { product_details: {
|
|
296
|
+
name: this.currentPaymentRequest.total.label,
|
|
297
|
+
price: ApplePayHelpers.parseAmount(this.currentPaymentRequest.total.amount),
|
|
298
|
+
description: this.currentPaymentRequest.total.label,
|
|
299
|
+
} });
|
|
300
|
+
const paymentResult = await this.processPayment(authToken, accountId, paymentPayload);
|
|
301
|
+
if (paymentResult.success) {
|
|
302
|
+
this.currentSession.completePayment({
|
|
303
|
+
status: ApplePaySessionStatus.STATUS_SUCCESS,
|
|
304
|
+
});
|
|
305
|
+
resolve({
|
|
306
|
+
success: true,
|
|
307
|
+
token: payment.token,
|
|
308
|
+
paymentMethodId: paymentResult.data.id,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
console.error('PSP reported payment failure:', paymentResult.data);
|
|
313
|
+
this.currentSession.completePayment({
|
|
314
|
+
status: ApplePaySessionStatus.STATUS_FAILURE,
|
|
315
|
+
});
|
|
316
|
+
reject({
|
|
317
|
+
success: false,
|
|
318
|
+
error: {
|
|
319
|
+
code: 'PAYMENT_PROCESSING_ERROR',
|
|
320
|
+
message: 'Payment processing failed',
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
console.error('=== PAYMENT PROCESSING ERROR ===');
|
|
327
|
+
console.error('Error processing payment:', error);
|
|
328
|
+
console.error('Error stack:', error.stack);
|
|
329
|
+
this.currentSession.completePayment({
|
|
330
|
+
status: ApplePaySessionStatus.STATUS_FAILURE,
|
|
331
|
+
});
|
|
332
|
+
reject({
|
|
333
|
+
success: false,
|
|
334
|
+
error: {
|
|
335
|
+
code: 'PAYMENT_PROCESSING_ERROR',
|
|
336
|
+
message: error instanceof Error
|
|
337
|
+
? error.message
|
|
338
|
+
: 'Payment processing failed',
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
finally {
|
|
343
|
+
this.currentSession = undefined;
|
|
344
|
+
this.currentPaymentRequest = undefined;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
this.currentSession.onpaymentmethodselected = () => {
|
|
348
|
+
const paymentUpdate = {
|
|
349
|
+
newTotal: this.currentPaymentRequest.total,
|
|
350
|
+
newLineItems: this.currentPaymentRequest.lineItems || [],
|
|
351
|
+
};
|
|
352
|
+
try {
|
|
353
|
+
this.currentSession.completePaymentMethodSelection(paymentUpdate);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
console.error('Error completing payment method selection:', error);
|
|
357
|
+
this.currentSession.abort();
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
this.currentSession.onshippingmethodselected = () => {
|
|
361
|
+
this.currentSession.completeShippingMethodSelection({
|
|
362
|
+
status: ApplePaySessionStatus.STATUS_SUCCESS,
|
|
363
|
+
newTotal: this.currentPaymentRequest.total,
|
|
364
|
+
newLineItems: this.currentPaymentRequest.lineItems || [],
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
this.currentSession.oncancel = (event) => {
|
|
368
|
+
if (event.sessionError) {
|
|
369
|
+
console.error(event.sessionError);
|
|
370
|
+
switch (event.sessionError.code) {
|
|
371
|
+
case 'unknown':
|
|
372
|
+
console.error('Unknown error - likely merchant validation issue');
|
|
373
|
+
console.error('This usually means:');
|
|
374
|
+
console.error('1. Merchant certificate is invalid or expired');
|
|
375
|
+
console.error('2. Merchant identifier mismatch');
|
|
376
|
+
console.error('3. Backend validation endpoint issues');
|
|
377
|
+
break;
|
|
378
|
+
case 'invalidMerchantSession':
|
|
379
|
+
console.error('Invalid merchant session provided');
|
|
380
|
+
console.error('Check that the merchant session from backend is valid');
|
|
381
|
+
break;
|
|
382
|
+
case 'userCancel':
|
|
383
|
+
console.error('User cancelled the payment');
|
|
384
|
+
break;
|
|
385
|
+
default:
|
|
386
|
+
console.error('Other error code:', event.sessionError.code);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
this.currentSession = undefined;
|
|
390
|
+
this.currentPaymentRequest = undefined;
|
|
391
|
+
reject({
|
|
392
|
+
success: false,
|
|
393
|
+
error: {
|
|
394
|
+
code: 'USER_CANCELLED',
|
|
395
|
+
message: 'User cancelled the Apple Pay session',
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
if ('onerror' in this.currentSession) {
|
|
400
|
+
this.currentSession.onerror = (error) => {
|
|
401
|
+
console.error('=== APPLE PAY SESSION ERROR ===');
|
|
402
|
+
console.error('Session error:', error);
|
|
403
|
+
this.currentSession = undefined;
|
|
404
|
+
this.currentPaymentRequest = undefined;
|
|
405
|
+
reject({
|
|
406
|
+
success: false,
|
|
407
|
+
error: {
|
|
408
|
+
code: 'SESSION_ERROR',
|
|
409
|
+
message: 'Apple Pay session error occurred',
|
|
410
|
+
},
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Create a basic payment request
|
|
417
|
+
*/
|
|
418
|
+
static createPaymentRequest(amount, label, countryCode = 'US', currencyCode = 'USD') {
|
|
419
|
+
return {
|
|
420
|
+
countryCode,
|
|
421
|
+
currencyCode,
|
|
422
|
+
merchantCapabilities: ApplePayHelpers.getDefaultMerchantCapabilities(),
|
|
423
|
+
supportedNetworks: ApplePayHelpers.getDefaultSupportedNetworks(),
|
|
424
|
+
total: ApplePayHelpers.createLineItem(label, amount),
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Get current configuration
|
|
429
|
+
*/
|
|
430
|
+
getApplePayConfig() {
|
|
431
|
+
return this.applePayConfig;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
103
435
|
const ApplePaySkeleton = (props) => {
|
|
104
436
|
const { isReady } = props;
|
|
105
437
|
if (isReady) {
|
|
@@ -297,6 +629,7 @@ const ApplePay = class {
|
|
|
297
629
|
supportedNetworks: ApplePayHelpers.getDefaultSupportedNetworks(),
|
|
298
630
|
total: ApplePayHelpers.createLineItem(checkout_store.checkoutStore.paymentDescription, checkout_store.checkoutStore.paymentAmount),
|
|
299
631
|
};
|
|
632
|
+
console.log("paymentRequest", paymentRequest);
|
|
300
633
|
const result = await this.applePayService.startPaymentSession(paymentRequest, checkout_store.checkoutStore.authToken, checkout_store.checkoutStore.accountId);
|
|
301
634
|
if (result.success) {
|
|
302
635
|
this.applePayCompleted.emit({
|
|
@@ -330,29 +663,7 @@ const ApplePay = class {
|
|
|
330
663
|
}
|
|
331
664
|
};
|
|
332
665
|
}
|
|
333
|
-
// private unsubscribeCheckoutLoaded?: () => void;
|
|
334
|
-
// componentWillLoad() {
|
|
335
|
-
// this.unsubscribeCheckoutLoaded = onChange("checkoutLoaded", (loaded) => {
|
|
336
|
-
// this.applePayService = new ApplePayService();
|
|
337
|
-
// console.log("checkoutLoaded", loaded);
|
|
338
|
-
// if (loaded) {
|
|
339
|
-
// this.initializeApplePay();
|
|
340
|
-
// }
|
|
341
|
-
// });
|
|
342
|
-
// }
|
|
343
|
-
// disconnectedCallback() {
|
|
344
|
-
// this.unsubscribeCheckoutLoaded?.();
|
|
345
|
-
// this.unsubscribeCheckoutLoaded = undefined;
|
|
346
|
-
// }
|
|
347
|
-
// @Watch("merchantIdentifier")
|
|
348
|
-
// @Watch("buttonType")
|
|
349
|
-
// @Watch("buttonStyle")
|
|
350
|
-
// @Watch("disabled")
|
|
351
|
-
// watchPropsChange() {
|
|
352
|
-
// this.initializeApplePay();
|
|
353
|
-
// }
|
|
354
666
|
async initializeApplePay() {
|
|
355
|
-
console.log("initializeApplePay", checkout_store.checkoutStore.checkoutLoaded);
|
|
356
667
|
try {
|
|
357
668
|
this.isLoading = true;
|
|
358
669
|
this.error = null;
|
|
@@ -361,9 +672,9 @@ const ApplePay = class {
|
|
|
361
672
|
Boolean(checkout_store.checkoutStore.paymentCurrency) &&
|
|
362
673
|
Boolean(checkout_store.checkoutStore.authToken);
|
|
363
674
|
if (!hasRequiredConfig) {
|
|
364
|
-
this.error = "Missing required Apple Pay configuration
|
|
675
|
+
this.error = "Missing required Apple Pay configuration";
|
|
365
676
|
this.isConfigValid = false;
|
|
366
|
-
console.error("Apple Pay config error: missing required values
|
|
677
|
+
console.error("Apple Pay config error: missing required values", {
|
|
367
678
|
paymentAmount: checkout_store.checkoutStore.paymentAmount,
|
|
368
679
|
paymentCurrency: checkout_store.checkoutStore.paymentCurrency,
|
|
369
680
|
hasAuthToken: Boolean(checkout_store.checkoutStore.authToken),
|
|
@@ -396,6 +707,7 @@ const ApplePay = class {
|
|
|
396
707
|
buttonType: this.buttonType,
|
|
397
708
|
buttonStyle: this.buttonStyle,
|
|
398
709
|
};
|
|
710
|
+
this.applePayService = new ApplePayService();
|
|
399
711
|
this.applePayService.initialize(applePayConfig);
|
|
400
712
|
const hasActiveCard = await this.applePayService.canMakePaymentsWithActiveCard();
|
|
401
713
|
if (!hasActiveCard) {
|
|
@@ -429,19 +741,13 @@ const ApplePay = class {
|
|
|
429
741
|
this.applePayCancelled.emit();
|
|
430
742
|
}
|
|
431
743
|
render() {
|
|
432
|
-
// const shouldHide =
|
|
433
|
-
// !this.isLoading &&
|
|
434
|
-
// (!this.isConfigValid || !this.isAvailable || !this.canMakePayments || !checkoutStore.checkoutLoaded);
|
|
435
|
-
// if (shouldHide) {
|
|
436
|
-
// return null;
|
|
437
|
-
// }
|
|
438
744
|
const isReady = !this.isLoading &&
|
|
439
745
|
this.isAvailable &&
|
|
440
746
|
this.canMakePayments &&
|
|
441
747
|
this.isConfigValid;
|
|
442
|
-
return (index.h(styledHost.StyledHost, { key: '
|
|
748
|
+
return (index.h(styledHost.StyledHost, { key: '89555e4ca332762a2212d1ef447c9890fa9dc154' }, checkout_store.checkoutStore.checkoutLoaded && (index.h("script", { key: '0770cdfd74b354262215f651713e92cc3a4cc2a0', async: true, src: 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js', onLoad: () => {
|
|
443
749
|
this.initializeApplePay();
|
|
444
|
-
} })), index.h("div", { key: '
|
|
750
|
+
} })), index.h("div", { key: '8e97c5c22626c24d81b7fe1114b35808f3ba0758', class: 'apple-pay-container' }, index.h(ApplePaySkeleton, { key: '8c3859ab8a7b5c215366667692c84841c34a96de', isReady: isReady }), isReady && (index.h(ApplePayButton, { key: 'ab9e158a240c81530f693a6272c974a0c62fe317', buttonType: this.buttonType, buttonStyle: this.buttonStyle, disabled: this.disabled, isProcessing: this.isProcessing, isAvailable: this.isAvailable, clickHandler: this.handleApplePayClick }))), index.h("style", { key: '4182e97979dcb25b9e5e0f13fa176037fe0300e0' }, `
|
|
445
751
|
.apple-pay-container {
|
|
446
752
|
width: 100%;
|
|
447
753
|
}
|
|
@@ -7,7 +7,7 @@ var parts = require('./parts-9jMf1erK.js');
|
|
|
7
7
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
8
8
|
require('./event-types-YOY5TKUN.js');
|
|
9
9
|
var skeleton = require('./skeleton-C7DQRD6r.js');
|
|
10
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
10
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
11
11
|
var configState = require('./config-state-BBOZIS8x.js');
|
|
12
12
|
var header3 = require('./header-3-sOdOpfx3.js');
|
|
13
13
|
var utils = require('./utils-DAyWinG2.js');
|
|
@@ -18,7 +18,7 @@ require('./_commonjsHelpers-BJu3ubxk.js');
|
|
|
18
18
|
require('./business-form-options-CMII7nIK.js');
|
|
19
19
|
require('./Business-DCRzZf0w.js');
|
|
20
20
|
require('./helpers-B5OCqlIM.js');
|
|
21
|
-
require('./package-
|
|
21
|
+
require('./package-BVAhjheJ.js');
|
|
22
22
|
require('./Api-DyimBzKT.js');
|
|
23
23
|
require('./utils-ChCUZgUy.js');
|
|
24
24
|
require('./dinero-BwNN_k7x.js');
|
|
@@ -5,7 +5,7 @@ var utils = require('./utils-Bzyj4qWe.js');
|
|
|
5
5
|
var business_service = require('./business.service-BB6zl4Gc.js');
|
|
6
6
|
var getBusiness = require('./get-business-o5jPq_ME.js');
|
|
7
7
|
var ComponentError = require('./ComponentError-D4OLnOkg.js');
|
|
8
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
8
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
9
9
|
require('./parts-9jMf1erK.js');
|
|
10
10
|
require('./Api-DyimBzKT.js');
|
|
11
11
|
require('./config-state-BBOZIS8x.js');
|
|
@@ -19,7 +19,7 @@ require('./Business-DCRzZf0w.js');
|
|
|
19
19
|
require('./helpers-B5OCqlIM.js');
|
|
20
20
|
require('./state-options-CIT9xdTz.js');
|
|
21
21
|
require('./utils-DvUQQLmR.js');
|
|
22
|
-
require('./package-
|
|
22
|
+
require('./package-BVAhjheJ.js');
|
|
23
23
|
|
|
24
24
|
const BusinessDetails = class {
|
|
25
25
|
constructor(hostRef) {
|
|
@@ -11,7 +11,7 @@ require('./Refund-BefKONu4.js');
|
|
|
11
11
|
require('./Pagination-Dediz133.js');
|
|
12
12
|
var Business = require('./Business-DCRzZf0w.js');
|
|
13
13
|
require('./Dispute-CruQTF6_.js');
|
|
14
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
14
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
15
15
|
var button = require('./button-DsHDMHaa.js');
|
|
16
16
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
17
17
|
var header1 = require('./header-1-DRA3f4Jh.js');
|
|
@@ -27,7 +27,7 @@ require('./business-form-options-CMII7nIK.js');
|
|
|
27
27
|
require('./index-B32W0A3m.js');
|
|
28
28
|
require('./utils-ChCUZgUy.js');
|
|
29
29
|
require('./helpers-B5OCqlIM.js');
|
|
30
|
-
require('./package-
|
|
30
|
+
require('./package-BVAhjheJ.js');
|
|
31
31
|
require('./Api-DyimBzKT.js');
|
|
32
32
|
require('./parts-9jMf1erK.js');
|
|
33
33
|
require('./utils-DvUQQLmR.js');
|
|
@@ -9,7 +9,7 @@ require('./event-types-YOY5TKUN.js');
|
|
|
9
9
|
var header1 = require('./header-1-DRA3f4Jh.js');
|
|
10
10
|
var insuranceState = require('./insurance-state-d2thhXUX.js');
|
|
11
11
|
var header3 = require('./header-3-sOdOpfx3.js');
|
|
12
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
12
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
13
13
|
require('./config-state-BBOZIS8x.js');
|
|
14
14
|
require('./dinero-BwNN_k7x.js');
|
|
15
15
|
var ComponentError = require('./ComponentError-D4OLnOkg.js');
|
|
@@ -23,7 +23,7 @@ var Api = require('./Api-DyimBzKT.js');
|
|
|
23
23
|
var index$1 = require('./index-D-dD-aC2.js');
|
|
24
24
|
var paymentMethodOptionUtils = require('./payment-method-option-utils-WYHIHy-l.js');
|
|
25
25
|
require('./index-B32W0A3m.js');
|
|
26
|
-
require('./package-
|
|
26
|
+
require('./package-BVAhjheJ.js');
|
|
27
27
|
require('./helpers-B5OCqlIM.js');
|
|
28
28
|
require('./state-options-CIT9xdTz.js');
|
|
29
29
|
|
|
@@ -321,7 +321,6 @@ const ModularCheckout = class {
|
|
|
321
321
|
checkout_store.checkoutStore.selectedPaymentMethod = paymentMethod;
|
|
322
322
|
checkout_store.checkoutStore.paymentToken = paymentMethod.id || undefined;
|
|
323
323
|
}
|
|
324
|
-
// getAvailablePaymentMethods removed in favor of checkout-changed event
|
|
325
324
|
// if validation fails, the error will be emitted by the component
|
|
326
325
|
async validate() {
|
|
327
326
|
const promises = [];
|
|
@@ -469,7 +468,7 @@ const ModularCheckout = class {
|
|
|
469
468
|
});
|
|
470
469
|
}
|
|
471
470
|
render() {
|
|
472
|
-
return index.h(index.Host, { key: '
|
|
471
|
+
return index.h(index.Host, { key: '2cbac33c57dd2cad327f156a4630b1dba9bf3252' });
|
|
473
472
|
}
|
|
474
473
|
get hostEl() { return index.getElement(this); }
|
|
475
474
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-C9hBD-32.js');
|
|
4
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
4
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
5
5
|
require('./config-state-BBOZIS8x.js');
|
|
6
6
|
require('./dinero-BwNN_k7x.js');
|
|
7
7
|
require('./ComponentError-D4OLnOkg.js');
|
|
@@ -14,7 +14,7 @@ var parts = require('./parts-9jMf1erK.js');
|
|
|
14
14
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
15
15
|
require('./event-types-YOY5TKUN.js');
|
|
16
16
|
var index$1 = require('./index-D-dD-aC2.js');
|
|
17
|
-
require('./package-
|
|
17
|
+
require('./package-BVAhjheJ.js');
|
|
18
18
|
require('./Api-DyimBzKT.js');
|
|
19
19
|
require('./utils-ChCUZgUy.js');
|
|
20
20
|
require('./index-B32W0A3m.js');
|
|
@@ -9,7 +9,7 @@ require('./Pagination-Dediz133.js');
|
|
|
9
9
|
require('./Business-DCRzZf0w.js');
|
|
10
10
|
require('./Dispute-CruQTF6_.js');
|
|
11
11
|
var utils = require('./utils-DvUQQLmR.js');
|
|
12
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
12
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
13
13
|
var checkout_service = require('./checkout.service-B-R80p4f.js');
|
|
14
14
|
var getSubaccounts = require('./get-subaccounts-Bnfv2tEN.js');
|
|
15
15
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
@@ -19,7 +19,7 @@ require('./index-B32W0A3m.js');
|
|
|
19
19
|
require('./utils-ChCUZgUy.js');
|
|
20
20
|
require('./helpers-B5OCqlIM.js');
|
|
21
21
|
require('./state-options-CIT9xdTz.js');
|
|
22
|
-
require('./package-
|
|
22
|
+
require('./package-BVAhjheJ.js');
|
|
23
23
|
require('./Api-DyimBzKT.js');
|
|
24
24
|
require('./badge-CcJ9H85-.js');
|
|
25
25
|
require('./parts-9jMf1erK.js');
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-C9hBD-32.js');
|
|
4
4
|
var ComponentError = require('./ComponentError-D4OLnOkg.js');
|
|
5
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
5
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
6
6
|
var Dispute = require('./Dispute-CruQTF6_.js');
|
|
7
7
|
var utils = require('./utils-DvUQQLmR.js');
|
|
8
8
|
var dispute_service = require('./dispute.service-B5tITFAh.js');
|
|
9
|
-
require('./package-
|
|
9
|
+
require('./package-BVAhjheJ.js');
|
|
10
10
|
require('./Api-DyimBzKT.js');
|
|
11
11
|
require('./config-state-BBOZIS8x.js');
|
|
12
12
|
require('./index-B32W0A3m.js');
|
|
@@ -11,7 +11,7 @@ var ComponentError = require('./ComponentError-D4OLnOkg.js');
|
|
|
11
11
|
var utils = require('./utils-DvUQQLmR.js');
|
|
12
12
|
var dispute_service = require('./dispute.service-B5tITFAh.js');
|
|
13
13
|
var eventTypes = require('./event-types-BWQT2lwu.js');
|
|
14
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
14
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
15
15
|
require('./dinero-BwNN_k7x.js');
|
|
16
16
|
require('./Api-DyimBzKT.js');
|
|
17
17
|
require('./config-state-BBOZIS8x.js');
|
|
@@ -22,7 +22,7 @@ require('./Pagination-Dediz133.js');
|
|
|
22
22
|
require('./Business-DCRzZf0w.js');
|
|
23
23
|
require('./helpers-B5OCqlIM.js');
|
|
24
24
|
require('./state-options-CIT9xdTz.js');
|
|
25
|
-
require('./package-
|
|
25
|
+
require('./package-BVAhjheJ.js');
|
|
26
26
|
|
|
27
27
|
const makeUpdateDisputeResponse = ({ authToken, disputeId, service }) => async ({ payload, onSuccess, onError, final = () => { } }) => {
|
|
28
28
|
var _a;
|
|
@@ -9,7 +9,7 @@ require('./Business-DCRzZf0w.js');
|
|
|
9
9
|
require('./Dispute-CruQTF6_.js');
|
|
10
10
|
var utils = require('./utils-DvUQQLmR.js');
|
|
11
11
|
var utils$1 = require('./utils-Bzyj4qWe.js');
|
|
12
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
12
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
13
13
|
require('./config-state-BBOZIS8x.js');
|
|
14
14
|
require('./index-B32W0A3m.js');
|
|
15
15
|
require('./utils-ChCUZgUy.js');
|
|
@@ -17,7 +17,7 @@ require('./dinero-BwNN_k7x.js');
|
|
|
17
17
|
require('./helpers-B5OCqlIM.js');
|
|
18
18
|
require('./state-options-CIT9xdTz.js');
|
|
19
19
|
require('./parts-9jMf1erK.js');
|
|
20
|
-
require('./package-
|
|
20
|
+
require('./package-BVAhjheJ.js');
|
|
21
21
|
|
|
22
22
|
const api = Api.Api();
|
|
23
23
|
class ReportsService {
|
|
@@ -4,7 +4,7 @@ var index = require('./index-C9hBD-32.js');
|
|
|
4
4
|
var parts = require('./parts-9jMf1erK.js');
|
|
5
5
|
var styledHost = require('./styled-host-BfVJlAsJ.js');
|
|
6
6
|
require('./event-types-YOY5TKUN.js');
|
|
7
|
-
var checkPkgVersion = require('./check-pkg-version-
|
|
7
|
+
var checkPkgVersion = require('./check-pkg-version-BIRpFWjW.js');
|
|
8
8
|
var ComponentError = require('./ComponentError-D4OLnOkg.js');
|
|
9
9
|
var business_service = require('./business.service-BB6zl4Gc.js');
|
|
10
10
|
var Business = require('./Business-DCRzZf0w.js');
|
|
@@ -18,7 +18,7 @@ require('./Dispute-CruQTF6_.js');
|
|
|
18
18
|
var utils = require('./utils-DvUQQLmR.js');
|
|
19
19
|
var terminal_service = require('./terminal.service-D1FAYZzd.js');
|
|
20
20
|
var utils$1 = require('./utils-ChCUZgUy.js');
|
|
21
|
-
require('./package-
|
|
21
|
+
require('./package-BVAhjheJ.js');
|
|
22
22
|
require('./Api-DyimBzKT.js');
|
|
23
23
|
require('./helpers-B5OCqlIM.js');
|
|
24
24
|
require('./state-options-CIT9xdTz.js');
|