strapi-plugin-payone-provider 5.7.26 → 5.8.26
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/README.md +1191 -1191
- package/admin/src/components/Initializer/index.jsx +16 -16
- package/admin/src/components/PluginIcon/index.jsx +17 -17
- package/admin/src/index.js +57 -57
- package/admin/src/pages/App/components/AppHeader.jsx +45 -45
- package/admin/src/pages/App/components/AppTabs.jsx +105 -105
- package/admin/src/pages/App/components/ApplePayBtn.jsx +355 -355
- package/admin/src/pages/App/components/ApplePayConfig.jsx +357 -357
- package/admin/src/pages/App/components/DocsPanel.jsx +53 -53
- package/admin/src/pages/App/components/RenderInput.jsx +78 -78
- package/admin/src/pages/App/components/StatusBadge.jsx +87 -87
- package/admin/src/pages/App/components/icons/BankIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/ErrorIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/InfoIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -19
- package/admin/src/pages/App/components/icons/PaymentIcon.jsx +10 -10
- package/admin/src/pages/App/components/icons/PendingIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/PersonIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/SuccessIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/WalletIcon.jsx +9 -9
- package/admin/src/pages/App/components/icons/index.jsx +12 -12
- package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +334 -334
- package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +120 -120
- package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +183 -183
- package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +315 -315
- package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +129 -129
- package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +273 -273
- package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +114 -114
- package/admin/src/pages/App/components/transaction-history/ImportExportBar.jsx +153 -153
- package/admin/src/pages/App/components/transaction-history/details/TransactionHistoryItem.jsx +526 -526
- package/admin/src/pages/App/index.jsx +96 -96
- package/admin/src/pages/App/styles.css +176 -176
- package/admin/src/pages/constants/paymentConstants.js +71 -71
- package/admin/src/pages/hooks/use-system-theme.js +27 -27
- package/admin/src/pages/hooks/usePaymentActions.js +498 -498
- package/admin/src/pages/hooks/usePluginTranslations.js +12 -12
- package/admin/src/pages/hooks/useSettings.js +183 -183
- package/admin/src/pages/hooks/useTransactionHistory.js +148 -148
- package/admin/src/pages/utils/api.js +97 -97
- package/admin/src/pages/utils/applePayConstants.js +196 -196
- package/admin/src/pages/utils/formatTransactionData.js +15 -15
- package/admin/src/pages/utils/getInputComponent.jsx +200 -200
- package/admin/src/pages/utils/paymentUtils.js +661 -661
- package/admin/src/pages/utils/tooltipHelpers.js +18 -18
- package/admin/src/pages/utils/transactionTableUtils.js +71 -71
- package/admin/src/pluginId.js +9 -9
- package/admin/src/translations/de.json +235 -235
- package/admin/src/translations/en.json +235 -235
- package/admin/src/translations/fr.json +235 -235
- package/admin/src/translations/ru.json +235 -235
- package/admin/src/utils/prefixPluginTranslations.js +13 -13
- package/package.json +45 -45
- package/server/bootstrap.js +107 -107
- package/server/config/index.js +83 -83
- package/server/content-types/index.js +4 -4
- package/server/content-types/transactions/index.js +4 -4
- package/server/content-types/transactions/schema.json +86 -86
- package/server/controllers/index.js +7 -7
- package/server/controllers/payone.js +503 -506
- package/server/destroy.js +5 -5
- package/server/index.js +23 -23
- package/server/policies/index.js +7 -7
- package/server/policies/is-auth.js +29 -29
- package/server/policies/isSuperAdmin.js +20 -20
- package/server/register.js +5 -5
- package/server/routes/index.js +218 -218
- package/server/services/applePayService.js +295 -295
- package/server/services/index.js +9 -9
- package/server/services/paymentService.js +264 -223
- package/server/services/payone.js +78 -78
- package/server/services/settingsService.js +59 -59
- package/server/services/testConnectionService.js +115 -115
- package/server/services/transactionService.js +262 -262
- package/server/utils/csvTransactions.js +82 -82
- package/server/utils/normalize.js +39 -39
- package/server/utils/paymentMethodParams.js +288 -288
- package/server/utils/requestBuilder.js +115 -100
- package/server/utils/responseParser.js +141 -141
- package/strapi-admin.js +4 -4
- package/strapi-server.js +3 -3
|
@@ -1,334 +1,334 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Box, Flex, Typography, Button } from "@strapi/design-system";
|
|
3
|
-
import { Play } from "@strapi/icons";
|
|
4
|
-
import GooglePayButton from "../GooglePaybutton";
|
|
5
|
-
import ApplePayBtn from "../ApplePayBtn";
|
|
6
|
-
import CardDetailsInput from "./CardDetailsInput";
|
|
7
|
-
import RenderInput from "../RenderInput";
|
|
8
|
-
import {
|
|
9
|
-
getSalutationOptions,
|
|
10
|
-
getGenderOptions,
|
|
11
|
-
getCurrencyOptions,
|
|
12
|
-
getCountryOptions,
|
|
13
|
-
} from "../../../utils/countryLanguageUtils";
|
|
14
|
-
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
15
|
-
|
|
16
|
-
const AuthorizationForm = ({ paymentActions, settings }) => {
|
|
17
|
-
const { t } = usePluginTranslations();
|
|
18
|
-
const handleGooglePayToken = (token) => {
|
|
19
|
-
if (!token) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
paymentActions.handleFieldChange("googlePayToken", token);
|
|
23
|
-
paymentActions.handleAuthorization(token);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const handleGooglePayError = (error) => {
|
|
27
|
-
console.error("[AuthorizationForm] Google Pay error:", error);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const handleApplePayToken = async (token) => {
|
|
31
|
-
if (!token) {
|
|
32
|
-
return Promise.reject(new Error("Token is missing"));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
paymentActions.handleFieldChange("applePayToken", token);
|
|
36
|
-
|
|
37
|
-
return Promise.resolve({
|
|
38
|
-
success: true,
|
|
39
|
-
message:
|
|
40
|
-
`Token received successfully. Please click '${t("auth.submit", "Authorize")}' to complete the payment.`,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const handleApplePayError = (error) => {
|
|
45
|
-
console.error("[AuthorizationForm] Apple Pay error:", error);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const countryOptions = getCountryOptions(
|
|
49
|
-
paymentActions.paymentState.paymentMethod
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
const salutationOptions = getSalutationOptions(
|
|
53
|
-
paymentActions.paymentState.country || "US"
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const genderOptions = getGenderOptions(
|
|
57
|
-
paymentActions.paymentState.country || "US"
|
|
58
|
-
);
|
|
59
|
-
const currencyOptions = getCurrencyOptions();
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
63
|
-
<Flex direction="row" gap={2}>
|
|
64
|
-
<Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
|
|
65
|
-
{t("auth.title", "Authorization")}
|
|
66
|
-
</Typography>
|
|
67
|
-
<Typography variant="pi" textColor="neutral600" className="payment-form-description">
|
|
68
|
-
{t("auth.description", "Authorize a payment with an existing preauthorization.")}
|
|
69
|
-
</Typography>
|
|
70
|
-
</Flex>
|
|
71
|
-
|
|
72
|
-
<Box
|
|
73
|
-
style={{
|
|
74
|
-
display: "grid",
|
|
75
|
-
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
76
|
-
gap: "16px",
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<RenderInput
|
|
80
|
-
name="authAmount"
|
|
81
|
-
label={t("common.amount", "Amount *")}
|
|
82
|
-
value={paymentActions.paymentState.paymentAmount || ""}
|
|
83
|
-
onChange={(e) =>
|
|
84
|
-
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
85
|
-
}
|
|
86
|
-
inputType="textInput"
|
|
87
|
-
placeholder={t("preauth.amountPlaceholder", "Enter amount (e.g., 1000 for €10.00)")}
|
|
88
|
-
required
|
|
89
|
-
tooltipContent={t("preauth.amountTooltip", "Amount in cents (e.g., 1000 = €10.00)")}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<RenderInput
|
|
93
|
-
name="firstname"
|
|
94
|
-
label="First Name"
|
|
95
|
-
value={paymentActions.paymentState.firstname || ""}
|
|
96
|
-
onChange={(e) =>
|
|
97
|
-
paymentActions.handleFieldChange("firstname", e.target.value)
|
|
98
|
-
}
|
|
99
|
-
inputType="textInput"
|
|
100
|
-
placeholder="John"
|
|
101
|
-
tooltipContent="Customer first name"
|
|
102
|
-
/>
|
|
103
|
-
|
|
104
|
-
<RenderInput
|
|
105
|
-
name="lastname"
|
|
106
|
-
label="Last Name"
|
|
107
|
-
value={paymentActions.paymentState.lastname || ""}
|
|
108
|
-
onChange={(e) =>
|
|
109
|
-
paymentActions.handleFieldChange("lastname", e.target.value)
|
|
110
|
-
}
|
|
111
|
-
inputType="textInput"
|
|
112
|
-
placeholder="Doe"
|
|
113
|
-
tooltipContent="Customer last name"
|
|
114
|
-
/>
|
|
115
|
-
|
|
116
|
-
<RenderInput
|
|
117
|
-
name="email"
|
|
118
|
-
label="Email"
|
|
119
|
-
value={paymentActions.paymentState.email || ""}
|
|
120
|
-
onChange={(e) =>
|
|
121
|
-
paymentActions.handleFieldChange("email", e.target.value)
|
|
122
|
-
}
|
|
123
|
-
inputType="textInput"
|
|
124
|
-
placeholder="john.doe@example.com"
|
|
125
|
-
tooltipContent="Customer email address"
|
|
126
|
-
/>
|
|
127
|
-
|
|
128
|
-
<RenderInput
|
|
129
|
-
name="telephonenumber"
|
|
130
|
-
label="Phone Number"
|
|
131
|
-
value={paymentActions.paymentState.telephonenumber || ""}
|
|
132
|
-
onChange={(e) =>
|
|
133
|
-
paymentActions.handleFieldChange("telephonenumber", e.target.value)
|
|
134
|
-
}
|
|
135
|
-
inputType="textInput"
|
|
136
|
-
placeholder="+4917512345678"
|
|
137
|
-
tooltipContent="Customer phone number"
|
|
138
|
-
/>
|
|
139
|
-
|
|
140
|
-
<RenderInput
|
|
141
|
-
name="gender"
|
|
142
|
-
label="Gender"
|
|
143
|
-
value={paymentActions.paymentState.gender || ""}
|
|
144
|
-
onChange={(e) =>
|
|
145
|
-
paymentActions.handleFieldChange("gender", e.target.value)
|
|
146
|
-
}
|
|
147
|
-
inputType="select"
|
|
148
|
-
options={genderOptions}
|
|
149
|
-
placeholder="Select gender"
|
|
150
|
-
tooltipContent="Customer gender"
|
|
151
|
-
/>
|
|
152
|
-
|
|
153
|
-
<RenderInput
|
|
154
|
-
name="salutation"
|
|
155
|
-
label="Salutation"
|
|
156
|
-
value={paymentActions.paymentState.salutation || ""}
|
|
157
|
-
onChange={(e) =>
|
|
158
|
-
paymentActions.handleFieldChange("salutation", e.target.value)
|
|
159
|
-
}
|
|
160
|
-
inputType="select"
|
|
161
|
-
options={salutationOptions}
|
|
162
|
-
placeholder="Select salutation"
|
|
163
|
-
tooltipContent="Customer salutation"
|
|
164
|
-
/>
|
|
165
|
-
|
|
166
|
-
<RenderInput
|
|
167
|
-
name="country"
|
|
168
|
-
label="Country"
|
|
169
|
-
value={paymentActions.paymentState.country || ""}
|
|
170
|
-
onChange={(e) =>
|
|
171
|
-
paymentActions.handleFieldChange("country", e.target.value)
|
|
172
|
-
}
|
|
173
|
-
inputType="select"
|
|
174
|
-
options={countryOptions}
|
|
175
|
-
placeholder="Select country"
|
|
176
|
-
tooltipContent="Billing address country"
|
|
177
|
-
/>
|
|
178
|
-
|
|
179
|
-
<RenderInput
|
|
180
|
-
name="currency"
|
|
181
|
-
label="Currency"
|
|
182
|
-
value={paymentActions.paymentState.currency || "EUR"}
|
|
183
|
-
onChange={(e) =>
|
|
184
|
-
paymentActions.handleFieldChange("currency", e.target.value)
|
|
185
|
-
}
|
|
186
|
-
inputType="select"
|
|
187
|
-
options={currencyOptions}
|
|
188
|
-
placeholder="Select currency"
|
|
189
|
-
tooltipContent="Currency code"
|
|
190
|
-
/>
|
|
191
|
-
|
|
192
|
-
<RenderInput
|
|
193
|
-
name="city"
|
|
194
|
-
label="City"
|
|
195
|
-
value={paymentActions.paymentState.city || ""}
|
|
196
|
-
onChange={(e) =>
|
|
197
|
-
paymentActions.handleFieldChange("city", e.target.value)
|
|
198
|
-
}
|
|
199
|
-
inputType="textInput"
|
|
200
|
-
placeholder="Berlin"
|
|
201
|
-
tooltipContent="Billing address city"
|
|
202
|
-
/>
|
|
203
|
-
|
|
204
|
-
<RenderInput
|
|
205
|
-
name="street"
|
|
206
|
-
label="Street"
|
|
207
|
-
value={paymentActions.paymentState.street || ""}
|
|
208
|
-
onChange={(e) =>
|
|
209
|
-
paymentActions.handleFieldChange("street", e.target.value)
|
|
210
|
-
}
|
|
211
|
-
inputType="textInput"
|
|
212
|
-
placeholder="Main Street 123"
|
|
213
|
-
tooltipContent="Billing address street"
|
|
214
|
-
/>
|
|
215
|
-
|
|
216
|
-
<RenderInput
|
|
217
|
-
name="zip"
|
|
218
|
-
label="ZIP Code"
|
|
219
|
-
value={paymentActions.paymentState.zip || ""}
|
|
220
|
-
onChange={(e) =>
|
|
221
|
-
paymentActions.handleFieldChange("zip", e.target.value)
|
|
222
|
-
}
|
|
223
|
-
inputType="textInput"
|
|
224
|
-
placeholder="12345"
|
|
225
|
-
tooltipContent="Billing address ZIP code"
|
|
226
|
-
/>
|
|
227
|
-
</Box>
|
|
228
|
-
|
|
229
|
-
{paymentActions.paymentState.paymentMethod === "cc" &&
|
|
230
|
-
settings?.settings?.enable3DSecure && (
|
|
231
|
-
<Box marginTop={4}>
|
|
232
|
-
<CardDetailsInput
|
|
233
|
-
cardtype={paymentActions.paymentState.cardtype}
|
|
234
|
-
setCardtype={(value) =>
|
|
235
|
-
paymentActions.handleFieldChange("cardtype", value)
|
|
236
|
-
}
|
|
237
|
-
cardpan={paymentActions.paymentState.cardpan}
|
|
238
|
-
setCardpan={(value) =>
|
|
239
|
-
paymentActions.handleFieldChange("cardpan", value)
|
|
240
|
-
}
|
|
241
|
-
cardexpiredate={paymentActions.paymentState.cardexpiredate}
|
|
242
|
-
setCardexpiredate={(value) =>
|
|
243
|
-
paymentActions.handleFieldChange("cardexpiredate", value)
|
|
244
|
-
}
|
|
245
|
-
cardcvc2={paymentActions.paymentState.cardcvc2}
|
|
246
|
-
setCardcvc2={(value) =>
|
|
247
|
-
paymentActions.handleFieldChange("cardcvc2", value)
|
|
248
|
-
}
|
|
249
|
-
/>
|
|
250
|
-
</Box>
|
|
251
|
-
)}
|
|
252
|
-
|
|
253
|
-
{paymentActions.paymentState.paymentMethod === "gpp" ? (
|
|
254
|
-
<GooglePayButton
|
|
255
|
-
amount={paymentActions.paymentState.paymentAmount}
|
|
256
|
-
currency="EUR"
|
|
257
|
-
onTokenReceived={handleGooglePayToken}
|
|
258
|
-
onError={handleGooglePayError}
|
|
259
|
-
settings={settings?.settings}
|
|
260
|
-
/>
|
|
261
|
-
) : paymentActions.paymentState.paymentMethod === "apl" ? (
|
|
262
|
-
<Box>
|
|
263
|
-
<ApplePayBtn
|
|
264
|
-
amount={paymentActions.paymentState.paymentAmount}
|
|
265
|
-
onTokenReceived={handleApplePayToken}
|
|
266
|
-
onError={handleApplePayError}
|
|
267
|
-
settings={settings?.settings}
|
|
268
|
-
/>
|
|
269
|
-
{paymentActions.paymentState.applePayToken && (
|
|
270
|
-
<Box
|
|
271
|
-
marginTop={3}
|
|
272
|
-
style={{
|
|
273
|
-
width: "100%",
|
|
274
|
-
display: "flex",
|
|
275
|
-
flexDirection: "column",
|
|
276
|
-
alignItems: "flex-start",
|
|
277
|
-
gap: "8px",
|
|
278
|
-
}}
|
|
279
|
-
>
|
|
280
|
-
<Typography
|
|
281
|
-
variant="pi"
|
|
282
|
-
textColor="success600"
|
|
283
|
-
style={{ marginBottom: "8px", fontWeight: "bold" }}
|
|
284
|
-
>
|
|
285
|
-
✓ Apple Pay token received. You can now process the
|
|
286
|
-
authorization:
|
|
287
|
-
</Typography>
|
|
288
|
-
<Button
|
|
289
|
-
variant="default"
|
|
290
|
-
onClick={() =>
|
|
291
|
-
paymentActions.handleAuthorization(
|
|
292
|
-
paymentActions.paymentState.applePayToken
|
|
293
|
-
)
|
|
294
|
-
}
|
|
295
|
-
loading={paymentActions.isProcessingPayment}
|
|
296
|
-
startIcon={<Play />}
|
|
297
|
-
style={{ maxWidth: "200px" }}
|
|
298
|
-
disabled={
|
|
299
|
-
!paymentActions.paymentState.paymentAmount.trim() ||
|
|
300
|
-
!paymentActions.paymentState.authReference.trim()
|
|
301
|
-
}
|
|
302
|
-
>
|
|
303
|
-
{t("auth.submit", "Authorize")}
|
|
304
|
-
</Button>
|
|
305
|
-
</Box>
|
|
306
|
-
)}
|
|
307
|
-
</Box>
|
|
308
|
-
) : (
|
|
309
|
-
<Button
|
|
310
|
-
variant="default"
|
|
311
|
-
onClick={paymentActions.handleAuthorization}
|
|
312
|
-
loading={paymentActions.isProcessingPayment}
|
|
313
|
-
startIcon={<Play />}
|
|
314
|
-
style={{ maxWidth: "200px" }}
|
|
315
|
-
disabled={
|
|
316
|
-
!paymentActions.paymentState.paymentAmount.trim() ||
|
|
317
|
-
(paymentActions.paymentState.paymentMethod === "cc" &&
|
|
318
|
-
settings?.settings?.enable3DSecure !== false &&
|
|
319
|
-
(!paymentActions.paymentState.cardtype ||
|
|
320
|
-
!paymentActions.paymentState.cardpan ||
|
|
321
|
-
!paymentActions.paymentState.cardexpiredate ||
|
|
322
|
-
!paymentActions.paymentState.cardcvc2)) ||
|
|
323
|
-
(paymentActions.paymentState.paymentMethod === "apl" &&
|
|
324
|
-
!paymentActions.paymentState.applePayToken)
|
|
325
|
-
}
|
|
326
|
-
>
|
|
327
|
-
{t("auth.submit", "Authorize")}
|
|
328
|
-
</Button>
|
|
329
|
-
)}
|
|
330
|
-
</Flex>
|
|
331
|
-
);
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
export default AuthorizationForm;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Box, Flex, Typography, Button } from "@strapi/design-system";
|
|
3
|
+
import { Play } from "@strapi/icons";
|
|
4
|
+
import GooglePayButton from "../GooglePaybutton";
|
|
5
|
+
import ApplePayBtn from "../ApplePayBtn";
|
|
6
|
+
import CardDetailsInput from "./CardDetailsInput";
|
|
7
|
+
import RenderInput from "../RenderInput";
|
|
8
|
+
import {
|
|
9
|
+
getSalutationOptions,
|
|
10
|
+
getGenderOptions,
|
|
11
|
+
getCurrencyOptions,
|
|
12
|
+
getCountryOptions,
|
|
13
|
+
} from "../../../utils/countryLanguageUtils";
|
|
14
|
+
import { usePluginTranslations } from "../../../hooks/usePluginTranslations";
|
|
15
|
+
|
|
16
|
+
const AuthorizationForm = ({ paymentActions, settings }) => {
|
|
17
|
+
const { t } = usePluginTranslations();
|
|
18
|
+
const handleGooglePayToken = (token) => {
|
|
19
|
+
if (!token) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
paymentActions.handleFieldChange("googlePayToken", token);
|
|
23
|
+
paymentActions.handleAuthorization(token);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handleGooglePayError = (error) => {
|
|
27
|
+
console.error("[AuthorizationForm] Google Pay error:", error);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleApplePayToken = async (token) => {
|
|
31
|
+
if (!token) {
|
|
32
|
+
return Promise.reject(new Error("Token is missing"));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
paymentActions.handleFieldChange("applePayToken", token);
|
|
36
|
+
|
|
37
|
+
return Promise.resolve({
|
|
38
|
+
success: true,
|
|
39
|
+
message:
|
|
40
|
+
`Token received successfully. Please click '${t("auth.submit", "Authorize")}' to complete the payment.`,
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleApplePayError = (error) => {
|
|
45
|
+
console.error("[AuthorizationForm] Apple Pay error:", error);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const countryOptions = getCountryOptions(
|
|
49
|
+
paymentActions.paymentState.paymentMethod
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const salutationOptions = getSalutationOptions(
|
|
53
|
+
paymentActions.paymentState.country || "US"
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const genderOptions = getGenderOptions(
|
|
57
|
+
paymentActions.paymentState.country || "US"
|
|
58
|
+
);
|
|
59
|
+
const currencyOptions = getCurrencyOptions();
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
63
|
+
<Flex direction="row" gap={2}>
|
|
64
|
+
<Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
|
|
65
|
+
{t("auth.title", "Authorization")}
|
|
66
|
+
</Typography>
|
|
67
|
+
<Typography variant="pi" textColor="neutral600" className="payment-form-description">
|
|
68
|
+
{t("auth.description", "Authorize a payment with an existing preauthorization.")}
|
|
69
|
+
</Typography>
|
|
70
|
+
</Flex>
|
|
71
|
+
|
|
72
|
+
<Box
|
|
73
|
+
style={{
|
|
74
|
+
display: "grid",
|
|
75
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
76
|
+
gap: "16px",
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<RenderInput
|
|
80
|
+
name="authAmount"
|
|
81
|
+
label={t("common.amount", "Amount *")}
|
|
82
|
+
value={paymentActions.paymentState.paymentAmount || ""}
|
|
83
|
+
onChange={(e) =>
|
|
84
|
+
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
85
|
+
}
|
|
86
|
+
inputType="textInput"
|
|
87
|
+
placeholder={t("preauth.amountPlaceholder", "Enter amount (e.g., 1000 for €10.00)")}
|
|
88
|
+
required
|
|
89
|
+
tooltipContent={t("preauth.amountTooltip", "Amount in cents (e.g., 1000 = €10.00)")}
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<RenderInput
|
|
93
|
+
name="firstname"
|
|
94
|
+
label="First Name"
|
|
95
|
+
value={paymentActions.paymentState.firstname || ""}
|
|
96
|
+
onChange={(e) =>
|
|
97
|
+
paymentActions.handleFieldChange("firstname", e.target.value)
|
|
98
|
+
}
|
|
99
|
+
inputType="textInput"
|
|
100
|
+
placeholder="John"
|
|
101
|
+
tooltipContent="Customer first name"
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<RenderInput
|
|
105
|
+
name="lastname"
|
|
106
|
+
label="Last Name"
|
|
107
|
+
value={paymentActions.paymentState.lastname || ""}
|
|
108
|
+
onChange={(e) =>
|
|
109
|
+
paymentActions.handleFieldChange("lastname", e.target.value)
|
|
110
|
+
}
|
|
111
|
+
inputType="textInput"
|
|
112
|
+
placeholder="Doe"
|
|
113
|
+
tooltipContent="Customer last name"
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<RenderInput
|
|
117
|
+
name="email"
|
|
118
|
+
label="Email"
|
|
119
|
+
value={paymentActions.paymentState.email || ""}
|
|
120
|
+
onChange={(e) =>
|
|
121
|
+
paymentActions.handleFieldChange("email", e.target.value)
|
|
122
|
+
}
|
|
123
|
+
inputType="textInput"
|
|
124
|
+
placeholder="john.doe@example.com"
|
|
125
|
+
tooltipContent="Customer email address"
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<RenderInput
|
|
129
|
+
name="telephonenumber"
|
|
130
|
+
label="Phone Number"
|
|
131
|
+
value={paymentActions.paymentState.telephonenumber || ""}
|
|
132
|
+
onChange={(e) =>
|
|
133
|
+
paymentActions.handleFieldChange("telephonenumber", e.target.value)
|
|
134
|
+
}
|
|
135
|
+
inputType="textInput"
|
|
136
|
+
placeholder="+4917512345678"
|
|
137
|
+
tooltipContent="Customer phone number"
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<RenderInput
|
|
141
|
+
name="gender"
|
|
142
|
+
label="Gender"
|
|
143
|
+
value={paymentActions.paymentState.gender || ""}
|
|
144
|
+
onChange={(e) =>
|
|
145
|
+
paymentActions.handleFieldChange("gender", e.target.value)
|
|
146
|
+
}
|
|
147
|
+
inputType="select"
|
|
148
|
+
options={genderOptions}
|
|
149
|
+
placeholder="Select gender"
|
|
150
|
+
tooltipContent="Customer gender"
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
<RenderInput
|
|
154
|
+
name="salutation"
|
|
155
|
+
label="Salutation"
|
|
156
|
+
value={paymentActions.paymentState.salutation || ""}
|
|
157
|
+
onChange={(e) =>
|
|
158
|
+
paymentActions.handleFieldChange("salutation", e.target.value)
|
|
159
|
+
}
|
|
160
|
+
inputType="select"
|
|
161
|
+
options={salutationOptions}
|
|
162
|
+
placeholder="Select salutation"
|
|
163
|
+
tooltipContent="Customer salutation"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<RenderInput
|
|
167
|
+
name="country"
|
|
168
|
+
label="Country"
|
|
169
|
+
value={paymentActions.paymentState.country || ""}
|
|
170
|
+
onChange={(e) =>
|
|
171
|
+
paymentActions.handleFieldChange("country", e.target.value)
|
|
172
|
+
}
|
|
173
|
+
inputType="select"
|
|
174
|
+
options={countryOptions}
|
|
175
|
+
placeholder="Select country"
|
|
176
|
+
tooltipContent="Billing address country"
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
<RenderInput
|
|
180
|
+
name="currency"
|
|
181
|
+
label="Currency"
|
|
182
|
+
value={paymentActions.paymentState.currency || "EUR"}
|
|
183
|
+
onChange={(e) =>
|
|
184
|
+
paymentActions.handleFieldChange("currency", e.target.value)
|
|
185
|
+
}
|
|
186
|
+
inputType="select"
|
|
187
|
+
options={currencyOptions}
|
|
188
|
+
placeholder="Select currency"
|
|
189
|
+
tooltipContent="Currency code"
|
|
190
|
+
/>
|
|
191
|
+
|
|
192
|
+
<RenderInput
|
|
193
|
+
name="city"
|
|
194
|
+
label="City"
|
|
195
|
+
value={paymentActions.paymentState.city || ""}
|
|
196
|
+
onChange={(e) =>
|
|
197
|
+
paymentActions.handleFieldChange("city", e.target.value)
|
|
198
|
+
}
|
|
199
|
+
inputType="textInput"
|
|
200
|
+
placeholder="Berlin"
|
|
201
|
+
tooltipContent="Billing address city"
|
|
202
|
+
/>
|
|
203
|
+
|
|
204
|
+
<RenderInput
|
|
205
|
+
name="street"
|
|
206
|
+
label="Street"
|
|
207
|
+
value={paymentActions.paymentState.street || ""}
|
|
208
|
+
onChange={(e) =>
|
|
209
|
+
paymentActions.handleFieldChange("street", e.target.value)
|
|
210
|
+
}
|
|
211
|
+
inputType="textInput"
|
|
212
|
+
placeholder="Main Street 123"
|
|
213
|
+
tooltipContent="Billing address street"
|
|
214
|
+
/>
|
|
215
|
+
|
|
216
|
+
<RenderInput
|
|
217
|
+
name="zip"
|
|
218
|
+
label="ZIP Code"
|
|
219
|
+
value={paymentActions.paymentState.zip || ""}
|
|
220
|
+
onChange={(e) =>
|
|
221
|
+
paymentActions.handleFieldChange("zip", e.target.value)
|
|
222
|
+
}
|
|
223
|
+
inputType="textInput"
|
|
224
|
+
placeholder="12345"
|
|
225
|
+
tooltipContent="Billing address ZIP code"
|
|
226
|
+
/>
|
|
227
|
+
</Box>
|
|
228
|
+
|
|
229
|
+
{paymentActions.paymentState.paymentMethod === "cc" &&
|
|
230
|
+
settings?.settings?.enable3DSecure && (
|
|
231
|
+
<Box marginTop={4}>
|
|
232
|
+
<CardDetailsInput
|
|
233
|
+
cardtype={paymentActions.paymentState.cardtype}
|
|
234
|
+
setCardtype={(value) =>
|
|
235
|
+
paymentActions.handleFieldChange("cardtype", value)
|
|
236
|
+
}
|
|
237
|
+
cardpan={paymentActions.paymentState.cardpan}
|
|
238
|
+
setCardpan={(value) =>
|
|
239
|
+
paymentActions.handleFieldChange("cardpan", value)
|
|
240
|
+
}
|
|
241
|
+
cardexpiredate={paymentActions.paymentState.cardexpiredate}
|
|
242
|
+
setCardexpiredate={(value) =>
|
|
243
|
+
paymentActions.handleFieldChange("cardexpiredate", value)
|
|
244
|
+
}
|
|
245
|
+
cardcvc2={paymentActions.paymentState.cardcvc2}
|
|
246
|
+
setCardcvc2={(value) =>
|
|
247
|
+
paymentActions.handleFieldChange("cardcvc2", value)
|
|
248
|
+
}
|
|
249
|
+
/>
|
|
250
|
+
</Box>
|
|
251
|
+
)}
|
|
252
|
+
|
|
253
|
+
{paymentActions.paymentState.paymentMethod === "gpp" ? (
|
|
254
|
+
<GooglePayButton
|
|
255
|
+
amount={paymentActions.paymentState.paymentAmount}
|
|
256
|
+
currency="EUR"
|
|
257
|
+
onTokenReceived={handleGooglePayToken}
|
|
258
|
+
onError={handleGooglePayError}
|
|
259
|
+
settings={settings?.settings}
|
|
260
|
+
/>
|
|
261
|
+
) : paymentActions.paymentState.paymentMethod === "apl" ? (
|
|
262
|
+
<Box>
|
|
263
|
+
<ApplePayBtn
|
|
264
|
+
amount={paymentActions.paymentState.paymentAmount}
|
|
265
|
+
onTokenReceived={handleApplePayToken}
|
|
266
|
+
onError={handleApplePayError}
|
|
267
|
+
settings={settings?.settings}
|
|
268
|
+
/>
|
|
269
|
+
{paymentActions.paymentState.applePayToken && (
|
|
270
|
+
<Box
|
|
271
|
+
marginTop={3}
|
|
272
|
+
style={{
|
|
273
|
+
width: "100%",
|
|
274
|
+
display: "flex",
|
|
275
|
+
flexDirection: "column",
|
|
276
|
+
alignItems: "flex-start",
|
|
277
|
+
gap: "8px",
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
<Typography
|
|
281
|
+
variant="pi"
|
|
282
|
+
textColor="success600"
|
|
283
|
+
style={{ marginBottom: "8px", fontWeight: "bold" }}
|
|
284
|
+
>
|
|
285
|
+
✓ Apple Pay token received. You can now process the
|
|
286
|
+
authorization:
|
|
287
|
+
</Typography>
|
|
288
|
+
<Button
|
|
289
|
+
variant="default"
|
|
290
|
+
onClick={() =>
|
|
291
|
+
paymentActions.handleAuthorization(
|
|
292
|
+
paymentActions.paymentState.applePayToken
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
loading={paymentActions.isProcessingPayment}
|
|
296
|
+
startIcon={<Play />}
|
|
297
|
+
style={{ maxWidth: "200px" }}
|
|
298
|
+
disabled={
|
|
299
|
+
!paymentActions.paymentState.paymentAmount.trim() ||
|
|
300
|
+
!paymentActions.paymentState.authReference.trim()
|
|
301
|
+
}
|
|
302
|
+
>
|
|
303
|
+
{t("auth.submit", "Authorize")}
|
|
304
|
+
</Button>
|
|
305
|
+
</Box>
|
|
306
|
+
)}
|
|
307
|
+
</Box>
|
|
308
|
+
) : (
|
|
309
|
+
<Button
|
|
310
|
+
variant="default"
|
|
311
|
+
onClick={paymentActions.handleAuthorization}
|
|
312
|
+
loading={paymentActions.isProcessingPayment}
|
|
313
|
+
startIcon={<Play />}
|
|
314
|
+
style={{ maxWidth: "200px" }}
|
|
315
|
+
disabled={
|
|
316
|
+
!paymentActions.paymentState.paymentAmount.trim() ||
|
|
317
|
+
(paymentActions.paymentState.paymentMethod === "cc" &&
|
|
318
|
+
settings?.settings?.enable3DSecure !== false &&
|
|
319
|
+
(!paymentActions.paymentState.cardtype ||
|
|
320
|
+
!paymentActions.paymentState.cardpan ||
|
|
321
|
+
!paymentActions.paymentState.cardexpiredate ||
|
|
322
|
+
!paymentActions.paymentState.cardcvc2)) ||
|
|
323
|
+
(paymentActions.paymentState.paymentMethod === "apl" &&
|
|
324
|
+
!paymentActions.paymentState.applePayToken)
|
|
325
|
+
}
|
|
326
|
+
>
|
|
327
|
+
{t("auth.submit", "Authorize")}
|
|
328
|
+
</Button>
|
|
329
|
+
)}
|
|
330
|
+
</Flex>
|
|
331
|
+
);
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export default AuthorizationForm;
|