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