strapi-plugin-payone-provider 1.6.1 → 1.6.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.
- package/admin/src/index.js +2 -0
- package/admin/src/pages/App/components/ApplePayBtn.jsx +15 -13
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +68 -17
- package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +4 -12
- package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +163 -86
- package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +21 -11
- package/admin/src/pages/App/index.jsx +15 -7
- package/admin/src/pages/hooks/usePaymentActions.js +0 -172
- package/admin/src/pages/utils/injectApplePayScript.js +34 -0
- package/admin/src/pages/utils/paymentUtils.js +2 -2
- package/package.json +2 -1
- package/server/bootstrap.js +0 -19
- package/server/services/transactionService.js +0 -28
- package/admin/src/components/Initializer/index.js +0 -16
- package/admin/src/components/PluginIcon/index.js +0 -6
- package/admin/src/pages/App/components/AppHeader.js +0 -55
- package/admin/src/pages/App/components/AppTabs.js +0 -158
- package/admin/src/pages/App/components/ApplePayButton.js +0 -950
- package/admin/src/pages/App/components/ApplePayButton.jsx +0 -908
- package/admin/src/pages/App/components/ApplePayConfig.js +0 -364
- package/admin/src/pages/App/components/ApplePayConfigPanel.js +0 -81
- package/admin/src/pages/App/components/ConfigurationPanel.js +0 -280
- package/admin/src/pages/App/components/DocsPanel.js +0 -1057
- package/admin/src/pages/App/components/GooglePayConfig.js +0 -217
- package/admin/src/pages/App/components/GooglePayConfigPanel.js +0 -82
- package/admin/src/pages/App/components/GooglePaybutton.js +0 -300
- package/admin/src/pages/App/components/HistoryPanel.js +0 -285
- package/admin/src/pages/App/components/PaymentActionsPanel.js +0 -190
- package/admin/src/pages/App/components/StatusBadge.js +0 -24
- package/admin/src/pages/App/components/TransactionHistoryItem.js +0 -377
- package/admin/src/pages/App/components/icons/BankIcon.js +0 -10
- package/admin/src/pages/App/components/icons/ChevronDownIcon.js +0 -9
- package/admin/src/pages/App/components/icons/ChevronUpIcon.js +0 -9
- package/admin/src/pages/App/components/icons/CreditCardIcon.js +0 -9
- package/admin/src/pages/App/components/icons/ErrorIcon.js +0 -10
- package/admin/src/pages/App/components/icons/InfoIcon.js +0 -9
- package/admin/src/pages/App/components/icons/PaymentIcon.js +0 -10
- package/admin/src/pages/App/components/icons/PendingIcon.js +0 -9
- package/admin/src/pages/App/components/icons/PersonIcon.js +0 -9
- package/admin/src/pages/App/components/icons/SuccessIcon.js +0 -9
- package/admin/src/pages/App/components/icons/WalletIcon.js +0 -9
- package/admin/src/pages/App/components/icons/index.js +0 -11
- package/admin/src/pages/App/components/paymentActions/AuthorizationForm.js +0 -195
- package/admin/src/pages/App/components/paymentActions/CaptureForm.js +0 -65
- package/admin/src/pages/App/components/paymentActions/CardDetailsInput.js +0 -191
- package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.js +0 -156
- package/admin/src/pages/App/components/paymentActions/PaymentResult.js +0 -148
- package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.js +0 -199
- package/admin/src/pages/App/components/paymentActions/RefundForm.js +0 -90
- package/admin/src/pages/App/index.js +0 -127
|
@@ -13,10 +13,6 @@ import { DEFAULT_PAYMENT_DATA } from "../constants/paymentConstants";
|
|
|
13
13
|
const usePaymentActions = () => {
|
|
14
14
|
const toggleNotification = useNotification();
|
|
15
15
|
|
|
16
|
-
<<<<<<< HEAD
|
|
17
|
-
// Load settings to get enable3DSecure value
|
|
18
|
-
=======
|
|
19
|
-
>>>>>>> feature/apple-pay
|
|
20
16
|
const [settings, setSettings] = useState({ enable3DSecure: false });
|
|
21
17
|
|
|
22
18
|
useEffect(() => {
|
|
@@ -27,28 +23,14 @@ const usePaymentActions = () => {
|
|
|
27
23
|
setSettings(response.data);
|
|
28
24
|
}
|
|
29
25
|
} catch (error) {
|
|
30
|
-
<<<<<<< HEAD
|
|
31
|
-
// Silent fail
|
|
32
|
-
=======
|
|
33
|
-
>>>>>>> feature/apple-pay
|
|
34
26
|
}
|
|
35
27
|
};
|
|
36
28
|
loadSettings();
|
|
37
29
|
}, []);
|
|
38
30
|
|
|
39
|
-
<<<<<<< HEAD
|
|
40
|
-
// Payment form state
|
|
41
31
|
const [paymentAmount, setPaymentAmount] = useState("1000");
|
|
42
32
|
|
|
43
|
-
// Generate order reference using generateLagOrderNumber
|
|
44
|
-
// Sequence number starts from 1000 and increments based on timestamp
|
|
45
33
|
const generateOrderReference = () => {
|
|
46
|
-
// Use timestamp to generate unique sequence (1000 to 99999 range)
|
|
47
|
-
=======
|
|
48
|
-
const [paymentAmount, setPaymentAmount] = useState("1000");
|
|
49
|
-
|
|
50
|
-
const generateOrderReference = () => {
|
|
51
|
-
>>>>>>> feature/apple-pay
|
|
52
34
|
const sequence = 1000 + Math.floor((Date.now() % 99000));
|
|
53
35
|
return generateLagOrderNumber(sequence);
|
|
54
36
|
};
|
|
@@ -64,19 +46,11 @@ const usePaymentActions = () => {
|
|
|
64
46
|
const [googlePayToken, setGooglePayToken] = useState(null);
|
|
65
47
|
const [applePayToken, setApplePayToken] = useState(null);
|
|
66
48
|
|
|
67
|
-
<<<<<<< HEAD
|
|
68
|
-
// Card details for 3DS testing
|
|
69
|
-
=======
|
|
70
|
-
>>>>>>> feature/apple-pay
|
|
71
49
|
const [cardtype, setCardtype] = useState("");
|
|
72
50
|
const [cardpan, setCardpan] = useState("");
|
|
73
51
|
const [cardexpiredate, setCardexpiredate] = useState("");
|
|
74
52
|
const [cardcvc2, setCardcvc2] = useState("");
|
|
75
53
|
|
|
76
|
-
<<<<<<< HEAD
|
|
77
|
-
// Payment processing state
|
|
78
|
-
=======
|
|
79
|
-
>>>>>>> feature/apple-pay
|
|
80
54
|
const [isProcessingPayment, setIsProcessingPayment] = useState(false);
|
|
81
55
|
const [paymentResult, setPaymentResult] = useState(null);
|
|
82
56
|
const [paymentError, setPaymentError] = useState(null);
|
|
@@ -106,29 +80,15 @@ const usePaymentActions = () => {
|
|
|
106
80
|
paymentMethod,
|
|
107
81
|
amount: paymentAmount
|
|
108
82
|
});
|
|
109
|
-
<<<<<<< HEAD
|
|
110
|
-
|
|
111
|
-
=======
|
|
112
|
-
|
|
113
|
-
>>>>>>> feature/apple-pay
|
|
114
83
|
setIsProcessingPayment(true);
|
|
115
84
|
setPaymentError(null);
|
|
116
85
|
setPaymentResult(null);
|
|
117
86
|
try {
|
|
118
|
-
<<<<<<< HEAD
|
|
119
|
-
// Auto-generate reference if empty
|
|
120
|
-
=======
|
|
121
|
-
>>>>>>> feature/apple-pay
|
|
122
87
|
const finalPreauthReference = preauthReference.trim() || generateOrderReference();
|
|
123
88
|
if (!preauthReference.trim()) {
|
|
124
89
|
setPreauthReference(finalPreauthReference);
|
|
125
90
|
}
|
|
126
91
|
|
|
127
|
-
<<<<<<< HEAD
|
|
128
|
-
// Determine currency based on card type
|
|
129
|
-
// American Express typically requires USD, other cards use EUR
|
|
130
|
-
=======
|
|
131
|
-
>>>>>>> feature/apple-pay
|
|
132
92
|
const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
|
|
133
93
|
|
|
134
94
|
const baseParams = {
|
|
@@ -139,10 +99,6 @@ const usePaymentActions = () => {
|
|
|
139
99
|
...DEFAULT_PAYMENT_DATA
|
|
140
100
|
};
|
|
141
101
|
|
|
142
|
-
<<<<<<< HEAD
|
|
143
|
-
// Add card details if credit card payment and 3DS enabled
|
|
144
|
-
=======
|
|
145
|
-
>>>>>>> feature/apple-pay
|
|
146
102
|
if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
|
|
147
103
|
if (cardtype) baseParams.cardtype = cardtype;
|
|
148
104
|
if (cardpan) baseParams.cardpan = cardpan;
|
|
@@ -156,10 +112,6 @@ const usePaymentActions = () => {
|
|
|
156
112
|
|
|
157
113
|
if (needsRedirectUrls) {
|
|
158
114
|
const baseUrl = window.location.origin;
|
|
159
|
-
<<<<<<< HEAD
|
|
160
|
-
// Detect current context (admin or content-ui) from pathname
|
|
161
|
-
=======
|
|
162
|
-
>>>>>>> feature/apple-pay
|
|
163
115
|
const currentPath = window.location.pathname;
|
|
164
116
|
const isContentUI = currentPath.includes('/content-ui') || currentPath.includes('/content-manager');
|
|
165
117
|
const basePath = isContentUI ? '/content-ui' : '/admin';
|
|
@@ -183,39 +135,13 @@ const usePaymentActions = () => {
|
|
|
183
135
|
|
|
184
136
|
const result = await payoneRequests.preauthorization(params);
|
|
185
137
|
const responseData = result?.data || result;
|
|
186
|
-
<<<<<<< HEAD
|
|
187
|
-
|
|
188
|
-
// Log full response
|
|
189
|
-
console.log("Preauthorization Response:", responseData);
|
|
190
|
-
console.log("Response Status:", responseData.status || responseData.Status);
|
|
191
|
-
console.log("Response Error Code:", responseData.errorcode || responseData.errorCode || responseData.ErrorCode);
|
|
192
|
-
console.log("Response Error Message:", responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage);
|
|
193
|
-
console.log("All redirect URL fields:", {
|
|
194
|
-
redirectUrl: responseData.redirectUrl,
|
|
195
|
-
redirecturl: responseData.redirecturl,
|
|
196
|
-
RedirectUrl: responseData.RedirectUrl,
|
|
197
|
-
redirect_url: responseData.redirect_url,
|
|
198
|
-
url: responseData.url,
|
|
199
|
-
Url: responseData.Url
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
=======
|
|
203
|
-
>>>>>>> feature/apple-pay
|
|
204
138
|
const status = (responseData.status || responseData.Status || "").toUpperCase();
|
|
205
139
|
const errorCode = responseData.errorcode || responseData.errorCode || responseData.ErrorCode;
|
|
206
140
|
const errorMessage = responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage;
|
|
207
141
|
|
|
208
|
-
<<<<<<< HEAD
|
|
209
|
-
// Check for 3DS required error (4219)
|
|
210
142
|
const requires3DSErrorCodes = ["4219", 4219];
|
|
211
143
|
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
212
144
|
|
|
213
|
-
// Check all possible redirect URL fields
|
|
214
|
-
=======
|
|
215
|
-
const requires3DSErrorCodes = ["4219", 4219];
|
|
216
|
-
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
217
|
-
|
|
218
|
-
>>>>>>> feature/apple-pay
|
|
219
145
|
const redirectUrl =
|
|
220
146
|
responseData.redirectUrl ||
|
|
221
147
|
responseData.redirecturl ||
|
|
@@ -225,10 +151,6 @@ const usePaymentActions = () => {
|
|
|
225
151
|
responseData.Url ||
|
|
226
152
|
null;
|
|
227
153
|
|
|
228
|
-
<<<<<<< HEAD
|
|
229
|
-
// If 3DS required but no redirect URL, show helpful message
|
|
230
|
-
=======
|
|
231
|
-
>>>>>>> feature/apple-pay
|
|
232
154
|
if (is3DSRequiredError && !redirectUrl) {
|
|
233
155
|
console.warn("3DS authentication required (Error 4219) but no redirect URL found in response");
|
|
234
156
|
console.log("Full response:", JSON.stringify(responseData, null, 2));
|
|
@@ -240,10 +162,6 @@ const usePaymentActions = () => {
|
|
|
240
162
|
return;
|
|
241
163
|
}
|
|
242
164
|
|
|
243
|
-
<<<<<<< HEAD
|
|
244
|
-
// Check for other errors (but not 3DS required)
|
|
245
|
-
=======
|
|
246
|
-
>>>>>>> feature/apple-pay
|
|
247
165
|
if ((status === "ERROR" || status === "INVALID" || errorCode) && !is3DSRequiredError) {
|
|
248
166
|
setPaymentError(
|
|
249
167
|
errorMessage ||
|
|
@@ -266,21 +184,8 @@ const usePaymentActions = () => {
|
|
|
266
184
|
|
|
267
185
|
setPaymentResult(responseData);
|
|
268
186
|
|
|
269
|
-
<<<<<<< HEAD
|
|
270
|
-
console.log("[Payment] Preauthorization result:", {
|
|
271
|
-
status,
|
|
272
|
-
hasError: !!errorCode,
|
|
273
|
-
errorCode,
|
|
274
|
-
errorMessage
|
|
275
|
-
});
|
|
276
|
-
|
|
277
187
|
if (status === "APPROVED") {
|
|
278
188
|
handlePaymentSuccess("Preauthorization completed successfully");
|
|
279
|
-
// Return success result for Apple Pay callback
|
|
280
|
-
=======
|
|
281
|
-
if (status === "APPROVED") {
|
|
282
|
-
handlePaymentSuccess("Preauthorization completed successfully");
|
|
283
|
-
>>>>>>> feature/apple-pay
|
|
284
189
|
return { success: true, data: responseData };
|
|
285
190
|
} else {
|
|
286
191
|
const errorMsg = errorMessage || `Unexpected status: ${status}`;
|
|
@@ -288,19 +193,11 @@ const usePaymentActions = () => {
|
|
|
288
193
|
{ message: errorMsg },
|
|
289
194
|
`Preauthorization completed with status: ${status}`
|
|
290
195
|
);
|
|
291
|
-
<<<<<<< HEAD
|
|
292
|
-
// Return error result for Apple Pay callback
|
|
293
|
-
=======
|
|
294
|
-
>>>>>>> feature/apple-pay
|
|
295
196
|
throw new Error(errorMsg);
|
|
296
197
|
}
|
|
297
198
|
} catch (error) {
|
|
298
199
|
console.error("[Payment] Preauthorization error:", error);
|
|
299
200
|
handlePaymentError(error, "Preauthorization failed");
|
|
300
|
-
<<<<<<< HEAD
|
|
301
|
-
// Re-throw error so Apple Pay callback knows it failed
|
|
302
|
-
=======
|
|
303
|
-
>>>>>>> feature/apple-pay
|
|
304
201
|
throw error;
|
|
305
202
|
} finally {
|
|
306
203
|
setIsProcessingPayment(false);
|
|
@@ -313,20 +210,11 @@ const usePaymentActions = () => {
|
|
|
313
210
|
setPaymentResult(null);
|
|
314
211
|
|
|
315
212
|
try {
|
|
316
|
-
<<<<<<< HEAD
|
|
317
|
-
// Auto-generate reference if empty
|
|
318
|
-
=======
|
|
319
|
-
>>>>>>> feature/apple-pay
|
|
320
213
|
const finalAuthReference = authReference.trim() || generateOrderReference();
|
|
321
214
|
if (!authReference.trim()) {
|
|
322
215
|
setAuthReference(finalAuthReference);
|
|
323
216
|
}
|
|
324
217
|
|
|
325
|
-
<<<<<<< HEAD
|
|
326
|
-
// Determine currency based on card type
|
|
327
|
-
// American Express typically requires USD, other cards use EUR
|
|
328
|
-
=======
|
|
329
|
-
>>>>>>> feature/apple-pay
|
|
330
218
|
const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
|
|
331
219
|
|
|
332
220
|
const baseParams = {
|
|
@@ -337,10 +225,6 @@ const usePaymentActions = () => {
|
|
|
337
225
|
...DEFAULT_PAYMENT_DATA
|
|
338
226
|
};
|
|
339
227
|
|
|
340
|
-
<<<<<<< HEAD
|
|
341
|
-
// Add card details if credit card payment and 3DS enabled
|
|
342
|
-
=======
|
|
343
|
-
>>>>>>> feature/apple-pay
|
|
344
228
|
if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
|
|
345
229
|
if (cardtype) baseParams.cardtype = cardtype;
|
|
346
230
|
if (cardpan) baseParams.cardpan = cardpan;
|
|
@@ -354,10 +238,6 @@ const usePaymentActions = () => {
|
|
|
354
238
|
|
|
355
239
|
if (needsRedirectUrls) {
|
|
356
240
|
const baseUrl = window.location.origin;
|
|
357
|
-
<<<<<<< HEAD
|
|
358
|
-
// Detect current context (admin or content-ui) from pathname
|
|
359
|
-
=======
|
|
360
|
-
>>>>>>> feature/apple-pay
|
|
361
241
|
const currentPath = window.location.pathname;
|
|
362
242
|
const isContentUI = currentPath.includes('/content-ui') || currentPath.includes('/content-manager');
|
|
363
243
|
const basePath = isContentUI ? '/content-ui' : '/admin';
|
|
@@ -381,39 +261,13 @@ const usePaymentActions = () => {
|
|
|
381
261
|
|
|
382
262
|
const result = await payoneRequests.authorization(params);
|
|
383
263
|
const responseData = result?.data || result;
|
|
384
|
-
<<<<<<< HEAD
|
|
385
|
-
|
|
386
|
-
// Log full response
|
|
387
|
-
console.log("Authorization Response:", responseData);
|
|
388
|
-
console.log("Response Status:", responseData.status || responseData.Status);
|
|
389
|
-
console.log("Response Error Code:", responseData.errorcode || responseData.errorCode || responseData.ErrorCode);
|
|
390
|
-
console.log("Response Error Message:", responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage);
|
|
391
|
-
console.log("All redirect URL fields:", {
|
|
392
|
-
redirectUrl: responseData.redirectUrl,
|
|
393
|
-
redirecturl: responseData.redirecturl,
|
|
394
|
-
RedirectUrl: responseData.RedirectUrl,
|
|
395
|
-
redirect_url: responseData.redirect_url,
|
|
396
|
-
url: responseData.url,
|
|
397
|
-
Url: responseData.Url
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
=======
|
|
401
|
-
>>>>>>> feature/apple-pay
|
|
402
264
|
const status = (responseData.status || responseData.Status || "").toUpperCase();
|
|
403
265
|
const errorCode = responseData.errorcode || responseData.errorCode || responseData.ErrorCode;
|
|
404
266
|
const errorMessage = responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage;
|
|
405
267
|
|
|
406
|
-
<<<<<<< HEAD
|
|
407
|
-
// Check for 3DS required error (4219)
|
|
408
268
|
const requires3DSErrorCodes = ["4219", 4219];
|
|
409
269
|
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
410
270
|
|
|
411
|
-
// Check all possible redirect URL fields
|
|
412
|
-
=======
|
|
413
|
-
const requires3DSErrorCodes = ["4219", 4219];
|
|
414
|
-
const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
|
|
415
|
-
|
|
416
|
-
>>>>>>> feature/apple-pay
|
|
417
271
|
const redirectUrl =
|
|
418
272
|
responseData.redirectUrl ||
|
|
419
273
|
responseData.redirecturl ||
|
|
@@ -423,10 +277,6 @@ const usePaymentActions = () => {
|
|
|
423
277
|
responseData.Url ||
|
|
424
278
|
null;
|
|
425
279
|
|
|
426
|
-
<<<<<<< HEAD
|
|
427
|
-
// If 3DS required but no redirect URL, show helpful message
|
|
428
|
-
=======
|
|
429
|
-
>>>>>>> feature/apple-pay
|
|
430
280
|
if (is3DSRequiredError && !redirectUrl) {
|
|
431
281
|
console.warn("3DS authentication required (Error 4219) but no redirect URL found in response");
|
|
432
282
|
console.log("Full response:", JSON.stringify(responseData, null, 2));
|
|
@@ -438,10 +288,6 @@ const usePaymentActions = () => {
|
|
|
438
288
|
return;
|
|
439
289
|
}
|
|
440
290
|
|
|
441
|
-
<<<<<<< HEAD
|
|
442
|
-
// Check for other errors (but not 3DS required)
|
|
443
|
-
=======
|
|
444
|
-
>>>>>>> feature/apple-pay
|
|
445
291
|
if ((status === "ERROR" || status === "INVALID" || errorCode) && !is3DSRequiredError) {
|
|
446
292
|
setPaymentError(
|
|
447
293
|
errorMessage ||
|
|
@@ -464,16 +310,6 @@ const usePaymentActions = () => {
|
|
|
464
310
|
|
|
465
311
|
setPaymentResult(responseData);
|
|
466
312
|
|
|
467
|
-
<<<<<<< HEAD
|
|
468
|
-
console.log("[Payment] Authorization result:", {
|
|
469
|
-
status,
|
|
470
|
-
hasError: !!errorCode,
|
|
471
|
-
errorCode,
|
|
472
|
-
errorMessage
|
|
473
|
-
});
|
|
474
|
-
|
|
475
|
-
=======
|
|
476
|
-
>>>>>>> feature/apple-pay
|
|
477
313
|
if (status === "APPROVED") {
|
|
478
314
|
handlePaymentSuccess("Authorization completed successfully");
|
|
479
315
|
// Return success result for Apple Pay callback
|
|
@@ -484,19 +320,11 @@ const usePaymentActions = () => {
|
|
|
484
320
|
{ message: errorMsg },
|
|
485
321
|
`Authorization completed with status: ${status}`
|
|
486
322
|
);
|
|
487
|
-
<<<<<<< HEAD
|
|
488
|
-
// Return error result for Apple Pay callback
|
|
489
|
-
=======
|
|
490
|
-
>>>>>>> feature/apple-pay
|
|
491
323
|
throw new Error(errorMsg);
|
|
492
324
|
}
|
|
493
325
|
} catch (error) {
|
|
494
326
|
console.error("[Payment] Authorization error:", error);
|
|
495
327
|
handlePaymentError(error, "Authorization failed");
|
|
496
|
-
<<<<<<< HEAD
|
|
497
|
-
// Re-throw error so Apple Pay callback knows it failed
|
|
498
|
-
=======
|
|
499
|
-
>>>>>>> feature/apple-pay
|
|
500
328
|
throw error;
|
|
501
329
|
} finally {
|
|
502
330
|
setIsProcessingPayment(false);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const injectApplePayScript = () => {
|
|
2
|
+
|
|
3
|
+
if (typeof window === 'undefined') {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const checkApplePay = () => {
|
|
8
|
+
try {
|
|
9
|
+
return typeof window.ApplePaySession !== 'undefined' &&
|
|
10
|
+
typeof window.ApplePaySession.canMakePayments === 'function';
|
|
11
|
+
} catch (e) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
if (checkApplePay()) {
|
|
17
|
+
window.dispatchEvent(new CustomEvent("applePayAvailable"));
|
|
18
|
+
} else {
|
|
19
|
+
const checkInterval = setInterval(() => {
|
|
20
|
+
if (checkApplePay()) {
|
|
21
|
+
clearInterval(checkInterval);
|
|
22
|
+
window.dispatchEvent(new CustomEvent("applePayAvailable"));
|
|
23
|
+
}
|
|
24
|
+
}, 200);
|
|
25
|
+
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
clearInterval(checkInterval);
|
|
28
|
+
if (!checkApplePay()) {
|
|
29
|
+
window.dispatchEvent(new CustomEvent("applePayNotAvailable"));
|
|
30
|
+
}
|
|
31
|
+
}, 5000);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
@@ -368,8 +368,8 @@ export const getPaymentMethodDisplayName = (paymentMethod) => {
|
|
|
368
368
|
};
|
|
369
369
|
|
|
370
370
|
|
|
371
|
-
export const getPaymentMethodOptions = () => {
|
|
372
|
-
return [
|
|
371
|
+
export const getPaymentMethodOptions = (isLiveMode = false) => {
|
|
372
|
+
return isLiveMode ? [{ value: "apl", label: "Apple Pay" }] : [
|
|
373
373
|
{ value: "cc", label: "Credit Card (Visa, Mastercard)" },
|
|
374
374
|
{ value: "wlt", label: "PayPal" },
|
|
375
375
|
{ value: "gpp", label: "Google Pay" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-payone-provider",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Strapi plugin for Payone payment gateway integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"maintainers": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"apple-pay-button": "^1.2.1",
|
|
13
14
|
"axios": "^1.6.3",
|
|
14
15
|
"prop-types": "^15.7.2"
|
|
15
16
|
},
|
package/server/bootstrap.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
module.exports = async ({ strapi }) => {
|
|
4
|
-
// Initialize plugin settings store
|
|
5
4
|
const pluginStore = strapi.store({
|
|
6
5
|
environment: "",
|
|
7
6
|
type: "plugin",
|
|
8
7
|
name: "strapi-plugin-payone-provider"
|
|
9
8
|
});
|
|
10
9
|
|
|
11
|
-
// Initialize default settings if not already set
|
|
12
10
|
const settings = await pluginStore.get({ key: "settings" });
|
|
13
11
|
if (!settings) {
|
|
14
12
|
await pluginStore.set({
|
|
@@ -28,18 +26,12 @@ module.exports = async ({ strapi }) => {
|
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
// Register custom routes for 3DS redirects at root level
|
|
32
|
-
// These routes handle redirects from Payone after 3DS authentication
|
|
33
|
-
// They work with both /admin/ and /content-ui/ paths
|
|
34
29
|
const pluginName = "strapi-plugin-payone-provider";
|
|
35
30
|
|
|
36
|
-
// Get the controller
|
|
37
31
|
const getController = () => {
|
|
38
32
|
return strapi.plugin(pluginName).controller("payone");
|
|
39
33
|
};
|
|
40
34
|
|
|
41
|
-
// All routes use the same handler - it detects success/error/back from URL path
|
|
42
|
-
// Routes match the plugin's internal payment callback URLs
|
|
43
35
|
const routes = [
|
|
44
36
|
"/admin/plugins/strapi-plugin-payone-provider/payment/success",
|
|
45
37
|
"/admin/plugins/strapi-plugin-payone-provider/payment/error",
|
|
@@ -49,15 +41,11 @@ module.exports = async ({ strapi }) => {
|
|
|
49
41
|
"/content-ui/plugins/strapi-plugin-payone-provider/payment/back"
|
|
50
42
|
];
|
|
51
43
|
|
|
52
|
-
// Register routes using Koa router
|
|
53
44
|
try {
|
|
54
45
|
const Router = require('@koa/router');
|
|
55
46
|
const router = new Router();
|
|
56
|
-
<<<<<<< HEAD
|
|
57
|
-
=======
|
|
58
47
|
const fs = require('fs');
|
|
59
48
|
const path = require('path');
|
|
60
|
-
>>>>>>> feature/apple-pay
|
|
61
49
|
|
|
62
50
|
routes.forEach(route => {
|
|
63
51
|
router.get(route, async (ctx) => {
|
|
@@ -66,10 +54,6 @@ module.exports = async ({ strapi }) => {
|
|
|
66
54
|
});
|
|
67
55
|
});
|
|
68
56
|
|
|
69
|
-
<<<<<<< HEAD
|
|
70
|
-
// Add router to the server app
|
|
71
|
-
=======
|
|
72
|
-
// Register route for Apple Pay .well-known file
|
|
73
57
|
router.get('/.well-known/apple-developer-merchantid-domain-association', async (ctx) => {
|
|
74
58
|
try {
|
|
75
59
|
const publicPath = path.join(process.cwd(), 'public');
|
|
@@ -80,12 +64,10 @@ module.exports = async ({ strapi }) => {
|
|
|
80
64
|
let fileContent = null;
|
|
81
65
|
let filePathFound = null;
|
|
82
66
|
|
|
83
|
-
// Try main file first
|
|
84
67
|
if (fs.existsSync(filePath)) {
|
|
85
68
|
filePathFound = filePath;
|
|
86
69
|
fileContent = fs.readFileSync(filePath, 'utf8');
|
|
87
70
|
}
|
|
88
|
-
// Try alternative file name
|
|
89
71
|
else if (fs.existsSync(filePathTxt)) {
|
|
90
72
|
filePathFound = filePathTxt;
|
|
91
73
|
fileContent = fs.readFileSync(filePathTxt, 'utf8');
|
|
@@ -126,7 +108,6 @@ module.exports = async ({ strapi }) => {
|
|
|
126
108
|
}
|
|
127
109
|
});
|
|
128
110
|
|
|
129
|
-
>>>>>>> feature/apple-pay
|
|
130
111
|
if (strapi.server.app && typeof strapi.server.app.use === 'function') {
|
|
131
112
|
strapi.server.app.use(router.routes());
|
|
132
113
|
strapi.server.app.use(router.allowedMethods());
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
<<<<<<< HEAD
|
|
4
|
-
const { getPluginStore, PLUGIN_NAME } = require("./settingsService");
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Log transaction to history
|
|
8
|
-
* @param {Object} strapi - Strapi instance
|
|
9
|
-
* @param {Object} transactionData - Transaction data
|
|
10
|
-
* @returns {Promise<void>}
|
|
11
|
-
*/
|
|
12
|
-
=======
|
|
13
3
|
const { getPluginStore } = require("./settingsService");
|
|
14
4
|
|
|
15
|
-
>>>>>>> feature/apple-pay
|
|
16
5
|
const logTransaction = async (strapi, transactionData) => {
|
|
17
6
|
const pluginStore = getPluginStore(strapi);
|
|
18
7
|
let transactionHistory =
|
|
@@ -46,10 +35,6 @@ const logTransaction = async (strapi, transactionData) => {
|
|
|
46
35
|
|
|
47
36
|
transactionHistory.unshift(logEntry);
|
|
48
37
|
|
|
49
|
-
<<<<<<< HEAD
|
|
50
|
-
// Keep only last 1000 transactions
|
|
51
|
-
=======
|
|
52
|
-
>>>>>>> feature/apple-pay
|
|
53
38
|
if (transactionHistory.length > 1000) {
|
|
54
39
|
transactionHistory = transactionHistory.slice(0, 1000);
|
|
55
40
|
}
|
|
@@ -62,24 +47,11 @@ const logTransaction = async (strapi, transactionData) => {
|
|
|
62
47
|
strapi.log.info("Transaction logged:", logEntry);
|
|
63
48
|
};
|
|
64
49
|
|
|
65
|
-
<<<<<<< HEAD
|
|
66
|
-
/**
|
|
67
|
-
* Get transaction history with filters
|
|
68
|
-
* @param {Object} strapi - Strapi instance
|
|
69
|
-
* @param {Object} filters - Filter options
|
|
70
|
-
* @returns {Promise<Array>} Filtered transaction history
|
|
71
|
-
*/
|
|
72
|
-
=======
|
|
73
|
-
>>>>>>> feature/apple-pay
|
|
74
50
|
const getTransactionHistory = async (strapi, filters = {}) => {
|
|
75
51
|
const pluginStore = getPluginStore(strapi);
|
|
76
52
|
let transactionHistory =
|
|
77
53
|
(await pluginStore.get({ key: "transactionHistory" })) || [];
|
|
78
54
|
|
|
79
|
-
<<<<<<< HEAD
|
|
80
|
-
// Apply filters
|
|
81
|
-
=======
|
|
82
|
-
>>>>>>> feature/apple-pay
|
|
83
55
|
if (filters.status) {
|
|
84
56
|
transactionHistory = transactionHistory.filter(
|
|
85
57
|
(transaction) => transaction.status === filters.status
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
import pluginId from "../../pluginId";
|
|
3
|
-
|
|
4
|
-
const Initializer = ({ setPlugin }) => {
|
|
5
|
-
const ref = useRef(setPlugin);
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (ref.current) {
|
|
9
|
-
ref.current(pluginId);
|
|
10
|
-
}
|
|
11
|
-
}, []);
|
|
12
|
-
|
|
13
|
-
return null;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default Initializer;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { HeaderLayout, Box, Typography, Button } from "@strapi/design-system";
|
|
3
|
-
import { Check, ArrowLeft } from "@strapi/icons";
|
|
4
|
-
import { useHistory, useLocation } from "react-router-dom";
|
|
5
|
-
import pluginId from "../../../pluginId";
|
|
6
|
-
|
|
7
|
-
const AppHeader = ({ activeTab, isSaving, onSave }) => {
|
|
8
|
-
const history = useHistory();
|
|
9
|
-
const location = useLocation();
|
|
10
|
-
const isApplePayConfigPage = location.pathname.includes('/apple-pay-config');
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<HeaderLayout
|
|
14
|
-
title={
|
|
15
|
-
<Box>
|
|
16
|
-
<Typography variant="alpha" as="h1" fontWeight="bold" className="payment-title">
|
|
17
|
-
{isApplePayConfigPage ? "Apple Pay Configuration" : "Payone Provider"}
|
|
18
|
-
</Typography>
|
|
19
|
-
<Typography variant="pi" marginTop={2} className="payment-subtitle">
|
|
20
|
-
{isApplePayConfigPage
|
|
21
|
-
? "Configure Apple Pay settings for your payment gateway"
|
|
22
|
-
: "Configure your Payone integration and manage payment transactions"
|
|
23
|
-
}
|
|
24
|
-
</Typography>
|
|
25
|
-
</Box>
|
|
26
|
-
}
|
|
27
|
-
primaryAction={
|
|
28
|
-
isApplePayConfigPage ? (
|
|
29
|
-
<Button
|
|
30
|
-
onClick={() => history.push(`/plugins/${pluginId}`)}
|
|
31
|
-
startIcon={<ArrowLeft />}
|
|
32
|
-
size="L"
|
|
33
|
-
variant="secondary"
|
|
34
|
-
>
|
|
35
|
-
Back to Main
|
|
36
|
-
</Button>
|
|
37
|
-
) : activeTab === 0 ? (
|
|
38
|
-
<Button
|
|
39
|
-
loading={isSaving}
|
|
40
|
-
onClick={onSave}
|
|
41
|
-
startIcon={<Check />}
|
|
42
|
-
size="L"
|
|
43
|
-
variant="default"
|
|
44
|
-
className="payment-button payment-button-success"
|
|
45
|
-
>
|
|
46
|
-
Save Configuration
|
|
47
|
-
</Button>
|
|
48
|
-
) : null
|
|
49
|
-
}
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default AppHeader;
|
|
55
|
-
|