@akinon/pz-flow-payment 1.108.0-rc.3 → 1.108.0-rc.5
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 +12 -0
- package/package.json +1 -1
- package/src/views/index.tsx +16 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @akinon/pz-flow-payment
|
|
2
2
|
|
|
3
|
+
## 1.108.0-rc.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 31a2d35: ZERO-3640: Refactor checkout API call to include useFormData option; update FlowPayment component for improved error handling and code readability
|
|
8
|
+
|
|
9
|
+
## 1.108.0-rc.4
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- d8883ce: ZERO-3640: Refactor wallet completion handling to accept additional parameters; update related API calls
|
|
14
|
+
|
|
3
15
|
## 1.108.0-rc.3
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/package.json
CHANGED
package/src/views/index.tsx
CHANGED
|
@@ -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] =
|
|
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(
|
|
102
|
+
setErrors(
|
|
103
|
+
'Payment method not available. Please try a different payment option.'
|
|
104
|
+
);
|
|
102
105
|
setWalletSelectionReady(false);
|
|
103
106
|
return;
|
|
104
107
|
}
|
|
@@ -124,8 +127,14 @@ export default function FlowPayment({
|
|
|
124
127
|
setErrors(null);
|
|
125
128
|
|
|
126
129
|
try {
|
|
130
|
+
const ckoPaymentId = paymentData?.id;
|
|
131
|
+
const isSuccess = paymentData?.status === 'Approved';
|
|
132
|
+
|
|
127
133
|
const paymentCompleteResponse = await dispatch(
|
|
128
|
-
checkoutApi.endpoints.setWalletCompletePage.initiate(
|
|
134
|
+
checkoutApi.endpoints.setWalletCompletePage.initiate({
|
|
135
|
+
success: isSuccess,
|
|
136
|
+
cko_payment_id: ckoPaymentId
|
|
137
|
+
})
|
|
129
138
|
).unwrap();
|
|
130
139
|
|
|
131
140
|
if (paymentCompleteResponse.errors) {
|
|
@@ -144,10 +153,7 @@ export default function FlowPayment({
|
|
|
144
153
|
|
|
145
154
|
const redirectUrlWithLocale = `${
|
|
146
155
|
window.location.origin
|
|
147
|
-
}${getUrlPathWithLocale(
|
|
148
|
-
redirectUrl,
|
|
149
|
-
getCookie('pz-locale') || 'en'
|
|
150
|
-
)}`;
|
|
156
|
+
}${getUrlPathWithLocale(redirectUrl, getCookie('pz-locale') || 'en')}`;
|
|
151
157
|
|
|
152
158
|
window.location.href = redirectUrlWithLocale;
|
|
153
159
|
}
|
|
@@ -201,7 +207,9 @@ export default function FlowPayment({
|
|
|
201
207
|
|
|
202
208
|
// If we don't have payment session data, we need to wait for it
|
|
203
209
|
if (!paymentSession) {
|
|
204
|
-
console.warn(
|
|
210
|
+
console.warn(
|
|
211
|
+
'FlowPayment: Payment session not available yet, component will retry when data is ready'
|
|
212
|
+
);
|
|
205
213
|
return;
|
|
206
214
|
}
|
|
207
215
|
|
|
@@ -252,16 +260,6 @@ export default function FlowPayment({
|
|
|
252
260
|
!walletSelectionReady ||
|
|
253
261
|
!preOrder.context_extras
|
|
254
262
|
) {
|
|
255
|
-
console.log('====================================');
|
|
256
|
-
console.log('FlowPayment: Missing required data to initialize payment components.', {
|
|
257
|
-
wallet_method: preOrder.wallet_method,
|
|
258
|
-
token: preOrder.token,
|
|
259
|
-
public_key: walletPaymentData?.data?.public_key,
|
|
260
|
-
walletSelectionReady,
|
|
261
|
-
context_extras: preOrder.context_extras
|
|
262
|
-
});
|
|
263
|
-
console.log('====================================');
|
|
264
|
-
|
|
265
263
|
return;
|
|
266
264
|
}
|
|
267
265
|
|