@akinon/pz-flow-payment 1.108.0-rc.4 → 1.108.0-rc.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @akinon/pz-flow-payment
2
2
 
3
+ ## 1.108.0-rc.6
4
+
5
+ ## 1.108.0-rc.5
6
+
7
+ ### Minor Changes
8
+
9
+ - 31a2d35: ZERO-3640: Refactor checkout API call to include useFormData option; update FlowPayment component for improved error handling and code readability
10
+
3
11
  ## 1.108.0-rc.4
4
12
 
5
13
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/pz-flow-payment",
3
3
  "license": "MIT",
4
- "version": "1.108.0-rc.4",
4
+ "version": "1.108.0-rc.6",
5
5
  "main": "src/index.tsx",
6
6
  "dependencies": {
7
7
  "@checkout.com/checkout-web-components": "0.7.0-beta"
@@ -78,7 +78,8 @@ export default function FlowPayment({
78
78
  const lastAmountRef = useRef<string | null>(null);
79
79
  const isInitializingRef = useRef<boolean>(false);
80
80
  const [errors, setErrors] = useState<any>(null);
81
- const [walletSelectionReady, setWalletSelectionReady] = useState<boolean>(false);
81
+ const [walletSelectionReady, setWalletSelectionReady] =
82
+ useState<boolean>(false);
82
83
 
83
84
  // Memoize the amount to track actual changes
84
85
  const currentAmount = useMemo(() => {
@@ -98,7 +99,9 @@ export default function FlowPayment({
98
99
  );
99
100
 
100
101
  if (!walletPaymentPageContext) {
101
- setErrors('Payment method not available. Please try a different payment option.');
102
+ setErrors(
103
+ 'Payment method not available. Please try a different payment option.'
104
+ );
102
105
  setWalletSelectionReady(false);
103
106
  return;
104
107
  }
@@ -125,7 +128,7 @@ export default function FlowPayment({
125
128
 
126
129
  try {
127
130
  const ckoPaymentId = paymentData?.id;
128
- const isSuccess = paymentData?.status === 'approved';
131
+ const isSuccess = paymentData?.status === 'Approved';
129
132
 
130
133
  const paymentCompleteResponse = await dispatch(
131
134
  checkoutApi.endpoints.setWalletCompletePage.initiate({
@@ -150,10 +153,7 @@ export default function FlowPayment({
150
153
 
151
154
  const redirectUrlWithLocale = `${
152
155
  window.location.origin
153
- }${getUrlPathWithLocale(
154
- redirectUrl,
155
- getCookie('pz-locale') || 'en'
156
- )}`;
156
+ }${getUrlPathWithLocale(redirectUrl, getCookie('pz-locale') || 'en')}`;
157
157
 
158
158
  window.location.href = redirectUrlWithLocale;
159
159
  }
@@ -207,7 +207,9 @@ export default function FlowPayment({
207
207
 
208
208
  // If we don't have payment session data, we need to wait for it
209
209
  if (!paymentSession) {
210
- console.warn('FlowPayment: Payment session not available yet, component will retry when data is ready');
210
+ console.warn(
211
+ 'FlowPayment: Payment session not available yet, component will retry when data is ready'
212
+ );
211
213
  return;
212
214
  }
213
215
 
@@ -258,16 +260,6 @@ export default function FlowPayment({
258
260
  !walletSelectionReady ||
259
261
  !preOrder.context_extras
260
262
  ) {
261
- console.log('====================================');
262
- console.log('FlowPayment: Missing required data to initialize payment components.', {
263
- wallet_method: preOrder.wallet_method,
264
- token: preOrder.token,
265
- public_key: walletPaymentData?.data?.public_key,
266
- walletSelectionReady,
267
- context_extras: preOrder.context_extras
268
- });
269
- console.log('====================================');
270
-
271
263
  return;
272
264
  }
273
265