strapi-plugin-payone-provider 1.5.8 → 1.6.0
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 +3 -3
- package/admin/src/pages/App/components/ApplePayBtn.jsx +304 -0
- package/admin/src/pages/App/components/{ApplePayButton.js → ApplePayButton.jsx} +141 -137
- package/admin/src/pages/App/components/{ApplePayConfig.js → ApplePayConfig.jsx} +64 -130
- package/admin/src/pages/App/components/{PaymentActionsPanel.js → PaymentActionsPanel.jsx} +62 -14
- package/admin/src/pages/App/components/icons/index.jsx +11 -0
- package/admin/src/pages/App/components/paymentActions/{AuthorizationForm.js → AuthorizationForm.jsx} +45 -35
- package/admin/src/pages/App/components/paymentActions/{PaymentMethodSelector.js → PaymentMethodSelector.jsx} +111 -31
- package/admin/src/pages/App/components/paymentActions/{PreauthorizationForm.js → PreauthorizationForm.jsx} +3 -70
- package/admin/src/pages/constants/paymentConstants.js +1 -2
- package/admin/src/pages/hooks/usePaymentActions.js +1 -76
- package/package.json +49 -49
- package/server/bootstrap.js +59 -1
- package/server/controllers/payone.js +6 -48
- package/server/routes/index.js +1 -1
- package/server/services/applePayService.js +51 -407
- package/server/services/paymentService.js +0 -68
- package/server/services/payone.js +0 -3
- package/server/services/settingsService.js +0 -21
- package/server/services/testConnectionService.js +0 -14
- package/server/services/transactionService.js +2 -16
- package/server/utils/paymentMethodParams.js +60 -21
- package/server/utils/requestBuilder.js +0 -22
- package/admin/src/pages/App/components/icons/index.js +0 -11
- /package/admin/src/components/Initializer/{index.js → index.jsx} +0 -0
- /package/admin/src/components/PluginIcon/{index.js → index.jsx} +0 -0
- /package/admin/src/pages/App/components/{AppHeader.js → AppHeader.jsx} +0 -0
- /package/admin/src/pages/App/components/{AppTabs.js → AppTabs.jsx} +0 -0
- /package/admin/src/pages/App/components/{ApplePayConfigPanel.js → ApplePayConfigPanel.jsx} +0 -0
- /package/admin/src/pages/App/components/{ConfigurationPanel.js → ConfigurationPanel.jsx} +0 -0
- /package/admin/src/pages/App/components/{DocsPanel.js → DocsPanel.jsx} +0 -0
- /package/admin/src/pages/App/components/{GooglePayConfig.js → GooglePayConfig.jsx} +0 -0
- /package/admin/src/pages/App/components/{GooglePayConfigPanel.js → GooglePayConfigPanel.jsx} +0 -0
- /package/admin/src/pages/App/components/{GooglePaybutton.js → GooglePaybutton.jsx} +0 -0
- /package/admin/src/pages/App/components/{HistoryPanel.js → HistoryPanel.jsx} +0 -0
- /package/admin/src/pages/App/components/{StatusBadge.js → StatusBadge.jsx} +0 -0
- /package/admin/src/pages/App/components/{TransactionHistoryItem.js → TransactionHistoryItem.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{BankIcon.js → BankIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{ChevronDownIcon.js → ChevronDownIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{ChevronUpIcon.js → ChevronUpIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{CreditCardIcon.js → CreditCardIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{ErrorIcon.js → ErrorIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{InfoIcon.js → InfoIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{PaymentIcon.js → PaymentIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{PendingIcon.js → PendingIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{PersonIcon.js → PersonIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{SuccessIcon.js → SuccessIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/icons/{WalletIcon.js → WalletIcon.jsx} +0 -0
- /package/admin/src/pages/App/components/paymentActions/{CaptureForm.js → CaptureForm.jsx} +0 -0
- /package/admin/src/pages/App/components/paymentActions/{CardDetailsInput.js → CardDetailsInput.jsx} +0 -0
- /package/admin/src/pages/App/components/paymentActions/{PaymentResult.js → PaymentResult.jsx} +0 -0
- /package/admin/src/pages/App/components/paymentActions/{RefundForm.js → RefundForm.jsx} +0 -0
- /package/admin/src/pages/App/{index.js → index.jsx} +0 -0
|
@@ -2,7 +2,6 @@ import React from "react";
|
|
|
2
2
|
import { Box, Flex, Typography, Select, Option, Checkbox, Stack } from "@strapi/design-system";
|
|
3
3
|
import {
|
|
4
4
|
APPLE_PAY_SUPPORTED_COUNTRIES,
|
|
5
|
-
APPLE_PAY_SUPPORTED_CURRENCIES,
|
|
6
5
|
APPLE_PAY_SUPPORTED_NETWORKS,
|
|
7
6
|
APPLE_PAY_MERCHANT_CAPABILITIES,
|
|
8
7
|
getSupportedCurrenciesForCountry,
|
|
@@ -24,15 +23,8 @@ const ApplePayConfig = ({
|
|
|
24
23
|
supportedNetworks = DEFAULT_APPLE_PAY_CONFIG.supportedNetworks,
|
|
25
24
|
buttonStyle = DEFAULT_APPLE_PAY_CONFIG.buttonStyle,
|
|
26
25
|
buttonType = DEFAULT_APPLE_PAY_CONFIG.buttonType,
|
|
27
|
-
requestPayerName = DEFAULT_APPLE_PAY_CONFIG.requestPayerName,
|
|
28
|
-
requestBillingAddress = DEFAULT_APPLE_PAY_CONFIG.requestBillingAddress,
|
|
29
|
-
requestPayerEmail = DEFAULT_APPLE_PAY_CONFIG.requestPayerEmail,
|
|
30
|
-
requestPayerPhone = DEFAULT_APPLE_PAY_CONFIG.requestPayerPhone,
|
|
31
|
-
requestShipping = DEFAULT_APPLE_PAY_CONFIG.requestShipping,
|
|
32
|
-
shippingType = DEFAULT_APPLE_PAY_CONFIG.shippingType
|
|
33
26
|
} = config || {};
|
|
34
27
|
|
|
35
|
-
// Get supported currencies and networks based on selected country
|
|
36
28
|
const supportedCurrencies = getSupportedCurrenciesForCountry(countryCode);
|
|
37
29
|
const supportedNetworksForCountry = getSupportedNetworksForCountry(countryCode);
|
|
38
30
|
|
|
@@ -41,16 +33,14 @@ const ApplePayConfig = ({
|
|
|
41
33
|
...config,
|
|
42
34
|
countryCode: value
|
|
43
35
|
};
|
|
44
|
-
|
|
45
|
-
// Auto-update currency if current currency is not supported in new country
|
|
36
|
+
|
|
46
37
|
const newSupportedCurrencies = getSupportedCurrenciesForCountry(value);
|
|
47
38
|
if (!newSupportedCurrencies.find(c => c.code === currencyCode)) {
|
|
48
39
|
newConfig.currencyCode = newSupportedCurrencies[0]?.code || "USD";
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
// Auto-update networks based on country
|
|
41
|
+
|
|
52
42
|
newConfig.supportedNetworks = getSupportedNetworksForCountry(value);
|
|
53
|
-
|
|
43
|
+
|
|
54
44
|
onConfigChange(newConfig);
|
|
55
45
|
};
|
|
56
46
|
|
|
@@ -66,7 +56,7 @@ const ApplePayConfig = ({
|
|
|
66
56
|
const newNetworks = currentNetworks.includes(networkCode)
|
|
67
57
|
? currentNetworks.filter(n => n !== networkCode)
|
|
68
58
|
: [...currentNetworks, networkCode];
|
|
69
|
-
|
|
59
|
+
|
|
70
60
|
onConfigChange({
|
|
71
61
|
...config,
|
|
72
62
|
supportedNetworks: newNetworks
|
|
@@ -78,7 +68,7 @@ const ApplePayConfig = ({
|
|
|
78
68
|
const newCapabilities = currentCapabilities.includes(capabilityCode)
|
|
79
69
|
? currentCapabilities.filter(c => c !== capabilityCode)
|
|
80
70
|
: [...currentCapabilities, capabilityCode];
|
|
81
|
-
|
|
71
|
+
|
|
82
72
|
onConfigChange({
|
|
83
73
|
...config,
|
|
84
74
|
merchantCapabilities: newCapabilities
|
|
@@ -100,43 +90,43 @@ const ApplePayConfig = ({
|
|
|
100
90
|
{/* Country and Currency */}
|
|
101
91
|
<Flex gap={4} wrap="wrap">
|
|
102
92
|
<Box style={{ flex: 1, minWidth: "300px" }}>
|
|
103
|
-
|
|
93
|
+
<Select
|
|
104
94
|
label="Country Code"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
name="countryCode"
|
|
96
|
+
value={countryCode}
|
|
97
|
+
onChange={handleCountryChange}
|
|
98
|
+
hint="Select the country where your business operates"
|
|
99
|
+
required
|
|
100
|
+
>
|
|
101
|
+
{APPLE_PAY_SUPPORTED_COUNTRIES.map(country => (
|
|
102
|
+
<Option key={country.code} value={country.code}>
|
|
103
|
+
{country.name} ({country.code})
|
|
104
|
+
</Option>
|
|
105
|
+
))}
|
|
106
|
+
</Select>
|
|
107
|
+
</Box>
|
|
118
108
|
|
|
119
109
|
<Box style={{ flex: 1, minWidth: "300px" }}>
|
|
120
|
-
|
|
110
|
+
<Select
|
|
121
111
|
label="Currency Code"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
name="currencyCode"
|
|
113
|
+
value={currencyCode}
|
|
114
|
+
onChange={handleCurrencyChange}
|
|
125
115
|
hint={`Supported currencies for ${countryCode}`}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
116
|
+
required
|
|
117
|
+
>
|
|
118
|
+
{supportedCurrencies.map(currency => (
|
|
119
|
+
<Option key={currency.code} value={currency.code}>
|
|
120
|
+
{currency.name} ({currency.code}) {currency.symbol}
|
|
121
|
+
</Option>
|
|
122
|
+
))}
|
|
123
|
+
</Select>
|
|
124
|
+
{supportedCurrencies.length === 0 && (
|
|
125
|
+
<Typography variant="pi" textColor="danger600" style={{ marginTop: "4px" }}>
|
|
126
|
+
No supported currencies for this country. Please select a different country.
|
|
127
|
+
</Typography>
|
|
128
|
+
)}
|
|
129
|
+
</Box>
|
|
140
130
|
</Flex>
|
|
141
131
|
|
|
142
132
|
{/* Button Style and Type */}
|
|
@@ -186,23 +176,23 @@ const ApplePayConfig = ({
|
|
|
186
176
|
{APPLE_PAY_SUPPORTED_NETWORKS.map(network => {
|
|
187
177
|
const isSupported = supportedNetworksForCountry.includes(network.code);
|
|
188
178
|
const isSelected = supportedNetworks?.includes(network.code);
|
|
189
|
-
|
|
179
|
+
|
|
190
180
|
return (
|
|
191
181
|
<Box key={network.code} style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
182
|
+
<Checkbox
|
|
183
|
+
name={`network-${network.code}`}
|
|
184
|
+
checked={isSelected}
|
|
185
|
+
onChange={() => handleNetworkToggle(network.code)}
|
|
186
|
+
disabled={!isSupported}
|
|
187
|
+
hint={!isSupported ? `Not supported in ${countryCode}` : undefined}
|
|
188
|
+
>
|
|
189
|
+
{network.name} ({network.code})
|
|
190
|
+
{!isSupported && (
|
|
191
|
+
<Typography variant="sigma" textColor="neutral500" style={{ marginLeft: "8px" }}>
|
|
202
192
|
(Not available)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
</Typography>
|
|
194
|
+
)}
|
|
195
|
+
</Checkbox>
|
|
206
196
|
</Box>
|
|
207
197
|
);
|
|
208
198
|
})}
|
|
@@ -225,16 +215,16 @@ const ApplePayConfig = ({
|
|
|
225
215
|
<Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
|
|
226
216
|
{APPLE_PAY_MERCHANT_CAPABILITIES.map(capability => {
|
|
227
217
|
const isSelected = merchantCapabilities?.includes(capability.code);
|
|
228
|
-
|
|
218
|
+
|
|
229
219
|
return (
|
|
230
220
|
<Box key={capability.code} style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}>
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
221
|
+
<Checkbox
|
|
222
|
+
name={`capability-${capability.code}`}
|
|
223
|
+
checked={isSelected}
|
|
224
|
+
onChange={() => handleCapabilityToggle(capability.code)}
|
|
225
|
+
>
|
|
226
|
+
{capability.name} - {capability.description}
|
|
227
|
+
</Checkbox>
|
|
238
228
|
</Box>
|
|
239
229
|
);
|
|
240
230
|
})}
|
|
@@ -246,62 +236,6 @@ const ApplePayConfig = ({
|
|
|
246
236
|
)}
|
|
247
237
|
</Box>
|
|
248
238
|
|
|
249
|
-
{/* Payment Options */}
|
|
250
|
-
{/* <Box>
|
|
251
|
-
<Typography variant="pi" fontWeight="semiBold" style={{ marginLeft: "2px", marginBottom: "6px" }}>
|
|
252
|
-
Payment Options
|
|
253
|
-
</Typography>
|
|
254
|
-
<Typography variant="pi" textColor="neutral600" style={{ marginLeft: "2px" }}>
|
|
255
|
-
Select the information you want to collect during payment
|
|
256
|
-
</Typography>
|
|
257
|
-
<Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
|
|
258
|
-
<Box style={{ flex: "0 0 calc(33.333% - 11px)", minWidth: "200px" }}>
|
|
259
|
-
<Checkbox
|
|
260
|
-
name="requestPayerName"
|
|
261
|
-
checked={requestPayerName}
|
|
262
|
-
onChange={(checked) => onConfigChange({ ...config, requestPayerName: checked })}
|
|
263
|
-
>
|
|
264
|
-
Request Payer Name
|
|
265
|
-
</Checkbox>
|
|
266
|
-
</Box>
|
|
267
|
-
<Box style={{ flex: "0 0 calc(33.333% - 11px)", minWidth: "200px" }}>
|
|
268
|
-
<Checkbox
|
|
269
|
-
name="requestBillingAddress"
|
|
270
|
-
checked={requestBillingAddress}
|
|
271
|
-
onChange={(checked) => onConfigChange({ ...config, requestBillingAddress: checked })}
|
|
272
|
-
>
|
|
273
|
-
Request Billing Address
|
|
274
|
-
</Checkbox>
|
|
275
|
-
</Box>
|
|
276
|
-
<Box style={{ flex: "0 0 calc(33.333% - 11px)", minWidth: "200px" }}>
|
|
277
|
-
<Checkbox
|
|
278
|
-
name="requestPayerEmail"
|
|
279
|
-
checked={requestPayerEmail}
|
|
280
|
-
onChange={(checked) => onConfigChange({ ...config, requestPayerEmail: checked })}
|
|
281
|
-
>
|
|
282
|
-
Request Payer Email
|
|
283
|
-
</Checkbox>
|
|
284
|
-
</Box>
|
|
285
|
-
<Box style={{ flex: "0 0 calc(33.333% - 11px)", minWidth: "200px" }}>
|
|
286
|
-
<Checkbox
|
|
287
|
-
name="requestPayerPhone"
|
|
288
|
-
checked={requestPayerPhone}
|
|
289
|
-
onChange={(checked) => onConfigChange({ ...config, requestPayerPhone: checked })}
|
|
290
|
-
>
|
|
291
|
-
Request Payer Phone
|
|
292
|
-
</Checkbox>
|
|
293
|
-
</Box>
|
|
294
|
-
<Box style={{ flex: "0 0 calc(33.333% - 11px)", minWidth: "200px" }}>
|
|
295
|
-
<Checkbox
|
|
296
|
-
name="requestShipping"
|
|
297
|
-
checked={requestShipping}
|
|
298
|
-
onChange={(checked) => onConfigChange({ ...config, requestShipping: checked })}
|
|
299
|
-
>
|
|
300
|
-
Request Shipping Address
|
|
301
|
-
</Checkbox>
|
|
302
|
-
</Box>
|
|
303
|
-
</Flex>
|
|
304
|
-
</Box> */}
|
|
305
239
|
|
|
306
240
|
{/* Merchant Identifier Info */}
|
|
307
241
|
<Box>
|
|
@@ -309,7 +243,7 @@ const ApplePayConfig = ({
|
|
|
309
243
|
Merchant Identifier
|
|
310
244
|
</Typography>
|
|
311
245
|
<Typography variant="pi" textColor="neutral600">
|
|
312
|
-
{settings?.mid || settings?.portalid
|
|
246
|
+
{settings?.mid || settings?.portalid
|
|
313
247
|
? `Using: ${settings.mid || settings.portalid}`
|
|
314
248
|
: "Merchant identifier will be obtained from Payone after domain verification. See documentation for setup instructions."
|
|
315
249
|
}
|
|
@@ -320,7 +254,7 @@ const ApplePayConfig = ({
|
|
|
320
254
|
<Box marginTop={4}>
|
|
321
255
|
<Box padding={3} background="warning100" borderRadius="4px" borderColor="warning200" borderWidth="1px" borderStyle="solid">
|
|
322
256
|
<Typography variant="pi" fontWeight="bold" textColor="warning700" marginBottom={2}>
|
|
323
|
-
⚠️ Domain Verification File Required
|
|
257
|
+
⚠️ Domain Verification File Required {' '}
|
|
324
258
|
</Typography>
|
|
325
259
|
<Typography variant="pi" textColor="neutral700" marginBottom={2}>
|
|
326
260
|
<strong>Download the Apple Pay domain verification file</strong> from your Payone merchant portal:
|
|
@@ -336,7 +270,6 @@ const ApplePayConfig = ({
|
|
|
336
270
|
>
|
|
337
271
|
https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev
|
|
338
272
|
</a>
|
|
339
|
-
{" "}or log into your Payone Merchant Interface (PMI) → Configuration → Payment Portals → Apple Pay → Download domain verification file
|
|
340
273
|
</Typography>
|
|
341
274
|
</Box>
|
|
342
275
|
<Typography variant="pi" textColor="neutral700" marginBottom={2}>
|
|
@@ -344,15 +277,16 @@ const ApplePayConfig = ({
|
|
|
344
277
|
</Typography>
|
|
345
278
|
<Box padding={2} background="neutral0" borderRadius="4px" marginTop={2} marginBottom={2}>
|
|
346
279
|
<Typography variant="pi" style={{ fontFamily: "monospace", fontSize: "12px" }}>
|
|
347
|
-
<strong>Strapi:</strong> <code>public/.well-known/apple-developer-merchantid-domain-association</code><br/>
|
|
280
|
+
<strong>Strapi:</strong> <code>public/.well-known/apple-developer-merchantid-domain-association</code><br />
|
|
348
281
|
<strong>Frontend:</strong> <code>public/.well-known/apple-developer-merchantid-domain-association</code>
|
|
349
282
|
</Typography>
|
|
350
283
|
</Box>
|
|
351
284
|
<Typography variant="pi" textColor="neutral700" marginTop={2}>
|
|
352
285
|
The file must be accessible at: <code>https://yourdomain.com/.well-known/apple-developer-merchantid-domain-association</code>
|
|
353
286
|
</Typography>
|
|
287
|
+
<br />
|
|
354
288
|
<Typography variant="pi" fontWeight="bold" textColor="danger600" marginTop={2}>
|
|
355
|
-
|
|
289
|
+
Without this file, Apple Pay will NOT work on your domain!
|
|
356
290
|
</Typography>
|
|
357
291
|
</Box>
|
|
358
292
|
</Box>
|
|
@@ -46,10 +46,10 @@ const PaymentActionsPanel = ({
|
|
|
46
46
|
setCardexpiredate,
|
|
47
47
|
cardcvc2,
|
|
48
48
|
setCardcvc2,
|
|
49
|
-
onNavigateToConfig
|
|
49
|
+
onNavigateToConfig,
|
|
50
50
|
}) => {
|
|
51
|
-
const mode = (settings?.mode ||
|
|
52
|
-
const isLiveMode = mode ===
|
|
51
|
+
const mode = (settings?.mode || "test").toLowerCase();
|
|
52
|
+
const isLiveMode = mode === "live";
|
|
53
53
|
|
|
54
54
|
return (
|
|
55
55
|
<Box
|
|
@@ -60,16 +60,39 @@ const PaymentActionsPanel = ({
|
|
|
60
60
|
paddingRight={8}
|
|
61
61
|
>
|
|
62
62
|
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
63
|
-
<Box
|
|
64
|
-
|
|
63
|
+
<Box
|
|
64
|
+
style={{
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
alignItems: "flex-start",
|
|
68
|
+
gap: "8px",
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Typography
|
|
72
|
+
variant="beta"
|
|
73
|
+
as="h2"
|
|
74
|
+
className="payment-title"
|
|
75
|
+
style={{ fontSize: "20px", marginBottom: "4px" }}
|
|
76
|
+
>
|
|
65
77
|
Payment Actions
|
|
66
78
|
</Typography>
|
|
67
|
-
<Typography
|
|
68
|
-
|
|
79
|
+
<Typography
|
|
80
|
+
variant="pi"
|
|
81
|
+
textColor="neutral600"
|
|
82
|
+
className="payment-subtitle"
|
|
83
|
+
style={{ fontSize: "14px" }}
|
|
84
|
+
>
|
|
85
|
+
Process payments, captures, and refunds with multiple payment
|
|
86
|
+
methods
|
|
69
87
|
</Typography>
|
|
70
88
|
{isLiveMode && (
|
|
71
|
-
<Typography
|
|
72
|
-
|
|
89
|
+
<Typography
|
|
90
|
+
variant="pi"
|
|
91
|
+
textColor="danger600"
|
|
92
|
+
style={{ fontSize: "14px", marginTop: "8px", fontWeight: "bold" }}
|
|
93
|
+
>
|
|
94
|
+
⚠️ Payment Actions are disabled in live mode for security reasons.
|
|
95
|
+
Please use test mode for testing.
|
|
73
96
|
</Typography>
|
|
74
97
|
)}
|
|
75
98
|
</Box>
|
|
@@ -80,11 +103,18 @@ const PaymentActionsPanel = ({
|
|
|
80
103
|
captureMode={captureMode}
|
|
81
104
|
setCaptureMode={setCaptureMode}
|
|
82
105
|
onNavigateToConfig={onNavigateToConfig}
|
|
106
|
+
settings={settings}
|
|
83
107
|
/>
|
|
84
108
|
|
|
85
109
|
<hr className="payment-divider" />
|
|
86
110
|
|
|
87
|
-
<Box
|
|
111
|
+
<Box
|
|
112
|
+
className="payment-form-section"
|
|
113
|
+
style={{
|
|
114
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
115
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
88
118
|
<PreauthorizationForm
|
|
89
119
|
paymentAmount={paymentAmount}
|
|
90
120
|
setPaymentAmount={setPaymentAmount}
|
|
@@ -112,7 +142,13 @@ const PaymentActionsPanel = ({
|
|
|
112
142
|
|
|
113
143
|
<hr className="payment-divider" />
|
|
114
144
|
|
|
115
|
-
<Box
|
|
145
|
+
<Box
|
|
146
|
+
className="payment-form-section"
|
|
147
|
+
style={{
|
|
148
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
149
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
116
152
|
<AuthorizationForm
|
|
117
153
|
paymentAmount={paymentAmount}
|
|
118
154
|
setPaymentAmount={setPaymentAmount}
|
|
@@ -140,7 +176,13 @@ const PaymentActionsPanel = ({
|
|
|
140
176
|
|
|
141
177
|
<hr className="payment-divider" />
|
|
142
178
|
|
|
143
|
-
<Box
|
|
179
|
+
<Box
|
|
180
|
+
className="payment-form-section"
|
|
181
|
+
style={{
|
|
182
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
183
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
144
186
|
<CaptureForm
|
|
145
187
|
paymentAmount={paymentAmount}
|
|
146
188
|
setPaymentAmount={setPaymentAmount}
|
|
@@ -153,7 +195,13 @@ const PaymentActionsPanel = ({
|
|
|
153
195
|
|
|
154
196
|
<hr className="payment-divider" />
|
|
155
197
|
|
|
156
|
-
<Box
|
|
198
|
+
<Box
|
|
199
|
+
className="payment-form-section"
|
|
200
|
+
style={{
|
|
201
|
+
opacity: isLiveMode ? 0.5 : 1,
|
|
202
|
+
pointerEvents: isLiveMode ? "none" : "auto",
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
157
205
|
<RefundForm
|
|
158
206
|
paymentAmount={paymentAmount}
|
|
159
207
|
setPaymentAmount={setPaymentAmount}
|
|
@@ -187,4 +235,4 @@ const PaymentActionsPanel = ({
|
|
|
187
235
|
);
|
|
188
236
|
};
|
|
189
237
|
|
|
190
|
-
export default PaymentActionsPanel;
|
|
238
|
+
export default PaymentActionsPanel;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as PaymentIcon } from './PaymentIcon.jsx';
|
|
2
|
+
export { default as PersonIcon } from './PersonIcon.jsx';
|
|
3
|
+
export { default as CreditCardIcon } from './CreditCardIcon.jsx';
|
|
4
|
+
export { default as BankIcon } from './BankIcon.jsx';
|
|
5
|
+
export { default as WalletIcon } from './WalletIcon.jsx';
|
|
6
|
+
export { default as ErrorIcon } from './ErrorIcon.jsx';
|
|
7
|
+
export { default as SuccessIcon } from './SuccessIcon.jsx';
|
|
8
|
+
export { default as PendingIcon } from './PendingIcon.jsx';
|
|
9
|
+
export { default as InfoIcon } from './InfoIcon.jsx';
|
|
10
|
+
export { default as ChevronDownIcon } from './ChevronDownIcon.jsx';
|
|
11
|
+
export { default as ChevronUpIcon } from './ChevronUpIcon.jsx';
|
package/admin/src/pages/App/components/paymentActions/{AuthorizationForm.js → AuthorizationForm.jsx}
RENAMED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Flex,
|
|
5
|
+
Typography,
|
|
6
|
+
TextInput,
|
|
7
|
+
Button,
|
|
8
|
+
} from "@strapi/design-system";
|
|
3
9
|
import { Play } from "@strapi/icons";
|
|
4
10
|
import GooglePayButton from "../GooglePaybutton";
|
|
5
|
-
import
|
|
11
|
+
import ApplePayBtn from "../ApplePayBtn";
|
|
6
12
|
import CardDetailsInput from "./CardDetailsInput";
|
|
7
13
|
|
|
8
14
|
const AuthorizationForm = ({
|
|
@@ -14,7 +20,6 @@ const AuthorizationForm = ({
|
|
|
14
20
|
onAuthorization,
|
|
15
21
|
paymentMethod,
|
|
16
22
|
settings,
|
|
17
|
-
googlePayToken,
|
|
18
23
|
setGooglePayToken,
|
|
19
24
|
applePayToken,
|
|
20
25
|
setApplePayToken,
|
|
@@ -26,7 +31,7 @@ const AuthorizationForm = ({
|
|
|
26
31
|
setCardexpiredate,
|
|
27
32
|
cardcvc2,
|
|
28
33
|
setCardcvc2,
|
|
29
|
-
isLiveMode = false
|
|
34
|
+
isLiveMode = false,
|
|
30
35
|
}) => {
|
|
31
36
|
const handleGooglePayToken = (token, paymentData) => {
|
|
32
37
|
if (!token) {
|
|
@@ -44,32 +49,15 @@ const AuthorizationForm = ({
|
|
|
44
49
|
|
|
45
50
|
const handleApplePayToken = async (token, paymentData) => {
|
|
46
51
|
if (!token) {
|
|
47
|
-
console.error("[Apple Pay] Token is missing in handleApplePayToken");
|
|
48
52
|
return Promise.reject(new Error("Token is missing"));
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
console.log("[Apple Pay] handleApplePayToken called with token:", {
|
|
52
|
-
hasToken: !!token,
|
|
53
|
-
tokenLength: token?.length,
|
|
54
|
-
paymentData: !!paymentData
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// IMPORTANT: Set token in state immediately (synchronously)
|
|
58
|
-
// This ensures the token is saved before the dialog closes
|
|
59
55
|
setApplePayToken(token);
|
|
60
56
|
|
|
61
|
-
console.log("[Apple Pay] Token saved to state successfully");
|
|
62
|
-
|
|
63
|
-
// Don't call onAuthorization immediately
|
|
64
|
-
// Let the user manually trigger the payment using the button
|
|
65
|
-
// This prevents the dialog from closing prematurely if there's an error
|
|
66
|
-
// The dialog will close with success, and the user will see the "Process Authorization" button
|
|
67
|
-
|
|
68
|
-
// Return success immediately so the dialog closes properly
|
|
69
|
-
// The actual payment processing will happen when the user clicks the button
|
|
70
57
|
return Promise.resolve({
|
|
71
58
|
success: true,
|
|
72
|
-
message:
|
|
59
|
+
message:
|
|
60
|
+
"Token received successfully. Please click 'Process Authorization' to complete the payment.",
|
|
73
61
|
});
|
|
74
62
|
};
|
|
75
63
|
|
|
@@ -79,14 +67,22 @@ const AuthorizationForm = ({
|
|
|
79
67
|
}
|
|
80
68
|
};
|
|
81
69
|
|
|
82
|
-
|
|
83
70
|
return (
|
|
84
71
|
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
85
72
|
<Flex direction="row" gap={2}>
|
|
86
|
-
<Typography
|
|
73
|
+
<Typography
|
|
74
|
+
variant="omega"
|
|
75
|
+
fontWeight="semiBold"
|
|
76
|
+
textColor="neutral800"
|
|
77
|
+
className="payment-form-title"
|
|
78
|
+
>
|
|
87
79
|
Authorization
|
|
88
80
|
</Typography>
|
|
89
|
-
<Typography
|
|
81
|
+
<Typography
|
|
82
|
+
variant="pi"
|
|
83
|
+
textColor="neutral600"
|
|
84
|
+
className="payment-form-description"
|
|
85
|
+
>
|
|
90
86
|
Authorize and capture an amount immediately.
|
|
91
87
|
</Typography>
|
|
92
88
|
</Flex>
|
|
@@ -141,25 +137,40 @@ const AuthorizationForm = ({
|
|
|
141
137
|
/>
|
|
142
138
|
) : paymentMethod === "apl" ? (
|
|
143
139
|
<Box>
|
|
144
|
-
<
|
|
140
|
+
<ApplePayBtn
|
|
145
141
|
amount={paymentAmount}
|
|
146
|
-
currency="EUR"
|
|
147
142
|
onTokenReceived={handleApplePayToken}
|
|
148
143
|
onError={handleApplePayError}
|
|
149
144
|
settings={settings}
|
|
150
145
|
/>
|
|
151
146
|
{applePayToken && (
|
|
152
|
-
<Box
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
<Box
|
|
148
|
+
marginTop={3}
|
|
149
|
+
style={{
|
|
150
|
+
width: "100%",
|
|
151
|
+
display: "flex",
|
|
152
|
+
flexDirection: "column",
|
|
153
|
+
alignItems: "flex-start",
|
|
154
|
+
gap: "8px",
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<Typography
|
|
158
|
+
variant="pi"
|
|
159
|
+
textColor="success600"
|
|
160
|
+
style={{ marginBottom: "8px", fontWeight: "bold" }}
|
|
161
|
+
>
|
|
162
|
+
✓ Apple Pay token received. You can now process the
|
|
163
|
+
authorization:
|
|
155
164
|
</Typography>
|
|
156
165
|
<Button
|
|
157
166
|
variant="default"
|
|
158
167
|
onClick={() => onAuthorization(applePayToken)}
|
|
159
168
|
loading={isProcessingPayment}
|
|
160
169
|
startIcon={<Play />}
|
|
161
|
-
style={{ maxWidth:
|
|
162
|
-
disabled={
|
|
170
|
+
style={{ maxWidth: "200px" }}
|
|
171
|
+
disabled={
|
|
172
|
+
!paymentAmount.trim() || !authReference.trim() || isLiveMode
|
|
173
|
+
}
|
|
163
174
|
className="payment-button payment-button-primary"
|
|
164
175
|
>
|
|
165
176
|
Process Authorization
|
|
@@ -173,7 +184,7 @@ const AuthorizationForm = ({
|
|
|
173
184
|
onClick={onAuthorization}
|
|
174
185
|
loading={isProcessingPayment}
|
|
175
186
|
startIcon={<Play />}
|
|
176
|
-
style={{ maxWidth:
|
|
187
|
+
style={{ maxWidth: "200px" }}
|
|
177
188
|
className="payment-button payment-button-primary"
|
|
178
189
|
disabled={
|
|
179
190
|
!paymentAmount.trim() ||
|
|
@@ -192,4 +203,3 @@ const AuthorizationForm = ({
|
|
|
192
203
|
};
|
|
193
204
|
|
|
194
205
|
export default AuthorizationForm;
|
|
195
|
-
|