@justifi/webcomponents 6.5.1-rc.1 → 6.5.1-rc.3

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.
Files changed (157) hide show
  1. package/dist/cjs/{GooglePay-HXBAmTgL.js → GooglePay-40aEKdDF.js} +40 -9
  2. package/dist/cjs/bank-account-document-form-inputs_6.cjs.entry.js +1 -1
  3. package/dist/cjs/{business.service-DMzf08nC.js → business.service-BggHdPOV.js} +1 -1
  4. package/dist/cjs/{check-pkg-version-DNFRhNcW.js → check-pkg-version-DuPkU5qI.js} +2 -2
  5. package/dist/cjs/{checkout.service-CHNHEsrp.js → checkout.service-BUcIs9az.js} +1 -1
  6. package/dist/cjs/checkouts-list-core.cjs.entry.js +1 -1
  7. package/dist/cjs/{dispute.service-B63kcFkU.js → dispute.service-CxWqivLc.js} +1 -1
  8. package/dist/cjs/{get-payment-details-BN139jp0.js → get-payment-details-D_dDxsPG.js} +1 -1
  9. package/dist/cjs/{get-subaccounts-IgHJX5J4.js → get-subaccounts-_D9lzD5O.js} +1 -1
  10. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  11. package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +3 -3
  12. package/dist/cjs/justifi-additional-questions-form-step-core_6.cjs.entry.js +1 -1
  13. package/dist/cjs/justifi-additional-questions-form-step_9.cjs.entry.js +2 -2
  14. package/dist/cjs/justifi-apple-pay_8.cjs.entry.js +242 -21
  15. package/dist/cjs/justifi-business-details.cjs.entry.js +4 -4
  16. package/dist/cjs/justifi-business-form.cjs.entry.js +4 -4
  17. package/dist/cjs/justifi-checkout.cjs.entry.js +3 -3
  18. package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +1 -1
  19. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +5 -5
  20. package/dist/cjs/justifi-dispute-management.cjs.entry.js +4 -4
  21. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +4 -4
  22. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -3
  23. package/dist/cjs/justifi-order-terminals.cjs.entry.js +5 -5
  24. package/dist/cjs/justifi-owner-form_3.cjs.entry.js +2 -2
  25. package/dist/cjs/justifi-payment-details.cjs.entry.js +5 -5
  26. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +4 -4
  27. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +4 -4
  28. package/dist/cjs/justifi-payments-list.cjs.entry.js +4 -4
  29. package/dist/cjs/justifi-payout-details.cjs.entry.js +4 -4
  30. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +4 -4
  31. package/dist/cjs/justifi-payouts-list.cjs.entry.js +5 -5
  32. package/dist/cjs/justifi-refund-payment.cjs.entry.js +5 -5
  33. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  34. package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +1 -1
  35. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +4 -4
  36. package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +1 -1
  37. package/dist/cjs/justifi-terminals-list.cjs.entry.js +5 -5
  38. package/dist/cjs/{package-Z2EW-l1q.js → package-C6nOTkVV.js} +1 -1
  39. package/dist/cjs/payment-details-core.cjs.entry.js +1 -1
  40. package/dist/cjs/{payment.service-eOZc1Qay.js → payment.service-wWZTmyFv.js} +1 -1
  41. package/dist/cjs/payments-list-core.cjs.entry.js +1 -1
  42. package/dist/cjs/{payout.service-QVl5N-UV.js → payout.service-CWAem5VG.js} +1 -1
  43. package/dist/cjs/payouts-list-core.cjs.entry.js +1 -1
  44. package/dist/cjs/terminal-orders-list-core.cjs.entry.js +2 -2
  45. package/dist/cjs/{terminal-orders-table-g2fwrh2P.js → terminal-orders-table-DBNG4K5I.js} +1 -1
  46. package/dist/cjs/{terminal.service-BuSFyt0j.js → terminal.service-DSlqCGxE.js} +1 -1
  47. package/dist/cjs/terminals-list-core.cjs.entry.js +1 -1
  48. package/dist/collection/api/GooglePay.js +40 -9
  49. package/dist/collection/api/services/google-pay.service.js +137 -9
  50. package/dist/collection/components/modular-checkout/sub-components/google-pay.js +100 -3
  51. package/dist/collection/ui-components/google-pay-button.js +1 -5
  52. package/dist/docs.json +1 -1
  53. package/dist/esm/{GooglePay-9bPcqGZ9.js → GooglePay-f7mYX17c.js} +40 -9
  54. package/dist/esm/bank-account-document-form-inputs_6.entry.js +1 -1
  55. package/dist/esm/{business.service-2j91Emgq.js → business.service-CzHfftZk.js} +1 -1
  56. package/dist/esm/{check-pkg-version-B8HjTYV7.js → check-pkg-version-Cqb7EhvC.js} +2 -2
  57. package/dist/esm/{checkout.service-D-dEMyXF.js → checkout.service-BWdnJLVG.js} +1 -1
  58. package/dist/esm/checkouts-list-core.entry.js +1 -1
  59. package/dist/esm/{dispute.service-DPumDIuV.js → dispute.service-CqX5HR5o.js} +1 -1
  60. package/dist/esm/{get-payment-details-CD_K6FQ3.js → get-payment-details-D0T7bd_-.js} +1 -1
  61. package/dist/esm/{get-subaccounts-D1eF6c0B.js → get-subaccounts-Gil-SOoF.js} +1 -1
  62. package/dist/esm/hidden-input_2.entry.js +1 -1
  63. package/dist/esm/internal-tokenize-payment-method_7.entry.js +3 -3
  64. package/dist/esm/justifi-additional-questions-form-step-core_6.entry.js +1 -1
  65. package/dist/esm/justifi-additional-questions-form-step_9.entry.js +2 -2
  66. package/dist/esm/justifi-apple-pay_8.entry.js +242 -21
  67. package/dist/esm/justifi-business-details.entry.js +4 -4
  68. package/dist/esm/justifi-business-form.entry.js +4 -4
  69. package/dist/esm/justifi-checkout.entry.js +3 -3
  70. package/dist/esm/justifi-checkouts-list-filters.entry.js +1 -1
  71. package/dist/esm/justifi-checkouts-list.entry.js +5 -5
  72. package/dist/esm/justifi-dispute-management.entry.js +4 -4
  73. package/dist/esm/justifi-dispute-notification_3.entry.js +4 -4
  74. package/dist/esm/justifi-gross-payment-chart.entry.js +3 -3
  75. package/dist/esm/justifi-order-terminals.entry.js +5 -5
  76. package/dist/esm/justifi-owner-form_3.entry.js +2 -2
  77. package/dist/esm/justifi-payment-details.entry.js +5 -5
  78. package/dist/esm/justifi-payment-provisioning.entry.js +4 -4
  79. package/dist/esm/justifi-payment-transactions-list.entry.js +4 -4
  80. package/dist/esm/justifi-payments-list.entry.js +4 -4
  81. package/dist/esm/justifi-payout-details.entry.js +4 -4
  82. package/dist/esm/justifi-payout-transactions-list.entry.js +4 -4
  83. package/dist/esm/justifi-payouts-list.entry.js +5 -5
  84. package/dist/esm/justifi-refund-payment.entry.js +5 -5
  85. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  86. package/dist/esm/justifi-terminal-orders-list-filters.entry.js +1 -1
  87. package/dist/esm/justifi-terminal-orders-list.entry.js +4 -4
  88. package/dist/esm/justifi-terminals-list-filters.entry.js +1 -1
  89. package/dist/esm/justifi-terminals-list.entry.js +5 -5
  90. package/dist/esm/{package-BGHeOtXW.js → package-CzedYX3W.js} +1 -1
  91. package/dist/esm/payment-details-core.entry.js +1 -1
  92. package/dist/esm/{payment.service-BreQSu6J.js → payment.service-CWyZF34P.js} +1 -1
  93. package/dist/esm/payments-list-core.entry.js +1 -1
  94. package/dist/esm/{payout.service-DuqRe6oq.js → payout.service-CkTievFG.js} +1 -1
  95. package/dist/esm/payouts-list-core.entry.js +1 -1
  96. package/dist/esm/terminal-orders-list-core.entry.js +2 -2
  97. package/dist/esm/{terminal-orders-table-DSo5x2D7.js → terminal-orders-table-OX3ZvzZy.js} +1 -1
  98. package/dist/esm/{terminal.service-CkzrYIA_.js → terminal.service-Bu5-dhum.js} +1 -1
  99. package/dist/esm/terminals-list-core.entry.js +1 -1
  100. package/dist/module/GooglePay.js +40 -9
  101. package/dist/module/google-pay.js +238 -17
  102. package/dist/module/package.js +1 -1
  103. package/dist/types/api/services/google-pay.service.d.ts +1 -1
  104. package/dist/webcomponents/{p-d2935214.entry.js → p-0437c330.entry.js} +1 -1
  105. package/dist/webcomponents/{p-16812327.entry.js → p-065b24c3.entry.js} +1 -1
  106. package/dist/webcomponents/{p-9a795f44.entry.js → p-14cbf366.entry.js} +1 -1
  107. package/dist/webcomponents/{p-3c006a15.entry.js → p-1e014ee7.entry.js} +1 -1
  108. package/dist/webcomponents/{p-ee122560.entry.js → p-20e66fc0.entry.js} +1 -1
  109. package/dist/webcomponents/{p-13b55ca1.entry.js → p-22fdf7a4.entry.js} +1 -1
  110. package/dist/webcomponents/{p-c16dbe20.entry.js → p-25755af4.entry.js} +1 -1
  111. package/dist/webcomponents/{p-38e1ef4b.entry.js → p-3d3a65ca.entry.js} +1 -1
  112. package/dist/webcomponents/p-3f291e6b.entry.js +1 -0
  113. package/dist/webcomponents/{p-c4044170.entry.js → p-44011a41.entry.js} +1 -1
  114. package/dist/webcomponents/{p-b9d64d6b.entry.js → p-4ccd753b.entry.js} +1 -1
  115. package/dist/webcomponents/{p-0ca05626.entry.js → p-4f16a3ce.entry.js} +1 -1
  116. package/dist/webcomponents/{p-dd0d0f96.entry.js → p-50a32503.entry.js} +1 -1
  117. package/dist/webcomponents/{p-13ee296a.entry.js → p-57ed105e.entry.js} +1 -1
  118. package/dist/webcomponents/{p-b3f8d5d4.entry.js → p-5e3bc1dc.entry.js} +1 -1
  119. package/dist/webcomponents/{p-ea18fcd9.entry.js → p-62cfe9b6.entry.js} +1 -1
  120. package/dist/webcomponents/{p-af55fc0d.entry.js → p-6a075da4.entry.js} +1 -1
  121. package/dist/webcomponents/{p-cee402a5.entry.js → p-88074dd7.entry.js} +1 -1
  122. package/dist/webcomponents/{p-7dbd0618.entry.js → p-8c16e4aa.entry.js} +1 -1
  123. package/dist/webcomponents/{p-404b3f02.entry.js → p-8ee61443.entry.js} +1 -1
  124. package/dist/webcomponents/{p-c88babbe.entry.js → p-8efea1e4.entry.js} +1 -1
  125. package/dist/webcomponents/p-A2FbmAEt.js +1 -0
  126. package/dist/webcomponents/{p-Dy5btfGV.js → p-B4W3my_D.js} +1 -1
  127. package/dist/webcomponents/{p-CQrwlULd.js → p-BrazW3nF.js} +1 -1
  128. package/dist/webcomponents/{p-BN1PYSFf.js → p-CIOILVyM.js} +1 -1
  129. package/dist/webcomponents/{p-BKM7YeAB.js → p-CPRPR6fJ.js} +1 -1
  130. package/dist/webcomponents/p-CzedYX3W.js +1 -0
  131. package/dist/webcomponents/{p-CVhnuewz.js → p-DUs94fK3.js} +1 -1
  132. package/dist/webcomponents/{p-MdHYTSKO.js → p-DXnwIxTB.js} +1 -1
  133. package/dist/webcomponents/{p-t8p0WAW4.js → p-DeX_cIoV.js} +1 -1
  134. package/dist/webcomponents/{p-Cmb6PRFh.js → p-TKWqvm_A.js} +1 -1
  135. package/dist/webcomponents/{p-BxtmTjqW.js → p-Yp5v6wmS.js} +1 -1
  136. package/dist/webcomponents/{p-BVwVhXcQ.js → p-aZ8YkDMZ.js} +1 -1
  137. package/dist/webcomponents/{p-adddbcb7.entry.js → p-aa42e3c1.entry.js} +1 -1
  138. package/dist/webcomponents/{p-ba0762f9.entry.js → p-ad0f8d85.entry.js} +1 -1
  139. package/dist/webcomponents/{p-0b64560d.entry.js → p-b8c47cb1.entry.js} +1 -1
  140. package/dist/webcomponents/p-c11e6c03.entry.js +1 -0
  141. package/dist/webcomponents/{p-a9f75a9e.entry.js → p-c5af7149.entry.js} +1 -1
  142. package/dist/webcomponents/{p-13bdb5ed.entry.js → p-c7df4370.entry.js} +1 -1
  143. package/dist/webcomponents/p-cf9d8e1a.entry.js +1 -0
  144. package/dist/webcomponents/{p-def8124c.entry.js → p-d3663663.entry.js} +1 -1
  145. package/dist/webcomponents/{p-fe8f8a7f.entry.js → p-daedfe82.entry.js} +1 -1
  146. package/dist/webcomponents/{p-c249483e.entry.js → p-dd11e67b.entry.js} +1 -1
  147. package/dist/webcomponents/{p-1989a253.entry.js → p-e3ab5fe2.entry.js} +1 -1
  148. package/dist/webcomponents/{p-48cf806b.entry.js → p-e95e27af.entry.js} +1 -1
  149. package/dist/webcomponents/{p-3d69b6b1.entry.js → p-f66778b8.entry.js} +1 -1
  150. package/dist/webcomponents/{p-90d1c943.entry.js → p-ff212635.entry.js} +1 -1
  151. package/dist/webcomponents/webcomponents.esm.js +1 -1
  152. package/package.json +1 -1
  153. package/dist/webcomponents/p-499dc735.entry.js +0 -1
  154. package/dist/webcomponents/p-BGHeOtXW.js +0 -1
  155. package/dist/webcomponents/p-BRbk6oSh.js +0 -1
  156. package/dist/webcomponents/p-c14bc83f.entry.js +0 -1
  157. package/dist/webcomponents/p-ed9de6ed.entry.js +0 -1
@@ -4,7 +4,7 @@ var index = require('./index-BhI7cJcE.js');
4
4
  require('./config-state-CYoBVAca.js');
5
5
  require('./dinero-BwNN_k7x.js');
6
6
  require('./ComponentError-D4OLnOkg.js');
7
- require('./GooglePay-HXBAmTgL.js');
7
+ require('./GooglePay-40aEKdDF.js');
8
8
  var Pagination = require('./Pagination-Dediz133.js');
9
9
  require('./Business-DWHy_-z9.js');
10
10
  require('./Dispute-CruQTF6_.js');
@@ -75,26 +75,48 @@ export class GooglePayHelpers {
75
75
  * Check if Google Pay is supported in the current environment
76
76
  */
77
77
  static isGooglePaySupported() {
78
- return (typeof window !== 'undefined' &&
79
- 'google' in window &&
80
- 'payments' in window.google &&
81
- 'api' in window.google.payments);
78
+ const hasWindow = typeof window !== 'undefined';
79
+ const hasGoogle = hasWindow && 'google' in window;
80
+ const hasPayments = hasGoogle && 'payments' in window.google;
81
+ const hasApi = hasPayments && 'api' in window.google.payments;
82
+ const result = hasWindow && hasGoogle && hasPayments && hasApi;
83
+ console.log('[GooglePayHelpers] isGooglePaySupported:', {
84
+ hasWindow,
85
+ hasGoogle,
86
+ hasPayments,
87
+ hasApi,
88
+ result,
89
+ });
90
+ return result;
82
91
  }
83
92
  /**
84
93
  * Create a Google Pay client instance
85
94
  */
86
95
  static createGooglePayClient(environment) {
96
+ console.log('[GooglePayHelpers] createGooglePayClient: Starting', {
97
+ environment,
98
+ });
87
99
  if (!this.isGooglePaySupported()) {
100
+ console.warn('[GooglePayHelpers] createGooglePayClient: Google Pay not supported');
88
101
  return null;
89
102
  }
90
103
  try {
91
- return new window.google.payments.api.PaymentsClient({
92
- environment: environment === GooglePayEnvironment.PRODUCTION
93
- ? 'PRODUCTION'
94
- : 'TEST',
104
+ const envString = environment === GooglePayEnvironment.PRODUCTION
105
+ ? 'PRODUCTION'
106
+ : 'TEST';
107
+ console.log('[GooglePayHelpers] createGooglePayClient: Creating PaymentsClient', {
108
+ environment: envString,
95
109
  });
110
+ const client = new window.google.payments.api.PaymentsClient({
111
+ environment: envString,
112
+ });
113
+ console.log('[GooglePayHelpers] createGooglePayClient: Client created successfully', {
114
+ hasClient: !!client,
115
+ });
116
+ return client;
96
117
  }
97
- catch (_error) {
118
+ catch (error) {
119
+ console.error('[GooglePayHelpers] createGooglePayClient: Error creating client', error);
98
120
  return null;
99
121
  }
100
122
  }
@@ -168,11 +190,20 @@ export class GooglePayHelpers {
168
190
  * Create base payment data request check
169
191
  */
170
192
  static createBasePaymentDataRequest() {
193
+ var _a;
194
+ console.log('[GooglePayHelpers] createBasePaymentDataRequest: Creating base request', {
195
+ accountId: checkoutStore.accountId,
196
+ });
171
197
  const base = {
172
198
  apiVersion: 2,
173
199
  apiVersionMinor: 0,
174
200
  allowedPaymentMethods: [this.createPaymentMethodData()],
175
201
  };
202
+ console.log('[GooglePayHelpers] createBasePaymentDataRequest: Base request created', {
203
+ apiVersion: base.apiVersion,
204
+ apiVersionMinor: base.apiVersionMinor,
205
+ allowedPaymentMethodsCount: (_a = base.allowedPaymentMethods) === null || _a === void 0 ? void 0 : _a.length,
206
+ });
176
207
  // For development and broader availability of the button, do not require an existing card
177
208
  // This allows isReadyToPay to return true on supported browsers even without a saved payment method
178
209
  base.existingPaymentMethodRequired = false;
@@ -9,22 +9,44 @@ export class GooglePayService {
9
9
  * Initialize Google Pay configuration
10
10
  */
11
11
  initialize(googlePayConfig) {
12
+ console.log('[GooglePayService] initialize: Starting initialization', {
13
+ config: googlePayConfig,
14
+ });
12
15
  this.googlePayConfig = new GooglePayConfig(googlePayConfig);
16
+ console.log('[GooglePayService] initialize: Config object created', {
17
+ isValid: this.googlePayConfig.isValid,
18
+ environment: this.googlePayConfig.environment,
19
+ merchantId: this.googlePayConfig.merchantId,
20
+ });
13
21
  if (!this.googlePayConfig.isValid) {
22
+ console.error('[GooglePayService] initialize: Invalid configuration');
14
23
  throw new Error('Invalid Google Pay configuration provided');
15
24
  }
16
25
  // Create Google Pay client
26
+ console.log('[GooglePayService] initialize: Creating Google Pay client', {
27
+ environment: this.googlePayConfig.environment,
28
+ });
17
29
  this.googlePayClient = GooglePayHelpers.createGooglePayClient(this.googlePayConfig.environment);
18
30
  if (!this.googlePayClient) {
31
+ console.error('[GooglePayService] initialize: Failed to create client');
19
32
  throw new Error('Failed to create Google Pay client');
20
33
  }
21
- // No debug logs
34
+ console.log('[GooglePayService] initialize: Client created successfully', {
35
+ hasClient: !!this.googlePayClient,
36
+ });
22
37
  }
23
38
  /**
24
39
  * Process Google Pay payment via API
25
40
  */
26
41
  async processPayment(authToken, accountId, payload) {
42
+ var _a;
27
43
  const endpoint = PROCESS_TOKEN_ENDPOINT;
44
+ console.log('[GooglePayService] processPayment: Starting', {
45
+ endpoint,
46
+ hasAuthToken: !!authToken,
47
+ accountId,
48
+ payload,
49
+ });
28
50
  try {
29
51
  const result = await this.api.post({
30
52
  endpoint,
@@ -34,12 +56,20 @@ export class GooglePayService {
34
56
  'sub-account': accountId,
35
57
  },
36
58
  });
59
+ console.log('[GooglePayService] processPayment: API response received', {
60
+ hasId: !!result.id,
61
+ hasToken: !!((_a = result.data) === null || _a === void 0 ? void 0 : _a.token),
62
+ result,
63
+ });
64
+ const success = result.id && !!result.data.token;
65
+ console.log('[GooglePayService] processPayment: Result', { success });
37
66
  return {
38
- success: result.id && !!result.data.token,
67
+ success,
39
68
  data: result,
40
69
  };
41
70
  }
42
- catch (_error) {
71
+ catch (error) {
72
+ console.error('[GooglePayService] processPayment: API error', error);
43
73
  throw new Error('Google Pay payment processing failed');
44
74
  }
45
75
  }
@@ -47,21 +77,42 @@ export class GooglePayService {
47
77
  * Check if Google Pay is available on this device/browser
48
78
  */
49
79
  isAvailable() {
50
- return GooglePayHelpers.isGooglePaySupported() && !!this.googlePayClient;
80
+ const isSupported = GooglePayHelpers.isGooglePaySupported();
81
+ const hasClient = !!this.googlePayClient;
82
+ const result = isSupported && hasClient;
83
+ console.log('[GooglePayService] isAvailable:', {
84
+ isSupported,
85
+ hasClient,
86
+ result,
87
+ });
88
+ return result;
51
89
  }
52
90
  /**
53
91
  * Check if the user can make payments with Google Pay
54
92
  */
55
93
  async canMakePayments() {
94
+ console.log('[GooglePayService] canMakePayments: Checking', {
95
+ hasClient: !!this.googlePayClient,
96
+ hasConfig: !!this.googlePayConfig,
97
+ });
56
98
  if (!this.googlePayClient || !this.googlePayConfig) {
99
+ console.warn('[GooglePayService] canMakePayments: Missing client or config');
57
100
  return false;
58
101
  }
59
102
  try {
60
103
  const baseRequest = GooglePayHelpers.createBasePaymentDataRequest();
104
+ console.log('[GooglePayService] canMakePayments: Calling isReadyToPay', {
105
+ baseRequest,
106
+ });
61
107
  const response = await this.googlePayClient.isReadyToPay(baseRequest);
108
+ console.log('[GooglePayService] canMakePayments: Response received', {
109
+ result: response.result,
110
+ response,
111
+ });
62
112
  return response.result;
63
113
  }
64
- catch (_error) {
114
+ catch (error) {
115
+ console.error('[GooglePayService] canMakePayments: Error', error);
65
116
  return false;
66
117
  }
67
118
  }
@@ -70,27 +121,53 @@ export class GooglePayService {
70
121
  */
71
122
  async startPaymentSession(paymentDataRequest, authToken, accountId) {
72
123
  var _a;
124
+ console.log('[GooglePayService] startPaymentSession: Starting', {
125
+ hasConfig: !!this.googlePayConfig,
126
+ hasClient: !!this.googlePayClient,
127
+ hasAuthToken: !!authToken,
128
+ accountId,
129
+ paymentDataRequest,
130
+ });
73
131
  if (!this.googlePayConfig || !this.googlePayClient) {
132
+ console.error('[GooglePayService] startPaymentSession: Not initialized');
74
133
  throw new Error('Google Pay not initialized. Call initialize() first.');
75
134
  }
76
135
  if (!this.isAvailable()) {
136
+ console.error('[GooglePayService] startPaymentSession: Not available');
77
137
  throw new Error('Google Pay is not available on this device/browser');
78
138
  }
79
139
  const request = new GooglePayPaymentDataRequest(paymentDataRequest);
140
+ console.log('[GooglePayService] startPaymentSession: Request object created', {
141
+ isValid: request.isValid,
142
+ request,
143
+ });
80
144
  if (!request.isValid) {
145
+ console.error('[GooglePayService] startPaymentSession: Invalid request');
81
146
  throw new Error('Invalid payment data request provided');
82
147
  }
83
148
  try {
149
+ console.log('[GooglePayService] startPaymentSession: Loading payment data...');
84
150
  const paymentData = await this.googlePayClient.loadPaymentData(request);
151
+ console.log('[GooglePayService] startPaymentSession: Payment data loaded', {
152
+ hasPaymentData: !!paymentData,
153
+ paymentMethodData: paymentData === null || paymentData === void 0 ? void 0 : paymentData.paymentMethodData,
154
+ });
85
155
  // Build top-level snake_case fields from Google Pay tokenizationData
86
156
  const tokenizationData = (_a = paymentData === null || paymentData === void 0 ? void 0 : paymentData.paymentMethodData) === null || _a === void 0 ? void 0 : _a.tokenizationData;
157
+ console.log('[GooglePayService] startPaymentSession: Extracted tokenization data', {
158
+ hasTokenizationData: !!tokenizationData,
159
+ tokenizationData,
160
+ });
87
161
  const tokenObj = (() => {
88
162
  if ((tokenizationData === null || tokenizationData === void 0 ? void 0 : tokenizationData.token) &&
89
163
  typeof tokenizationData.token === 'string') {
90
164
  try {
91
- return JSON.parse(tokenizationData.token);
165
+ const parsed = JSON.parse(tokenizationData.token);
166
+ console.log('[GooglePayService] startPaymentSession: Parsed token', parsed);
167
+ return parsed;
92
168
  }
93
169
  catch (_e) {
170
+ console.warn('[GooglePayService] startPaymentSession: Failed to parse token, using raw', _e);
94
171
  return tokenizationData;
95
172
  }
96
173
  }
@@ -107,8 +184,19 @@ export class GooglePayService {
107
184
  : undefined,
108
185
  signedMessage: tokenObj === null || tokenObj === void 0 ? void 0 : tokenObj.signedMessage,
109
186
  };
187
+ console.log('[GooglePayService] startPaymentSession: Token process request created', {
188
+ hasProtocolVersion: !!tokenProcessRequest.protocolVersion,
189
+ hasSignature: !!tokenProcessRequest.signature,
190
+ hasSignedMessage: !!tokenProcessRequest.signedMessage,
191
+ hasIntermediateSigningKey: !!tokenProcessRequest.intermediateSigningKey,
192
+ });
193
+ console.log('[GooglePayService] startPaymentSession: Processing payment...');
110
194
  const paymentResult = await this.processPayment(authToken, accountId, tokenProcessRequest);
195
+ console.log('[GooglePayService] startPaymentSession: Payment processed', paymentResult);
111
196
  if (paymentResult.success) {
197
+ console.log('[GooglePayService] startPaymentSession: Payment successful', {
198
+ paymentMethodId: paymentResult.data.id,
199
+ });
112
200
  return {
113
201
  success: true,
114
202
  paymentData: paymentData,
@@ -116,6 +204,7 @@ export class GooglePayService {
116
204
  };
117
205
  }
118
206
  else {
207
+ console.error('[GooglePayService] startPaymentSession: Payment processing failed');
119
208
  return {
120
209
  success: false,
121
210
  error: {
@@ -126,11 +215,17 @@ export class GooglePayService {
126
215
  }
127
216
  }
128
217
  catch (error) {
218
+ console.error('[GooglePayService] startPaymentSession: Exception caught', error);
129
219
  // Handle different types of errors
130
220
  if (error && typeof error === 'object' && 'statusCode' in error) {
131
221
  const googlePayError = error;
222
+ console.log('[GooglePayService] startPaymentSession: Google Pay error', {
223
+ statusCode: googlePayError.statusCode,
224
+ statusMessage: googlePayError.statusMessage,
225
+ });
132
226
  switch (googlePayError.statusCode) {
133
227
  case 'CANCELED':
228
+ console.log('[GooglePayService] startPaymentSession: User cancelled');
134
229
  return {
135
230
  success: false,
136
231
  error: {
@@ -139,6 +234,7 @@ export class GooglePayService {
139
234
  },
140
235
  };
141
236
  case 'DEVELOPER_ERROR':
237
+ console.error('[GooglePayService] startPaymentSession: Developer error');
142
238
  return {
143
239
  success: false,
144
240
  error: {
@@ -147,6 +243,9 @@ export class GooglePayService {
147
243
  },
148
244
  };
149
245
  default:
246
+ console.error('[GooglePayService] startPaymentSession: Unknown error', {
247
+ statusCode: googlePayError.statusCode,
248
+ });
150
249
  return {
151
250
  success: false,
152
251
  error: {
@@ -156,6 +255,7 @@ export class GooglePayService {
156
255
  };
157
256
  }
158
257
  }
258
+ console.error('[GooglePayService] startPaymentSession: Generic error', error);
159
259
  return {
160
260
  success: false,
161
261
  error: {
@@ -191,22 +291,43 @@ export class GooglePayService {
191
291
  * Prefetch payment data for faster loading
192
292
  */
193
293
  prefetchPaymentData(paymentDataRequest) {
294
+ console.log('[GooglePayService] prefetchPaymentData: Starting', {
295
+ hasClient: !!this.googlePayClient,
296
+ paymentDataRequest,
297
+ });
194
298
  if (!this.googlePayClient) {
299
+ console.warn('[GooglePayService] prefetchPaymentData: No client available');
195
300
  return;
196
301
  }
197
302
  const request = new GooglePayPaymentDataRequest(paymentDataRequest);
303
+ console.log('[GooglePayService] prefetchPaymentData: Request created', {
304
+ isValid: request.isValid,
305
+ });
198
306
  if (!request.isValid) {
307
+ console.warn('[GooglePayService] prefetchPaymentData: Invalid request');
199
308
  return;
200
309
  }
201
310
  try {
311
+ console.log('[GooglePayService] prefetchPaymentData: Calling prefetchPaymentData');
202
312
  this.googlePayClient.prefetchPaymentData(request);
313
+ console.log('[GooglePayService] prefetchPaymentData: Prefetch complete');
314
+ }
315
+ catch (error) {
316
+ console.error('[GooglePayService] prefetchPaymentData: Error', error);
203
317
  }
204
- catch (_error) { }
205
318
  }
206
319
  /**
207
320
  * Create a basic payment data request
208
321
  */
209
- static createPaymentDataRequest(amount, label, countryCode = 'US', currencyCode = 'USD', merchantName) {
322
+ static createPaymentDataRequest(amount, label, countryCode = 'US', currencyCode = 'USD', merchantName, merchantId) {
323
+ var _a;
324
+ console.log('[GooglePayService] createPaymentDataRequest: Creating request', {
325
+ amount,
326
+ label,
327
+ countryCode,
328
+ currencyCode,
329
+ merchantName,
330
+ });
210
331
  const request = {
211
332
  apiVersion: 2,
212
333
  apiVersionMinor: 0,
@@ -219,10 +340,17 @@ export class GooglePayService {
219
340
  totalPriceLabel: label,
220
341
  },
221
342
  merchantInfo: {
343
+ merchantId,
222
344
  merchantName,
223
345
  },
224
346
  };
225
- // No debug logs
347
+ console.log('[GooglePayService] createPaymentDataRequest: Request created', {
348
+ apiVersion: request.apiVersion,
349
+ apiVersionMinor: request.apiVersionMinor,
350
+ transactionInfo: request.transactionInfo,
351
+ merchantInfo: request.merchantInfo,
352
+ allowedPaymentMethodsCount: (_a = request.allowedPaymentMethods) === null || _a === void 0 ? void 0 : _a.length,
353
+ });
226
354
  return request;
227
355
  }
228
356
  /**
@@ -25,19 +25,42 @@ export class GooglePay {
25
25
  this.showSkeleton = true;
26
26
  this.handleGooglePayClick = async () => {
27
27
  var _a;
28
+ console.log('[GooglePay] handleGooglePayClick: Button clicked', {
29
+ isProcessing: this.isProcessing,
30
+ disabled: this.disabled,
31
+ isAvailable: this.isAvailable,
32
+ canMakePayments: this.canMakePayments,
33
+ });
28
34
  if (this.isProcessing ||
29
35
  this.disabled ||
30
36
  !this.isAvailable ||
31
37
  !this.canMakePayments) {
38
+ console.warn('[GooglePay] handleGooglePayClick: Payment blocked', {
39
+ reason: this.isProcessing ? 'isProcessing' :
40
+ this.disabled ? 'disabled' :
41
+ !this.isAvailable ? 'notAvailable' :
42
+ !this.canMakePayments ? 'cannotMakePayments' : 'unknown',
43
+ });
32
44
  return;
33
45
  }
34
46
  try {
47
+ console.log('[GooglePay] handleGooglePayClick: Starting payment session');
35
48
  this.isProcessing = true;
36
49
  this.error = null;
37
50
  this.googlePayStarted.emit();
51
+ console.log('[GooglePay] handleGooglePayClick: googlePayStarted event emitted');
38
52
  const paymentDataRequest = this.createPaymentDataRequest();
53
+ console.log('[GooglePay] handleGooglePayClick: Starting payment session with service', {
54
+ hasAuthToken: !!checkoutStore.authToken,
55
+ accountId: checkoutStore.accountId,
56
+ });
39
57
  const result = await this.googlePayService.startPaymentSession(paymentDataRequest, checkoutStore.authToken, checkoutStore.accountId);
58
+ console.log('[GooglePay] handleGooglePayClick: Payment session result', result);
40
59
  if (result.success) {
60
+ console.log('[GooglePay] handleGooglePayClick: Payment successful', {
61
+ paymentMethodId: result.paymentMethodId,
62
+ hasPaymentData: !!result.paymentData,
63
+ });
41
64
  this.googlePayCompleted.emit({
42
65
  success: true,
43
66
  paymentData: result.paymentData,
@@ -45,11 +68,15 @@ export class GooglePay {
45
68
  });
46
69
  }
47
70
  else {
71
+ console.error('[GooglePay] handleGooglePayClick: Payment failed', {
72
+ error: result.error,
73
+ });
48
74
  this.googlePayCompleted.emit({
49
75
  success: false,
50
76
  error: result.error,
51
77
  });
52
78
  if (((_a = result.error) === null || _a === void 0 ? void 0 : _a.code) === "USER_CANCELLED") {
79
+ console.log('[GooglePay] handleGooglePayClick: User cancelled payment');
53
80
  this.googlePayCancelled.emit();
54
81
  }
55
82
  else {
@@ -58,6 +85,7 @@ export class GooglePay {
58
85
  }
59
86
  }
60
87
  catch (error) {
88
+ console.error('[GooglePay] handleGooglePayClick: Exception during payment', error);
61
89
  const errorMessage = error instanceof Error ? error.message : "Payment failed";
62
90
  this.error = errorMessage;
63
91
  this.googlePayCompleted.emit({
@@ -67,27 +95,48 @@ export class GooglePay {
67
95
  }
68
96
  finally {
69
97
  this.isProcessing = false;
98
+ console.log('[GooglePay] handleGooglePayClick: Payment flow complete', {
99
+ isProcessing: this.isProcessing,
100
+ error: this.error,
101
+ });
70
102
  }
71
103
  };
72
104
  }
73
105
  watchConfigChange() {
106
+ console.log('[GooglePay] watchConfigChange: Configuration changed', {
107
+ merchantId: this.merchantId,
108
+ environment: this.environment,
109
+ });
74
110
  this.initializeGooglePay();
75
111
  }
76
112
  componentWillLoad() {
113
+ console.log('[GooglePay] componentWillLoad: Initializing GooglePayService');
77
114
  this.googlePayService = new GooglePayService();
115
+ console.log('[GooglePay] componentWillLoad: GooglePayService created', {
116
+ service: this.googlePayService,
117
+ });
78
118
  }
79
119
  componentDidLoad() {
120
+ console.log('[GooglePay] componentDidLoad: Setting up store subscriptions', {
121
+ checkoutLoaded: checkoutStore.checkoutLoaded,
122
+ paymentAmount: checkoutStore.paymentAmount,
123
+ paymentCurrency: checkoutStore.paymentCurrency,
124
+ paymentDescription: checkoutStore.paymentDescription,
125
+ });
80
126
  const unsub = onChange("paymentAmount", () => {
127
+ console.log('[GooglePay] paymentAmount changed:', checkoutStore.paymentAmount);
81
128
  this.prefetchPaymentData();
82
129
  });
83
130
  if (typeof unsub === 'function')
84
131
  this.unsubscribes.push(unsub);
85
132
  const unsubCurrency = onChange("paymentCurrency", () => {
133
+ console.log('[GooglePay] paymentCurrency changed:', checkoutStore.paymentCurrency);
86
134
  this.prefetchPaymentData();
87
135
  });
88
136
  if (typeof unsubCurrency === 'function')
89
137
  this.unsubscribes.push(unsubCurrency);
90
138
  const unsubDesc = onChange("paymentDescription", () => {
139
+ console.log('[GooglePay] paymentDescription changed:', checkoutStore.paymentDescription);
91
140
  this.prefetchPaymentData();
92
141
  });
93
142
  if (typeof unsubDesc === 'function')
@@ -136,17 +185,31 @@ export class GooglePay {
136
185
  * Prefetch payment data for faster load times of the Google Pay sheet.
137
186
  */
138
187
  async prefetchPaymentData() {
188
+ console.log('[GooglePay] prefetchPaymentData: Called', {
189
+ isAvailable: this.isAvailable,
190
+ canMakePayments: this.canMakePayments,
191
+ });
139
192
  if (!this.isAvailable || !this.canMakePayments) {
193
+ console.warn('[GooglePay] prefetchPaymentData: Skipped - not available or cannot make payments');
140
194
  return;
141
195
  }
142
196
  const paymentDataRequest = this.createPaymentDataRequest();
197
+ console.log('[GooglePay] prefetchPaymentData: Prefetching', { paymentDataRequest });
143
198
  this.googlePayService.prefetchPaymentData(paymentDataRequest);
199
+ console.log('[GooglePay] prefetchPaymentData: Prefetch complete');
144
200
  }
145
201
  async initializeGooglePay() {
202
+ console.log('[GooglePay] initializeGooglePay: Starting initialization');
146
203
  try {
147
204
  this.isLoading = true;
148
205
  this.error = null;
206
+ console.log('[GooglePay] initializeGooglePay: Checking payment amount', {
207
+ paymentAmount: checkoutStore.paymentAmount,
208
+ paymentCurrency: checkoutStore.paymentCurrency,
209
+ paymentDescription: checkoutStore.paymentDescription,
210
+ });
149
211
  if (!checkoutStore.paymentAmount) {
212
+ console.error('[GooglePay] initializeGooglePay: Missing payment amount');
150
213
  this.error = "Missing required Google Pay configuration";
151
214
  this.isLoading = false;
152
215
  return;
@@ -159,23 +222,39 @@ export class GooglePay {
159
222
  buttonStyle: this.buttonStyle,
160
223
  buttonSizeMode: this.buttonSizeMode,
161
224
  };
225
+ console.log('[GooglePay] initializeGooglePay: Config created', googlePayConfig);
162
226
  this.googlePayService.initialize(googlePayConfig);
227
+ console.log('[GooglePay] initializeGooglePay: Service initialized');
163
228
  this.isAvailable = this.googlePayService.isAvailable();
229
+ console.log('[GooglePay] initializeGooglePay: Availability check', {
230
+ isAvailable: this.isAvailable,
231
+ });
164
232
  if (!this.isAvailable) {
233
+ console.warn('[GooglePay] initializeGooglePay: Google Pay not available on device');
165
234
  this.error = "Google Pay is not supported on this device";
166
235
  this.isLoading = false;
167
236
  return;
168
237
  }
238
+ console.log('[GooglePay] initializeGooglePay: Checking canMakePayments...');
169
239
  this.canMakePayments = await this.googlePayService.canMakePayments();
240
+ console.log('[GooglePay] initializeGooglePay: canMakePayments result', {
241
+ canMakePayments: this.canMakePayments,
242
+ });
170
243
  if (!this.canMakePayments) {
244
+ console.warn('[GooglePay] initializeGooglePay: Cannot make payments');
171
245
  this.error = "Google Pay is not available for payments";
172
246
  this.isLoading = false;
173
247
  return;
174
248
  }
175
249
  const paymentDataRequest = this.createPaymentDataRequest();
250
+ console.log('[GooglePay] initializeGooglePay: Prefetching payment data', {
251
+ paymentDataRequest,
252
+ });
176
253
  this.googlePayService.prefetchPaymentData(paymentDataRequest);
254
+ console.log('[GooglePay] initializeGooglePay: Initialization complete');
177
255
  }
178
256
  catch (error) {
257
+ console.error('[GooglePay] initializeGooglePay: Error during initialization', error);
179
258
  this.error =
180
259
  error instanceof Error
181
260
  ? error.message
@@ -183,19 +262,37 @@ export class GooglePay {
183
262
  }
184
263
  finally {
185
264
  this.isLoading = false;
265
+ console.log('[GooglePay] initializeGooglePay: Final state', {
266
+ isLoading: this.isLoading,
267
+ isAvailable: this.isAvailable,
268
+ canMakePayments: this.canMakePayments,
269
+ error: this.error,
270
+ });
186
271
  }
187
272
  }
188
273
  createPaymentDataRequest() {
189
- return GooglePayService.createPaymentDataRequest(checkoutStore.paymentAmount, checkoutStore.paymentDescription, this.countryCode, checkoutStore.paymentCurrency, this.merchantName);
274
+ const request = GooglePayService.createPaymentDataRequest(checkoutStore.paymentAmount, checkoutStore.paymentDescription, this.countryCode, checkoutStore.paymentCurrency, this.merchantName, this.merchantId);
275
+ console.log('[GooglePay] createPaymentDataRequest: Created request', {
276
+ amount: checkoutStore.paymentAmount,
277
+ currency: checkoutStore.paymentCurrency,
278
+ description: checkoutStore.paymentDescription,
279
+ countryCode: this.countryCode,
280
+ merchantName: this.merchantName,
281
+ request,
282
+ });
283
+ return request;
190
284
  }
191
285
  render() {
192
286
  const showError = !this.isLoading && !!this.error;
193
287
  const showDeviceUnavailable = !this.isLoading && !this.error && !this.isAvailable;
194
288
  const showPaymentsUnavailable = !this.isLoading && !this.error && this.isAvailable && !this.canMakePayments;
195
289
  const showButton = !this.isLoading && !this.error && this.isAvailable && this.canMakePayments;
196
- return (h(StyledHost, { key: 'd85684b123cdba175d68a2e216f9150780ac7cf9' }, checkoutStore.checkoutLoaded && (h("script", { key: 'b78bb8980d670e5b66cb907f89cee6ff2238205c', async: true, src: 'https://pay.google.com/gp/p/js/pay.js', onLoad: () => {
290
+ return (h(StyledHost, { key: 'cf4dcfa14dd83683c0d6e811ea464968c38f38d6' }, checkoutStore.checkoutLoaded && (h("script", { key: 'e942fe8e2eb80ee0d2119e864c62d89a79d9d12a', async: true, src: 'https://pay.google.com/gp/p/js/pay.js', onLoad: () => {
291
+ console.log('[GooglePay] Script loaded: Google Pay JS library loaded successfully');
197
292
  this.initializeGooglePay();
198
- } })), h("div", { key: 'e405efb3a164be9e1d9db5beeb3c01471b647aaf', class: 'google-pay-container' }, h(GooglePaySkeleton, { key: 'c17dbb3e305678a1da10e3741ff0b610c549be6e', isLoading: this.isLoading }), showError && (h("div", { key: '726895b7c76f3edbbbb1930a317d826b8f8f11fd', class: 'google-pay-error', role: 'alert', "data-testid": 'gp-error' }, h("span", { key: '23342ca70b6b5bf28f846ca519cc4fbfb065fc67', class: 'error-icon' }, "\u26A0\uFE0F"), h("span", { key: '008315696bc7b7f78f69cfc80160dacabf1205b5', class: 'error-message' }, this.error))), showDeviceUnavailable && (h("div", { key: '2e87b4a9e5d0c0201333b79b9c190ca14932391b', class: 'google-pay-unavailable', "data-testid": 'gp-device-unavailable' }, h("span", { key: '6db13fc44661500a964422d18550cb31e275f076', class: 'unavailable-message' }, "Google Pay is not available on this device"))), showPaymentsUnavailable && (h("div", { key: 'c2ca09e36652800092cc6bcbe4a351b0d604bae2', class: 'google-pay-unavailable', "data-testid": 'gp-payments-unavailable' }, h("span", { key: 'a5e75ccbb269249327192b927a0df879d90aefe5', class: 'unavailable-message' }, "Google Pay is not available for payments"))), showButton && (h(GooglePayButton, { key: 'a2af46b3970620491e5c005e2b57f7a6d6f06e2c', "data-testid": 'gp-button', buttonType: this.buttonType, buttonStyle: this.buttonStyle, buttonSizeMode: this.buttonSizeMode, disabled: this.disabled, isProcessing: this.isProcessing, isAvailable: this.isAvailable, clickHandler: this.handleGooglePayClick }))), h("style", { key: '9890ac44c4f047484396e0b4ae0d04a31489e61f' }, `
293
+ }, onError: (e) => {
294
+ console.error('[GooglePay] Script error: Failed to load Google Pay JS library', e);
295
+ } })), h("div", { key: '7ce1234392d3ea3abdcb1a385462cf740f4b98bb', class: 'google-pay-container' }, h(GooglePaySkeleton, { key: '3532e93f39bb69d76663c159bc6b1322a39e1361', isLoading: this.isLoading }), showError && (h("div", { key: '9e42e567d383522d03bc361008cb470fd2e2d602', class: 'google-pay-error', role: 'alert', "data-testid": 'gp-error' }, h("span", { key: '8b49d628ff8f5175d36f82e32191f1f3291e826f', class: 'error-icon' }, "\u26A0\uFE0F"), h("span", { key: 'b01e94934cd30b8dbad3127239ea625c51511d35', class: 'error-message' }, this.error))), showDeviceUnavailable && (h("div", { key: '12ad123c7516e9ce2ad1084f6b0c366e8bb5b9d5', class: 'google-pay-unavailable', "data-testid": 'gp-device-unavailable' }, h("span", { key: 'e0fa8f13423b6b545b340cc4b2b0411e833202c6', class: 'unavailable-message' }, "Google Pay is not available on this device"))), showPaymentsUnavailable && (h("div", { key: 'acb4c6661ca0aa6b944c8ed67642c4ad9effa1e5', class: 'google-pay-unavailable', "data-testid": 'gp-payments-unavailable' }, h("span", { key: '8a83dc8f5140d3ecade1fd68f69b5ebeaeb020d2', class: 'unavailable-message' }, "Google Pay is not available for payments"))), showButton && (h(GooglePayButton, { key: '46ea586c90aaa5eb909af4f1dfcb873a7ac50069', "data-testid": 'gp-button', buttonType: this.buttonType, buttonStyle: this.buttonStyle, buttonSizeMode: this.buttonSizeMode, disabled: this.disabled, isProcessing: this.isProcessing, isAvailable: this.isAvailable, clickHandler: this.handleGooglePayClick }))), h("style", { key: '8f77166ec7d772f0c51c74cdb166f9e8ae295088' }, `
199
296
  .google-pay-container {
200
297
  width: 100%;
201
298
  }