strapi-plugin-payone-provider 1.6.5 → 1.6.7
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/.well-known/.gitkeep +3 -0
- package/.well-known/apple-developer-merchant-id-domain-association.txt +1 -0
- package/admin/src/pages/App/components/AppTabs.jsx +31 -16
- package/admin/src/pages/App/components/ApplePayBtn.jsx +63 -28
- package/admin/src/pages/App/components/ConfigurationPanel.jsx +189 -10
- package/admin/src/pages/App/components/DocsPanel.jsx +864 -194
- package/admin/src/pages/App/components/HistoryPanel.jsx +73 -46
- package/admin/src/pages/App/components/PaymentActionsPanel.jsx +8 -2
- package/admin/src/pages/App/components/TransactionHistoryItem.jsx +232 -87
- package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +45 -1
- package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +74 -30
- package/admin/src/pages/App/index.jsx +1 -0
- package/admin/src/pages/hooks/usePaymentActions.js +4 -0
- package/admin/src/pages/hooks/useSettings.js +26 -1
- package/admin/src/pages/hooks/useTransactionHistory.js +2 -3
- package/admin/src/pages/utils/paymentUtils.js +64 -6
- package/package.json +1 -1
- package/server/bootstrap.js +9 -3
- package/server/controllers/payone.js +14 -1
- package/server/services/applePayService.js +103 -93
- package/server/services/paymentService.js +56 -13
- package/server/services/transactionService.js +37 -14
- package/server/utils/paymentMethodParams.js +89 -19
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Flex,
|
|
8
8
|
Stack,
|
|
9
9
|
Typography,
|
|
10
|
-
Alert
|
|
10
|
+
Alert,
|
|
11
11
|
} from "@strapi/design-system";
|
|
12
12
|
import StatusBadge from "../StatusBadge";
|
|
13
13
|
import { formatTransactionData } from "../../../utils/formatTransactionData";
|
|
@@ -18,19 +18,24 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const status = paymentResult?.status || paymentResult?.Status || "";
|
|
21
|
-
const errorCode =
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const errorCode =
|
|
22
|
+
paymentResult?.errorcode ||
|
|
23
|
+
paymentResult?.errorCode ||
|
|
24
|
+
paymentResult?.ErrorCode;
|
|
25
|
+
const errorMessage =
|
|
26
|
+
paymentResult?.errormessage ||
|
|
27
|
+
paymentResult?.errorMessage ||
|
|
28
|
+
paymentResult?.ErrorMessage;
|
|
29
|
+
const customerMessage =
|
|
30
|
+
paymentResult?.customermessage ||
|
|
31
|
+
paymentResult?.customerMessage ||
|
|
32
|
+
paymentResult?.CustomerMessage;
|
|
24
33
|
const isError = status === "ERROR" || status === "INVALID" || errorCode;
|
|
25
34
|
|
|
26
35
|
return (
|
|
27
36
|
<>
|
|
28
37
|
{paymentError && (
|
|
29
|
-
<Alert
|
|
30
|
-
variant="danger"
|
|
31
|
-
title="Error"
|
|
32
|
-
className="payment-alert"
|
|
33
|
-
>
|
|
38
|
+
<Alert variant="danger" title="Error" className="payment-alert">
|
|
34
39
|
{paymentError}
|
|
35
40
|
</Alert>
|
|
36
41
|
)}
|
|
@@ -40,7 +45,11 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
40
45
|
<CardBody>
|
|
41
46
|
<Stack spacing={4}>
|
|
42
47
|
<Flex justifyContent="space-between" alignItems="center">
|
|
43
|
-
<Typography
|
|
48
|
+
<Typography
|
|
49
|
+
variant="delta"
|
|
50
|
+
as="h3"
|
|
51
|
+
className="payment-section-title"
|
|
52
|
+
>
|
|
44
53
|
Payment Result
|
|
45
54
|
</Typography>
|
|
46
55
|
{(status || paymentResult.Status) && (
|
|
@@ -48,7 +57,7 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
48
57
|
)}
|
|
49
58
|
</Flex>
|
|
50
59
|
|
|
51
|
-
<hr className="payment-divider" style={{ margin:
|
|
60
|
+
<hr className="payment-divider" style={{ margin: "16px 0" }} />
|
|
52
61
|
|
|
53
62
|
{/* Show error information prominently if error */}
|
|
54
63
|
{isError && (
|
|
@@ -74,7 +83,11 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
74
83
|
)}
|
|
75
84
|
|
|
76
85
|
<Box>
|
|
77
|
-
<Typography
|
|
86
|
+
<Typography
|
|
87
|
+
variant="omega"
|
|
88
|
+
fontWeight="semiBold"
|
|
89
|
+
marginBottom={2}
|
|
90
|
+
>
|
|
78
91
|
Full Response Details:
|
|
79
92
|
</Typography>
|
|
80
93
|
<Stack spacing={3}>
|
|
@@ -84,14 +97,18 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
84
97
|
justifyContent="space-between"
|
|
85
98
|
alignItems="start"
|
|
86
99
|
style={{
|
|
87
|
-
padding:
|
|
88
|
-
borderBottom:
|
|
100
|
+
padding: "8px 0",
|
|
101
|
+
borderBottom:
|
|
102
|
+
index <
|
|
103
|
+
formatTransactionData(paymentResult).length - 1
|
|
104
|
+
? "1px solid #e8e8ea"
|
|
105
|
+
: "none",
|
|
89
106
|
}}
|
|
90
107
|
>
|
|
91
108
|
<Typography
|
|
92
109
|
variant="pi"
|
|
93
110
|
textColor="neutral600"
|
|
94
|
-
style={{ minWidth: "200px", fontWeight:
|
|
111
|
+
style={{ minWidth: "200px", fontWeight: "500" }}
|
|
95
112
|
>
|
|
96
113
|
{item.key}:
|
|
97
114
|
</Typography>
|
|
@@ -100,10 +117,14 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
100
117
|
style={{
|
|
101
118
|
flex: 1,
|
|
102
119
|
textAlign: "right",
|
|
103
|
-
fontWeight:
|
|
104
|
-
wordBreak:
|
|
105
|
-
fontFamily: item.key.toLowerCase().includes(
|
|
106
|
-
|
|
120
|
+
fontWeight: "400",
|
|
121
|
+
wordBreak: "break-word",
|
|
122
|
+
fontFamily: item.key.toLowerCase().includes("raw")
|
|
123
|
+
? "monospace"
|
|
124
|
+
: "inherit",
|
|
125
|
+
fontSize: item.key.toLowerCase().includes("raw")
|
|
126
|
+
? "11px"
|
|
127
|
+
: "inherit",
|
|
107
128
|
}}
|
|
108
129
|
>
|
|
109
130
|
{item.value}
|
|
@@ -115,27 +136,51 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
115
136
|
|
|
116
137
|
{/* 3DS Required Warning */}
|
|
117
138
|
{paymentResult?.is3DSRequired && !paymentResult?.redirectUrl && (
|
|
118
|
-
<Alert
|
|
139
|
+
<Alert
|
|
140
|
+
variant="warning"
|
|
141
|
+
title="3D Secure Authentication Required"
|
|
142
|
+
>
|
|
119
143
|
<Stack spacing={2}>
|
|
120
144
|
<Typography variant="pi">
|
|
121
|
-
Payone requires 3D Secure authentication, but no redirect
|
|
145
|
+
Payone requires 3D Secure authentication, but no redirect
|
|
146
|
+
URL was provided in the response.
|
|
122
147
|
</Typography>
|
|
123
148
|
<Typography variant="pi" fontWeight="semiBold">
|
|
124
149
|
Possible solutions:
|
|
125
150
|
</Typography>
|
|
126
|
-
<Typography
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
151
|
+
<Typography
|
|
152
|
+
variant="pi"
|
|
153
|
+
component="ul"
|
|
154
|
+
style={{ marginLeft: "20px" }}
|
|
155
|
+
>
|
|
156
|
+
<li>
|
|
157
|
+
Check Payone portal configuration for 3DS settings
|
|
158
|
+
</li>
|
|
159
|
+
<li>
|
|
160
|
+
Verify that redirect URLs (successurl, errorurl,
|
|
161
|
+
backurl) are properly configured
|
|
162
|
+
</li>
|
|
163
|
+
<li>
|
|
164
|
+
Ensure you're using test mode with proper test
|
|
165
|
+
credentials
|
|
166
|
+
</li>
|
|
167
|
+
<li>
|
|
168
|
+
Check if 3dscheck request is needed before authorization
|
|
169
|
+
</li>
|
|
131
170
|
</Typography>
|
|
132
|
-
<Typography
|
|
133
|
-
|
|
171
|
+
<Typography
|
|
172
|
+
variant="pi"
|
|
173
|
+
textColor="neutral600"
|
|
174
|
+
marginTop={2}
|
|
175
|
+
>
|
|
176
|
+
<strong>Error Code:</strong>{" "}
|
|
177
|
+
{paymentResult?.errorCode ||
|
|
178
|
+
paymentResult?.ErrorCode ||
|
|
179
|
+
"4219"}
|
|
134
180
|
</Typography>
|
|
135
181
|
</Stack>
|
|
136
182
|
</Alert>
|
|
137
183
|
)}
|
|
138
|
-
|
|
139
184
|
</Stack>
|
|
140
185
|
</CardBody>
|
|
141
186
|
</Card>
|
|
@@ -145,4 +190,3 @@ const PaymentResult = ({ paymentError, paymentResult }) => {
|
|
|
145
190
|
};
|
|
146
191
|
|
|
147
192
|
export default PaymentResult;
|
|
148
|
-
|
|
@@ -110,6 +110,7 @@ const App = () => {
|
|
|
110
110
|
onSave={settings.handleSave}
|
|
111
111
|
onTestConnection={settings.handleTestConnection}
|
|
112
112
|
onInputChange={settings.handleInputChange}
|
|
113
|
+
onPaymentMethodToggle={settings.handlePaymentMethodToggle}
|
|
113
114
|
filters={transactionHistory.filters}
|
|
114
115
|
onFilterChange={transactionHistory.handleFilterChange}
|
|
115
116
|
onFilterApply={transactionHistory.handleFilterApply}
|
|
@@ -92,6 +92,8 @@ const usePaymentActions = () => {
|
|
|
92
92
|
currency: currency,
|
|
93
93
|
reference: finalPreauthReference,
|
|
94
94
|
enable3DSecure: settings.enable3DSecure !== false,
|
|
95
|
+
invoiceid: finalPreauthReference,
|
|
96
|
+
narrative_text: "Preauthorization for order " + finalPreauthReference,
|
|
95
97
|
...DEFAULT_PAYMENT_DATA
|
|
96
98
|
};
|
|
97
99
|
|
|
@@ -215,6 +217,8 @@ const usePaymentActions = () => {
|
|
|
215
217
|
currency: currency,
|
|
216
218
|
reference: finalAuthReference,
|
|
217
219
|
enable3DSecure: settings.enable3DSecure !== false,
|
|
220
|
+
invoiceid: finalAuthReference,
|
|
221
|
+
narrative_text: "Authorization for order " + finalAuthReference,
|
|
218
222
|
...DEFAULT_PAYMENT_DATA
|
|
219
223
|
};
|
|
220
224
|
|
|
@@ -41,6 +41,31 @@ const useSettings = () => {
|
|
|
41
41
|
setSettings((prev) => ({ ...prev, [field]: value }));
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
const handlePaymentMethodToggle = async (field, value) => {
|
|
45
|
+
let updatedSettings;
|
|
46
|
+
setSettings((prev) => {
|
|
47
|
+
updatedSettings = { ...prev, [field]: value };
|
|
48
|
+
return updatedSettings;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
setIsSaving(true);
|
|
52
|
+
try {
|
|
53
|
+
await payoneRequests.updateSettings(updatedSettings);
|
|
54
|
+
toggleNotification({
|
|
55
|
+
type: "success",
|
|
56
|
+
message: "Payment method updated successfully"
|
|
57
|
+
});
|
|
58
|
+
} catch (error) {
|
|
59
|
+
setSettings((prev) => ({ ...prev, [field]: !value }));
|
|
60
|
+
toggleNotification({
|
|
61
|
+
type: "warning",
|
|
62
|
+
message: "Failed to update payment method"
|
|
63
|
+
});
|
|
64
|
+
} finally {
|
|
65
|
+
setIsSaving(false);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
44
69
|
const handleSave = async () => {
|
|
45
70
|
setIsSaving(true);
|
|
46
71
|
try {
|
|
@@ -49,7 +74,6 @@ const useSettings = () => {
|
|
|
49
74
|
type: "success",
|
|
50
75
|
message: "Settings saved successfully"
|
|
51
76
|
});
|
|
52
|
-
// Reload settings after save to ensure consistency
|
|
53
77
|
await loadSettings();
|
|
54
78
|
} catch (error) {
|
|
55
79
|
toggleNotification({
|
|
@@ -104,6 +128,7 @@ const useSettings = () => {
|
|
|
104
128
|
isTesting,
|
|
105
129
|
testResult,
|
|
106
130
|
handleInputChange,
|
|
131
|
+
handlePaymentMethodToggle,
|
|
107
132
|
handleSave,
|
|
108
133
|
handleTestConnection
|
|
109
134
|
};
|
|
@@ -11,10 +11,9 @@ const useTransactionHistory = () => {
|
|
|
11
11
|
const [selectedTransaction, setSelectedTransaction] = useState(null);
|
|
12
12
|
const [currentPage, setCurrentPage] = useState(1);
|
|
13
13
|
const [filters, setFilters] = useState({
|
|
14
|
-
|
|
14
|
+
search: "",
|
|
15
15
|
request_type: "",
|
|
16
|
-
|
|
17
|
-
reference: "",
|
|
16
|
+
payment_method: "",
|
|
18
17
|
date_from: "",
|
|
19
18
|
date_to: ""
|
|
20
19
|
});
|
|
@@ -88,13 +88,11 @@ export const getBaseParams = (options = {}) => {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return {
|
|
91
|
-
// Required core parameters (Payone v1)
|
|
92
91
|
amount: parseInt(amount),
|
|
93
92
|
currency: currency.toUpperCase(),
|
|
94
93
|
reference: reference || `REF-${Date.now()}`,
|
|
95
94
|
customerid: finalCustomerId,
|
|
96
95
|
|
|
97
|
-
// Customer information (required for preauthorization/authorization)
|
|
98
96
|
firstname,
|
|
99
97
|
lastname,
|
|
100
98
|
street,
|
|
@@ -249,13 +247,43 @@ export const getPreauthorizationParams = (paymentMethod, options = {}) => {
|
|
|
249
247
|
const baseParams = getBaseParams(options);
|
|
250
248
|
const methodParams = getPaymentMethodParams(paymentMethod, options);
|
|
251
249
|
|
|
250
|
+
const {
|
|
251
|
+
amount,
|
|
252
|
+
currency,
|
|
253
|
+
reference,
|
|
254
|
+
customerid,
|
|
255
|
+
firstname,
|
|
256
|
+
lastname,
|
|
257
|
+
street,
|
|
258
|
+
zip,
|
|
259
|
+
city,
|
|
260
|
+
country,
|
|
261
|
+
email,
|
|
262
|
+
salutation,
|
|
263
|
+
gender,
|
|
264
|
+
telephonenumber,
|
|
265
|
+
ip,
|
|
266
|
+
customer_is_present,
|
|
267
|
+
language,
|
|
268
|
+
successurl,
|
|
269
|
+
errorurl,
|
|
270
|
+
backurl,
|
|
271
|
+
enable3DSecure,
|
|
272
|
+
ecommercemode,
|
|
273
|
+
cardtype,
|
|
274
|
+
cardpan,
|
|
275
|
+
cardexpiredate,
|
|
276
|
+
cardcvc2,
|
|
277
|
+
...additionalParams
|
|
278
|
+
} = options;
|
|
279
|
+
|
|
252
280
|
const params = {
|
|
253
281
|
...baseParams,
|
|
254
282
|
...methodParams,
|
|
255
|
-
|
|
283
|
+
...additionalParams,
|
|
284
|
+
request: "preauthorization"
|
|
256
285
|
};
|
|
257
286
|
|
|
258
|
-
// Add 3D Secure parameters for credit card payments if enabled
|
|
259
287
|
if (paymentMethod === "cc" && options.enable3DSecure !== false) {
|
|
260
288
|
params["3dsecure"] = "yes";
|
|
261
289
|
params.ecommercemode = options.ecommercemode || "internet";
|
|
@@ -269,13 +297,43 @@ export const getAuthorizationParams = (paymentMethod, options = {}) => {
|
|
|
269
297
|
const baseParams = getBaseParams(options);
|
|
270
298
|
const methodParams = getPaymentMethodParams(paymentMethod, options);
|
|
271
299
|
|
|
300
|
+
const {
|
|
301
|
+
amount,
|
|
302
|
+
currency,
|
|
303
|
+
reference,
|
|
304
|
+
customerid,
|
|
305
|
+
firstname,
|
|
306
|
+
lastname,
|
|
307
|
+
street,
|
|
308
|
+
zip,
|
|
309
|
+
city,
|
|
310
|
+
country,
|
|
311
|
+
email,
|
|
312
|
+
salutation,
|
|
313
|
+
gender,
|
|
314
|
+
telephonenumber,
|
|
315
|
+
ip,
|
|
316
|
+
customer_is_present,
|
|
317
|
+
language,
|
|
318
|
+
successurl,
|
|
319
|
+
errorurl,
|
|
320
|
+
backurl,
|
|
321
|
+
enable3DSecure,
|
|
322
|
+
ecommercemode,
|
|
323
|
+
cardtype,
|
|
324
|
+
cardpan,
|
|
325
|
+
cardexpiredate,
|
|
326
|
+
cardcvc2,
|
|
327
|
+
...additionalParams
|
|
328
|
+
} = options;
|
|
329
|
+
|
|
272
330
|
const params = {
|
|
273
331
|
...baseParams,
|
|
274
332
|
...methodParams,
|
|
275
|
-
|
|
333
|
+
...additionalParams,
|
|
334
|
+
request: "authorization"
|
|
276
335
|
};
|
|
277
336
|
|
|
278
|
-
// Add 3D Secure parameters for credit card payments if enabled
|
|
279
337
|
if (paymentMethod === "cc" && options.enable3DSecure !== false) {
|
|
280
338
|
params["3dsecure"] = "yes";
|
|
281
339
|
params.ecommercemode = options.ecommercemode || "internet";
|
package/package.json
CHANGED
package/server/bootstrap.js
CHANGED
|
@@ -21,7 +21,13 @@ module.exports = async ({ strapi }) => {
|
|
|
21
21
|
merchantName: "",
|
|
22
22
|
displayName: "",
|
|
23
23
|
domainName: "",
|
|
24
|
-
merchantIdentifier: ""
|
|
24
|
+
merchantIdentifier: "",
|
|
25
|
+
enableCreditCard: true,
|
|
26
|
+
enablePayPal: true,
|
|
27
|
+
enableGooglePay: true,
|
|
28
|
+
enableApplePay: true,
|
|
29
|
+
enableSofort: true,
|
|
30
|
+
enableSepaDirectDebit: true
|
|
25
31
|
}
|
|
26
32
|
});
|
|
27
33
|
}
|
|
@@ -56,8 +62,8 @@ module.exports = async ({ strapi }) => {
|
|
|
56
62
|
|
|
57
63
|
router.get('/.well-known/apple-developer-merchantid-domain-association', async (ctx) => {
|
|
58
64
|
try {
|
|
59
|
-
const
|
|
60
|
-
const wellKnownPath = path.join(
|
|
65
|
+
const pluginRoot = path.resolve(__dirname, '..');
|
|
66
|
+
const wellKnownPath = path.join(pluginRoot, '.well-known');
|
|
61
67
|
const possiblePaths = [
|
|
62
68
|
path.join(wellKnownPath, 'apple-developer-merchantid-domain-association'),
|
|
63
69
|
path.join(wellKnownPath, 'apple-developer-merchantid-domain-association.txt'),
|
|
@@ -39,7 +39,20 @@ module.exports = ({ strapi }) => ({
|
|
|
39
39
|
ctx.body = {
|
|
40
40
|
data: {
|
|
41
41
|
mid: settings?.mid || null,
|
|
42
|
-
mode: settings?.mode || null
|
|
42
|
+
mode: settings?.mode || null,
|
|
43
|
+
domainName: settings?.domainName || null,
|
|
44
|
+
displayName: settings?.displayName || null,
|
|
45
|
+
portalid: settings?.portalid || null,
|
|
46
|
+
accountId: settings?.aid || null,
|
|
47
|
+
portalKey: settings?.key || null,
|
|
48
|
+
paymentMethods: {
|
|
49
|
+
creditCard: settings?.enableCreditCard,
|
|
50
|
+
paypal: settings?.enablePayPal,
|
|
51
|
+
googlePay: settings?.enableGooglePay,
|
|
52
|
+
applePay: settings?.enableApplePay,
|
|
53
|
+
sofort: settings?.enableSofort,
|
|
54
|
+
sepa: settings?.enableSepaDirectDebit,
|
|
55
|
+
},
|
|
43
56
|
}
|
|
44
57
|
};
|
|
45
58
|
} catch (error) {
|