strapi-plugin-payone-provider 1.6.7 → 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 -156
- 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 +27 -16
- 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 -67
- 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 +109 -47
- 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 +7 -12
- 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 +61 -32
- 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/HistoryPanel.jsx +0 -312
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
- 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,280 @@
|
|
|
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 CardDetailsInput from "./CardDetailsInput";
|
|
6
|
+
import RenderInput from "../RenderInput";
|
|
7
|
+
import {
|
|
8
|
+
getSalutationOptions,
|
|
9
|
+
getGenderOptions,
|
|
10
|
+
getCurrencyOptions,
|
|
11
|
+
getCountryOptions,
|
|
12
|
+
} from "../../../utils/countryLanguageUtils";
|
|
13
|
+
|
|
14
|
+
const PreauthorizationForm = ({ paymentActions, settings }) => {
|
|
15
|
+
const handleGooglePayToken = (token) => {
|
|
16
|
+
if (!token) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
paymentActions.handleFieldChange("googlePayToken", token);
|
|
20
|
+
paymentActions.handlePreauthorization(token);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const handleGooglePayError = (error) => {
|
|
24
|
+
console.error("Google Pay error:", error);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const countryOptions = getCountryOptions(
|
|
28
|
+
paymentActions.paymentState.paymentMethod
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const salutationOptions = getSalutationOptions(
|
|
32
|
+
paymentActions.paymentState.country || "US"
|
|
33
|
+
);
|
|
34
|
+
const genderOptions = getGenderOptions(
|
|
35
|
+
paymentActions.paymentState.country || "US"
|
|
36
|
+
);
|
|
37
|
+
const currencyOptions = getCurrencyOptions();
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
41
|
+
<Flex direction="row" gap={2}>
|
|
42
|
+
<Typography
|
|
43
|
+
variant="omega"
|
|
44
|
+
fontWeight="semiBold"
|
|
45
|
+
textColor="neutral800"
|
|
46
|
+
className="payment-form-title"
|
|
47
|
+
>
|
|
48
|
+
Preauthorization
|
|
49
|
+
</Typography>
|
|
50
|
+
<Typography
|
|
51
|
+
variant="pi"
|
|
52
|
+
textColor="neutral600"
|
|
53
|
+
className="payment-form-description"
|
|
54
|
+
>
|
|
55
|
+
Reserve an amount on a credit card without capturing it immediately.
|
|
56
|
+
</Typography>
|
|
57
|
+
</Flex>
|
|
58
|
+
|
|
59
|
+
<Box
|
|
60
|
+
style={{
|
|
61
|
+
display: "grid",
|
|
62
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
63
|
+
gap: "16px",
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<RenderInput
|
|
67
|
+
name="paymentAmount"
|
|
68
|
+
label="Amount *"
|
|
69
|
+
value={paymentActions.paymentState.paymentAmount || ""}
|
|
70
|
+
onChange={(e) =>
|
|
71
|
+
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
72
|
+
}
|
|
73
|
+
inputType="textInput"
|
|
74
|
+
placeholder="Enter amount (e.g., 1000 for €10.00)"
|
|
75
|
+
required
|
|
76
|
+
tooltipContent="Amount in cents (e.g., 1000 = €10.00)"
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<RenderInput
|
|
80
|
+
name="firstname"
|
|
81
|
+
label="First Name"
|
|
82
|
+
value={paymentActions.paymentState.firstname || ""}
|
|
83
|
+
onChange={(e) =>
|
|
84
|
+
paymentActions.handleFieldChange("firstname", e.target.value)
|
|
85
|
+
}
|
|
86
|
+
inputType="textInput"
|
|
87
|
+
placeholder="John"
|
|
88
|
+
tooltipContent="Customer first name"
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<RenderInput
|
|
92
|
+
name="lastname"
|
|
93
|
+
label="Last Name"
|
|
94
|
+
value={paymentActions.paymentState.lastname || ""}
|
|
95
|
+
onChange={(e) =>
|
|
96
|
+
paymentActions.handleFieldChange("lastname", e.target.value)
|
|
97
|
+
}
|
|
98
|
+
inputType="textInput"
|
|
99
|
+
placeholder="Doe"
|
|
100
|
+
tooltipContent="Customer last name"
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<RenderInput
|
|
104
|
+
name="email"
|
|
105
|
+
label="Email"
|
|
106
|
+
value={paymentActions.paymentState.email || ""}
|
|
107
|
+
onChange={(e) =>
|
|
108
|
+
paymentActions.handleFieldChange("email", e.target.value)
|
|
109
|
+
}
|
|
110
|
+
inputType="textInput"
|
|
111
|
+
placeholder="john.doe@example.com"
|
|
112
|
+
tooltipContent="Customer email address"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<RenderInput
|
|
116
|
+
name="telephonenumber"
|
|
117
|
+
label="Phone Number"
|
|
118
|
+
value={paymentActions.paymentState.telephonenumber || ""}
|
|
119
|
+
onChange={(e) =>
|
|
120
|
+
paymentActions.handleFieldChange("telephonenumber", e.target.value)
|
|
121
|
+
}
|
|
122
|
+
inputType="textInput"
|
|
123
|
+
placeholder="+4917512345678"
|
|
124
|
+
tooltipContent="Customer phone number"
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<RenderInput
|
|
128
|
+
name="gender"
|
|
129
|
+
label="Gender"
|
|
130
|
+
value={paymentActions.paymentState.gender || ""}
|
|
131
|
+
onChange={(e) =>
|
|
132
|
+
paymentActions.handleFieldChange("gender", e.target.value)
|
|
133
|
+
}
|
|
134
|
+
inputType="select"
|
|
135
|
+
options={genderOptions}
|
|
136
|
+
placeholder="Select gender"
|
|
137
|
+
tooltipContent="Customer gender"
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<RenderInput
|
|
141
|
+
name="salutation"
|
|
142
|
+
label="Salutation"
|
|
143
|
+
value={paymentActions.paymentState.salutation || ""}
|
|
144
|
+
onChange={(e) =>
|
|
145
|
+
paymentActions.handleFieldChange("salutation", e.target.value)
|
|
146
|
+
}
|
|
147
|
+
inputType="select"
|
|
148
|
+
options={salutationOptions}
|
|
149
|
+
placeholder="Select salutation"
|
|
150
|
+
tooltipContent="Customer salutation"
|
|
151
|
+
/>
|
|
152
|
+
|
|
153
|
+
<RenderInput
|
|
154
|
+
name="country"
|
|
155
|
+
label="Country"
|
|
156
|
+
value={paymentActions.paymentState.country || ""}
|
|
157
|
+
onChange={(e) =>
|
|
158
|
+
paymentActions.handleFieldChange("country", e.target.value)
|
|
159
|
+
}
|
|
160
|
+
inputType="select"
|
|
161
|
+
options={countryOptions}
|
|
162
|
+
placeholder="Select country"
|
|
163
|
+
tooltipContent="Billing address country"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<RenderInput
|
|
167
|
+
name="currency"
|
|
168
|
+
label="Currency"
|
|
169
|
+
value={paymentActions.paymentState.currency || "EUR"}
|
|
170
|
+
onChange={(e) =>
|
|
171
|
+
paymentActions.handleFieldChange("currency", e.target.value)
|
|
172
|
+
}
|
|
173
|
+
inputType="select"
|
|
174
|
+
options={currencyOptions}
|
|
175
|
+
placeholder="Select currency"
|
|
176
|
+
tooltipContent="Currency code"
|
|
177
|
+
/>
|
|
178
|
+
|
|
179
|
+
<RenderInput
|
|
180
|
+
name="city"
|
|
181
|
+
label="City"
|
|
182
|
+
value={paymentActions.paymentState.city || ""}
|
|
183
|
+
onChange={(e) =>
|
|
184
|
+
paymentActions.handleFieldChange("city", e.target.value)
|
|
185
|
+
}
|
|
186
|
+
inputType="textInput"
|
|
187
|
+
placeholder="Berlin"
|
|
188
|
+
tooltipContent="Billing address city"
|
|
189
|
+
/>
|
|
190
|
+
|
|
191
|
+
<RenderInput
|
|
192
|
+
name="street"
|
|
193
|
+
label="Street"
|
|
194
|
+
value={paymentActions.paymentState.street || ""}
|
|
195
|
+
onChange={(e) =>
|
|
196
|
+
paymentActions.handleFieldChange("street", e.target.value)
|
|
197
|
+
}
|
|
198
|
+
inputType="textInput"
|
|
199
|
+
placeholder="Main Street 123"
|
|
200
|
+
tooltipContent="Billing address street"
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
<RenderInput
|
|
204
|
+
name="zip"
|
|
205
|
+
label="ZIP Code"
|
|
206
|
+
value={paymentActions.paymentState.zip || ""}
|
|
207
|
+
onChange={(e) =>
|
|
208
|
+
paymentActions.handleFieldChange("zip", e.target.value)
|
|
209
|
+
}
|
|
210
|
+
inputType="textInput"
|
|
211
|
+
placeholder="12345"
|
|
212
|
+
tooltipContent="Billing address ZIP code"
|
|
213
|
+
/>
|
|
214
|
+
</Box>
|
|
215
|
+
|
|
216
|
+
{paymentActions.paymentState.paymentMethod === "cc" &&
|
|
217
|
+
settings?.settings?.enable3DSecure && (
|
|
218
|
+
<Box marginTop={4}>
|
|
219
|
+
<CardDetailsInput
|
|
220
|
+
cardtype={paymentActions.paymentState.cardtype}
|
|
221
|
+
setCardtype={(value) =>
|
|
222
|
+
paymentActions.handleFieldChange("cardtype", value)
|
|
223
|
+
}
|
|
224
|
+
cardpan={paymentActions.paymentState.cardpan}
|
|
225
|
+
setCardpan={(value) =>
|
|
226
|
+
paymentActions.handleFieldChange("cardpan", value)
|
|
227
|
+
}
|
|
228
|
+
cardexpiredate={paymentActions.paymentState.cardexpiredate}
|
|
229
|
+
setCardexpiredate={(value) =>
|
|
230
|
+
paymentActions.handleFieldChange("cardexpiredate", value)
|
|
231
|
+
}
|
|
232
|
+
cardcvc2={paymentActions.paymentState.cardcvc2}
|
|
233
|
+
setCardcvc2={(value) =>
|
|
234
|
+
paymentActions.handleFieldChange("cardcvc2", value)
|
|
235
|
+
}
|
|
236
|
+
/>
|
|
237
|
+
</Box>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
{paymentActions.paymentState.paymentMethod === "gpp" ? (
|
|
241
|
+
<GooglePayButton
|
|
242
|
+
amount={paymentActions.paymentState.paymentAmount}
|
|
243
|
+
currency="EUR"
|
|
244
|
+
onTokenReceived={handleGooglePayToken}
|
|
245
|
+
onError={handleGooglePayError}
|
|
246
|
+
settings={settings?.settings}
|
|
247
|
+
/>
|
|
248
|
+
) : paymentActions.paymentState.paymentMethod === "apl" ? (
|
|
249
|
+
<Box>
|
|
250
|
+
<Typography variant="pi" textColor="neutral600">
|
|
251
|
+
Apple Pay is only supported for Authorization, not Preauthorization.
|
|
252
|
+
</Typography>
|
|
253
|
+
</Box>
|
|
254
|
+
) : (
|
|
255
|
+
<Button
|
|
256
|
+
variant="default"
|
|
257
|
+
onClick={() => paymentActions.handlePreauthorization()}
|
|
258
|
+
loading={paymentActions.isProcessingPayment}
|
|
259
|
+
startIcon={<Play />}
|
|
260
|
+
style={{ maxWidth: "200px" }}
|
|
261
|
+
className="payment-button payment-button-primary"
|
|
262
|
+
disabled={
|
|
263
|
+
!paymentActions.paymentState.paymentAmount.trim() ||
|
|
264
|
+
(paymentActions.paymentState.paymentMethod === "cc" &&
|
|
265
|
+
settings?.settings?.enable3DSecure !== false &&
|
|
266
|
+
(!paymentActions.paymentState.cardtype ||
|
|
267
|
+
!paymentActions.paymentState.cardpan ||
|
|
268
|
+
!paymentActions.paymentState.cardexpiredate ||
|
|
269
|
+
!paymentActions.paymentState.cardcvc2)) ||
|
|
270
|
+
paymentActions.isLiveMode
|
|
271
|
+
}
|
|
272
|
+
>
|
|
273
|
+
Process Preauthorization
|
|
274
|
+
</Button>
|
|
275
|
+
)}
|
|
276
|
+
</Flex>
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export default PreauthorizationForm;
|
|
@@ -0,0 +1,121 @@
|
|
|
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 RefundForm = ({ 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
|
+
Refund
|
|
19
|
+
</Typography>
|
|
20
|
+
<Typography
|
|
21
|
+
variant="pi"
|
|
22
|
+
textColor="neutral600"
|
|
23
|
+
className="payment-form-description"
|
|
24
|
+
>
|
|
25
|
+
Refund a previously captured amount.
|
|
26
|
+
</Typography>
|
|
27
|
+
</Flex>
|
|
28
|
+
|
|
29
|
+
<Box
|
|
30
|
+
style={{
|
|
31
|
+
display: "grid",
|
|
32
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
33
|
+
gap: "16px",
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<RenderInput
|
|
37
|
+
name="refundTxid"
|
|
38
|
+
label="Transaction ID *"
|
|
39
|
+
value={paymentActions.paymentState.refundTxid || ""}
|
|
40
|
+
onChange={(e) =>
|
|
41
|
+
paymentActions.handleFieldChange("refundTxid", e.target.value)
|
|
42
|
+
}
|
|
43
|
+
inputType="textInput"
|
|
44
|
+
placeholder="Enter TxId from capture"
|
|
45
|
+
required
|
|
46
|
+
tooltipContent="Transaction ID from a previous capture"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<RenderInput
|
|
50
|
+
name="refundSequenceNumber"
|
|
51
|
+
label="Sequence Number"
|
|
52
|
+
value={paymentActions.paymentState.refundSequenceNumber || "2"}
|
|
53
|
+
onChange={(e) =>
|
|
54
|
+
paymentActions.handleFieldChange(
|
|
55
|
+
"refundSequenceNumber",
|
|
56
|
+
e.target.value
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
inputType="textInput"
|
|
60
|
+
placeholder="2"
|
|
61
|
+
tooltipContent="Sequence number for this refund (1-127), default is 2 for first refund"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<RenderInput
|
|
65
|
+
name="refundAmount"
|
|
66
|
+
label="Amount *"
|
|
67
|
+
value={paymentActions.paymentState.paymentAmount || ""}
|
|
68
|
+
onChange={(e) =>
|
|
69
|
+
paymentActions.handleFieldChange("paymentAmount", e.target.value)
|
|
70
|
+
}
|
|
71
|
+
inputType="textInput"
|
|
72
|
+
placeholder="1000"
|
|
73
|
+
required
|
|
74
|
+
tooltipContent="Amount in cents to refund (will be negative automatically)"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<RenderInput
|
|
78
|
+
name="refundCurrency"
|
|
79
|
+
label="Currency"
|
|
80
|
+
value={paymentActions.paymentState.refundCurrency || "EUR"}
|
|
81
|
+
onChange={(e) =>
|
|
82
|
+
paymentActions.handleFieldChange("refundCurrency", e.target.value)
|
|
83
|
+
}
|
|
84
|
+
inputType="select"
|
|
85
|
+
options={currencyOptions}
|
|
86
|
+
placeholder="EUR"
|
|
87
|
+
tooltipContent="Currency code (e.g., EUR, USD)"
|
|
88
|
+
/>
|
|
89
|
+
|
|
90
|
+
<RenderInput
|
|
91
|
+
name="refundReference"
|
|
92
|
+
label="Reference"
|
|
93
|
+
value={paymentActions.paymentState.refundReference || ""}
|
|
94
|
+
onChange={(e) =>
|
|
95
|
+
paymentActions.handleFieldChange("refundReference", e.target.value)
|
|
96
|
+
}
|
|
97
|
+
inputType="textInput"
|
|
98
|
+
placeholder="Optional reference"
|
|
99
|
+
tooltipContent="Optional reference for this refund"
|
|
100
|
+
/>
|
|
101
|
+
</Box>
|
|
102
|
+
|
|
103
|
+
<Button
|
|
104
|
+
variant="default"
|
|
105
|
+
onClick={() => paymentActions.handleRefund()}
|
|
106
|
+
loading={paymentActions.isProcessingPayment}
|
|
107
|
+
startIcon={<Play />}
|
|
108
|
+
style={{ maxWidth: "200px" }}
|
|
109
|
+
className="payment-button payment-button-primary"
|
|
110
|
+
disabled={
|
|
111
|
+
!paymentActions.paymentState.refundTxid.trim() ||
|
|
112
|
+
!paymentActions.paymentState.paymentAmount.trim()
|
|
113
|
+
}
|
|
114
|
+
>
|
|
115
|
+
Process Refund
|
|
116
|
+
</Button>
|
|
117
|
+
</Flex>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default RefundForm;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { Box, Button } from "@strapi/design-system";
|
|
2
|
+
import RenderInput from "../RenderInput";
|
|
3
|
+
import { ArrowsCounterClockwise } from "@strapi/icons";
|
|
4
|
+
|
|
5
|
+
const FiltersPanel = ({ filters, handleFiltersChange }) => {
|
|
6
|
+
const handleReset = () => {
|
|
7
|
+
handleFiltersChange({
|
|
8
|
+
search: "",
|
|
9
|
+
status: "",
|
|
10
|
+
request_type: "",
|
|
11
|
+
payment_method: "",
|
|
12
|
+
date_from: "",
|
|
13
|
+
date_to: "",
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const filterOptions = [
|
|
18
|
+
{
|
|
19
|
+
name: "search",
|
|
20
|
+
label: "Search",
|
|
21
|
+
type: "text",
|
|
22
|
+
inputType: "textInput",
|
|
23
|
+
placeholder: "Search by reference or transaction ID",
|
|
24
|
+
tooltipContent:
|
|
25
|
+
"Search by reference or transaction ID to filter transactions",
|
|
26
|
+
flex: 1,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "status",
|
|
30
|
+
label: "Status",
|
|
31
|
+
type: "enumeration",
|
|
32
|
+
inputType: "select",
|
|
33
|
+
placeholder: "All Statuses",
|
|
34
|
+
tooltipContent:
|
|
35
|
+
"Filter transactions by their status (Approved, Error, Redirect, Invalid, Pending, Cancelled)",
|
|
36
|
+
options: [
|
|
37
|
+
{ value: "", label: "All Statuses" },
|
|
38
|
+
{ value: "APPROVED", label: "Approved" },
|
|
39
|
+
{ value: "ERROR", label: "Error" },
|
|
40
|
+
{ value: "REDIRECT", label: "Redirect" },
|
|
41
|
+
{ value: "INVALID", label: "Invalid" },
|
|
42
|
+
{ value: "PENDING", label: "Pending" },
|
|
43
|
+
{ value: "CANCELLED", label: "Cancelled" },
|
|
44
|
+
],
|
|
45
|
+
flex: 1,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "request_type",
|
|
49
|
+
label: "Request Type",
|
|
50
|
+
type: "enumeration",
|
|
51
|
+
inputType: "select",
|
|
52
|
+
placeholder: "All Types",
|
|
53
|
+
tooltipContent:
|
|
54
|
+
"Filter transactions by request type (Preauthorization, Authorization, Capture, Refund)",
|
|
55
|
+
options: [
|
|
56
|
+
{ value: "", label: "All Types" },
|
|
57
|
+
{ value: "preauthorization", label: "Preauthorization" },
|
|
58
|
+
{ value: "authorization", label: "Authorization" },
|
|
59
|
+
{ value: "capture", label: "Capture" },
|
|
60
|
+
{ value: "refund", label: "Refund" },
|
|
61
|
+
],
|
|
62
|
+
flex: 1,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "payment_method",
|
|
66
|
+
label: "Payment Method",
|
|
67
|
+
type: "enumeration",
|
|
68
|
+
inputType: "select",
|
|
69
|
+
placeholder: "All Methods",
|
|
70
|
+
tooltipContent:
|
|
71
|
+
"Filter transactions by payment method (Credit Card, PayPal, Google Pay, Apple Pay, Sofort Banking, SEPA Direct Debit)",
|
|
72
|
+
options: [
|
|
73
|
+
{ value: "", label: "All Methods" },
|
|
74
|
+
{ value: "credit_card", label: "Credit Card" },
|
|
75
|
+
{ value: "paypal", label: "PayPal" },
|
|
76
|
+
{ value: "google_pay", label: "Google Pay" },
|
|
77
|
+
{ value: "apple_pay", label: "Apple Pay" },
|
|
78
|
+
{ value: "sofort", label: "Sofort Banking" },
|
|
79
|
+
{ value: "sepa", label: "SEPA Direct Debit" },
|
|
80
|
+
],
|
|
81
|
+
flex: 1,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Box
|
|
87
|
+
style={{
|
|
88
|
+
display: "grid",
|
|
89
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))",
|
|
90
|
+
gap: "16px",
|
|
91
|
+
alignItems: "end",
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{filterOptions.map((filter) => (
|
|
95
|
+
<RenderInput
|
|
96
|
+
key={filter.name}
|
|
97
|
+
name={filter.name}
|
|
98
|
+
value={filters[filter.name] || ""}
|
|
99
|
+
onChange={(e) => {
|
|
100
|
+
const value =
|
|
101
|
+
filter.inputType === "textInput"
|
|
102
|
+
? e.target.value
|
|
103
|
+
: e.target?.value || e;
|
|
104
|
+
handleFiltersChange({ [filter.name]: value });
|
|
105
|
+
}}
|
|
106
|
+
inputType={filter.inputType}
|
|
107
|
+
label={filter.label}
|
|
108
|
+
placeholder={filter.placeholder}
|
|
109
|
+
tooltipContent={filter.tooltipContent}
|
|
110
|
+
options={filter.options}
|
|
111
|
+
/>
|
|
112
|
+
))}
|
|
113
|
+
|
|
114
|
+
<RenderInput
|
|
115
|
+
name="date_from"
|
|
116
|
+
value={filters.date_from || ""}
|
|
117
|
+
onChange={(e) => handleFiltersChange({ date_from: e.target.value })}
|
|
118
|
+
inputType="dateInput"
|
|
119
|
+
label="Date From"
|
|
120
|
+
tooltipContent="Filter transactions from this date onwards. Select the starting date for the date range filter."
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
<RenderInput
|
|
124
|
+
name="date_to"
|
|
125
|
+
value={filters.date_to || ""}
|
|
126
|
+
onChange={(e) => handleFiltersChange({ date_to: e.target.value })}
|
|
127
|
+
inputType="dateInput"
|
|
128
|
+
label="Date To"
|
|
129
|
+
tooltipContent="Filter transactions up to this date. Select the ending date for the date range filter."
|
|
130
|
+
/>
|
|
131
|
+
|
|
132
|
+
<Button
|
|
133
|
+
variant="secondary"
|
|
134
|
+
onClick={handleReset}
|
|
135
|
+
startIcon={<ArrowsCounterClockwise />}
|
|
136
|
+
size="S"
|
|
137
|
+
maxWidth="100px"
|
|
138
|
+
>
|
|
139
|
+
Reset
|
|
140
|
+
</Button>
|
|
141
|
+
</Box>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export default FiltersPanel;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Box, Flex, Typography, Divider } from "@strapi/design-system";
|
|
3
|
+
import TransactionTable from "./TransactionTable";
|
|
4
|
+
|
|
5
|
+
const HistoryPanel = () => {
|
|
6
|
+
return (
|
|
7
|
+
<Box
|
|
8
|
+
className="payment-container"
|
|
9
|
+
paddingTop={8}
|
|
10
|
+
paddingBottom={8}
|
|
11
|
+
paddingLeft={8}
|
|
12
|
+
paddingRight={8}
|
|
13
|
+
>
|
|
14
|
+
<Flex direction="column" alignItems="stretch" gap={8}>
|
|
15
|
+
<Box>
|
|
16
|
+
<Typography
|
|
17
|
+
variant="beta"
|
|
18
|
+
as="h2"
|
|
19
|
+
className="payment-title"
|
|
20
|
+
style={{ fontSize: "20px", marginBottom: "4px" }}
|
|
21
|
+
>
|
|
22
|
+
Transaction Management
|
|
23
|
+
</Typography>
|
|
24
|
+
<Typography
|
|
25
|
+
variant="pi"
|
|
26
|
+
textColor="neutral600"
|
|
27
|
+
className="payment-subtitle"
|
|
28
|
+
style={{ fontSize: "14px", marginTop: "4px" }}
|
|
29
|
+
>
|
|
30
|
+
View and filter all payment transactions processed through Payone
|
|
31
|
+
</Typography>
|
|
32
|
+
</Box>
|
|
33
|
+
|
|
34
|
+
<Divider />
|
|
35
|
+
|
|
36
|
+
<TransactionTable />
|
|
37
|
+
|
|
38
|
+
<Box paddingTop={4}>
|
|
39
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
40
|
+
Note: This shows all Payone transactions processed through this
|
|
41
|
+
plugin. Transactions are automatically logged with detailed
|
|
42
|
+
request/response data.
|
|
43
|
+
</Typography>
|
|
44
|
+
</Box>
|
|
45
|
+
</Flex>
|
|
46
|
+
</Box>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default HistoryPanel;
|