strapi-plugin-payone-provider 4.6.9 → 5.6.10

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.
Files changed (104) hide show
  1. package/README.md +156 -11
  2. package/admin/src/components/Initializer/index.jsx +3 -3
  3. package/admin/src/components/PluginIcon/index.jsx +3 -3
  4. package/admin/src/index.js +33 -11
  5. package/admin/src/pages/App/components/AppHeader.jsx +17 -32
  6. package/admin/src/pages/App/components/AppTabs.jsx +36 -162
  7. package/admin/src/pages/App/components/ApplePayBtn.jsx +9 -11
  8. package/admin/src/pages/App/components/ApplePayConfig.jsx +221 -161
  9. package/admin/src/pages/App/components/ApplePayConfigPanel.jsx +33 -45
  10. package/admin/src/pages/App/components/DocsPanel.jsx +66 -1726
  11. package/admin/src/pages/App/components/GooglePayConfig.jsx +136 -169
  12. package/admin/src/pages/App/components/GooglePayConfigPanel.jsx +37 -55
  13. package/admin/src/pages/App/components/GooglePaybutton.jsx +101 -43
  14. package/admin/src/pages/App/components/RenderInput.jsx +94 -0
  15. package/admin/src/pages/App/components/StatusBadge.jsx +24 -71
  16. package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +255 -0
  17. package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +54 -0
  18. package/admin/src/pages/App/components/configuration/TestConnection.jsx +130 -0
  19. package/admin/src/pages/App/components/docs/ApplePaySection.jsx +260 -0
  20. package/admin/src/pages/App/components/docs/BaseUrlSection.jsx +53 -0
  21. package/admin/src/pages/App/components/docs/CaptureRefundSection.jsx +113 -0
  22. package/admin/src/pages/App/components/docs/CodeBlock.jsx +59 -0
  23. package/admin/src/pages/App/components/docs/CreditCardSection.jsx +93 -0
  24. package/admin/src/pages/App/components/docs/GooglePaySection.jsx +248 -0
  25. package/admin/src/pages/App/components/docs/PayPalSection.jsx +116 -0
  26. package/admin/src/pages/App/components/docs/PaymentMethodsSection.jsx +55 -0
  27. package/admin/src/pages/App/components/docs/TableOfContents.jsx +47 -0
  28. package/admin/src/pages/App/components/docs/TestCredentialsSection.jsx +304 -0
  29. package/admin/src/pages/App/components/docs/ThreeDSecureSection.jsx +188 -0
  30. package/admin/src/pages/App/components/icons/BankIcon.jsx +1 -1
  31. package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +1 -1
  32. package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +1 -1
  33. package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +1 -1
  34. package/admin/src/pages/App/components/icons/ErrorIcon.jsx +1 -1
  35. package/admin/src/pages/App/components/icons/InfoIcon.jsx +1 -1
  36. package/admin/src/pages/App/components/icons/MarkCircle.jsx +19 -0
  37. package/admin/src/pages/App/components/icons/PaymentIcon.jsx +1 -1
  38. package/admin/src/pages/App/components/icons/PendingIcon.jsx +1 -1
  39. package/admin/src/pages/App/components/icons/PersonIcon.jsx +1 -1
  40. package/admin/src/pages/App/components/icons/SuccessIcon.jsx +1 -1
  41. package/admin/src/pages/App/components/icons/WalletIcon.jsx +1 -1
  42. package/admin/src/pages/App/components/payment-actions/ApplePayPanel.jsx +51 -0
  43. package/admin/src/pages/App/components/payment-actions/AuthorizationForm.jsx +341 -0
  44. package/admin/src/pages/App/components/payment-actions/CaptureForm.jsx +128 -0
  45. package/admin/src/pages/App/components/{paymentActions → payment-actions}/CardDetailsInput.jsx +77 -72
  46. package/admin/src/pages/App/components/payment-actions/PaymentActionsPanel.jsx +194 -0
  47. package/admin/src/pages/App/components/payment-actions/PaymentMethodSelector.jsx +313 -0
  48. package/admin/src/pages/App/components/payment-actions/PaymentResult.jsx +133 -0
  49. package/admin/src/pages/App/components/payment-actions/PreauthorizationForm.jsx +280 -0
  50. package/admin/src/pages/App/components/payment-actions/RefundForm.jsx +121 -0
  51. package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +145 -0
  52. package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +50 -0
  53. package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +163 -0
  54. package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +156 -0
  55. package/admin/src/pages/App/components/{TransactionHistoryItem.jsx → transaction-history/details/TransactionHistoryItem.jsx} +16 -28
  56. package/admin/src/pages/App/index.jsx +27 -70
  57. package/admin/src/pages/App/styles.css +46 -169
  58. package/admin/src/pages/constants/paymentConstants.js +52 -16
  59. package/admin/src/pages/hooks/use-system-theme.js +27 -0
  60. package/admin/src/pages/hooks/usePaymentActions.js +273 -210
  61. package/admin/src/pages/hooks/useSettings.js +87 -48
  62. package/admin/src/pages/hooks/useTransactionHistory.js +105 -108
  63. package/admin/src/pages/utils/api.js +57 -72
  64. package/admin/src/pages/utils/applePayConstants.js +2 -28
  65. package/admin/src/pages/utils/countryLanguageUtils.js +280 -0
  66. package/admin/src/pages/utils/getInputComponent.jsx +225 -0
  67. package/admin/src/pages/utils/googlePayConstants.js +2 -9
  68. package/admin/src/pages/utils/paymentUtils.js +13 -26
  69. package/admin/src/pages/utils/tooltipHelpers.js +18 -0
  70. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  71. package/package.json +8 -14
  72. package/server/config/index.js +18 -2
  73. package/server/controllers/payone.js +98 -31
  74. package/server/policies/index.js +2 -1
  75. package/server/policies/is-auth.js +9 -3
  76. package/server/policies/is-payone-notification.js +31 -0
  77. package/server/policies/isSuperAdmin.js +7 -5
  78. package/server/routes/index.js +11 -0
  79. package/server/services/paymentService.js +6 -22
  80. package/server/services/payone.js +10 -3
  81. package/server/services/settingsService.js +13 -3
  82. package/server/services/testConnectionService.js +11 -73
  83. package/server/services/transactionService.js +62 -99
  84. package/server/services/transactionStatusService.js +87 -0
  85. package/server/utils/normalize.js +0 -12
  86. package/server/utils/paymentMethodParams.js +0 -1
  87. package/server/utils/requestBuilder.js +34 -5
  88. package/server/utils/responseParser.js +9 -14
  89. package/strapi-admin.js +3 -1
  90. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  91. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  92. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  93. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  94. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  95. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  96. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  97. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  98. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +0 -95
  99. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  100. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
  101. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
  102. package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
  103. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
  104. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
@@ -0,0 +1,313 @@
1
+ import * as React from "@strapi/strapi/admin";
2
+ import { Box, Flex, Typography, Link, Alert } from "@strapi/design-system";
3
+ import pluginId from "../../../../pluginId";
4
+ import {
5
+ getPaymentMethodOptions,
6
+ supportsCaptureMode,
7
+ getCaptureModeOptions,
8
+ getPaymentMethodDisplayName,
9
+ } from "../../../utils/paymentUtils";
10
+ import RenderInput from "../RenderInput";
11
+
12
+ const PaymentMethodSelector = ({
13
+ paymentActions,
14
+ onNavigateToConfig,
15
+ isLiveMode,
16
+ }) => {
17
+ return (
18
+ <Box>
19
+ <Flex direction="column" alignItems="stretch" gap={4}>
20
+ <RenderInput
21
+ name="paymentMethod"
22
+ label="Select Payment Method"
23
+ value={paymentActions.paymentState.paymentMethod || ""}
24
+ onChange={(e) => {
25
+ const value = e.target?.value || e;
26
+ paymentActions.handleFieldChange("paymentMethod", value);
27
+ }}
28
+ inputType="select"
29
+ options={getPaymentMethodOptions(isLiveMode).map((option) => ({
30
+ value: option.value,
31
+ label: option.label,
32
+ }))}
33
+ placeholder="Select payment method"
34
+ hint={`Current: ${getPaymentMethodDisplayName(paymentActions.paymentState.paymentMethod)}`}
35
+ tooltipContent="Select the payment method you want to use for this transaction"
36
+ />
37
+ {paymentActions.paymentState.paymentMethod === "apl" &&
38
+ onNavigateToConfig && (
39
+ <>
40
+ <Box
41
+ style={{
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ gap: "16px",
45
+ }}
46
+ >
47
+ <Box
48
+ style={{
49
+ background: "transparent",
50
+ padding: "16px",
51
+ borderRadius: "4px",
52
+ border: "1px solid #eaeaea",
53
+ }}
54
+ >
55
+ <Typography variant="pi" style={{ lineHeight: "1.6" }}>
56
+ <strong>Apple Pay requires middleware configuration</strong>{" "}
57
+ to work properly. You must configure Content Security Policy
58
+ (CSP) in{" "}
59
+ <code
60
+ style={{
61
+ padding: "2px 6px",
62
+ borderRadius: "3px",
63
+ fontSize: "13px",
64
+ }}
65
+ >
66
+ config/middlewares.js
67
+ </code>{" "}
68
+ to allow Apple Pay scripts.
69
+ </Typography>
70
+
71
+ <Box style={{ marginTop: "16px" }}>
72
+ <Typography
73
+ variant="pi"
74
+ style={{
75
+ fontWeight: "600",
76
+ marginBottom: "8px",
77
+ display: "block",
78
+ }}
79
+ >
80
+ Required CSP directives:
81
+ </Typography>
82
+
83
+ <Box>
84
+ <Typography
85
+ variant="pi"
86
+ style={{
87
+ fontFamily: "monospace",
88
+ fontSize: "12px",
89
+ lineHeight: "1.8",
90
+ }}
91
+ >
92
+ <div>
93
+ 'script-src': ['https://applepay.cdn-apple.com',
94
+ 'https://www.apple.com']
95
+ </div>
96
+ <div>
97
+ 'connect-src': ['https://applepay.cdn-apple.com',
98
+ 'https://www.apple.com']
99
+ </div>
100
+ <div>
101
+ 'frame-src': ['https://applepay.cdn-apple.com']
102
+ </div>
103
+ </Typography>
104
+ </Box>
105
+ </Box>
106
+
107
+ <Box
108
+ padding={2}
109
+ background="warning100"
110
+ style={{
111
+ marginTop: "16px",
112
+ borderRadius: "4px",
113
+ borderLeft: "3px solid #f29d41",
114
+ }}
115
+ >
116
+ <Typography variant="pi" style={{ fontWeight: "600" }}>
117
+ ⚠️ Without this configuration, Apple Pay will NOT work!
118
+ </Typography>
119
+ </Box>
120
+ </Box>
121
+
122
+ <Box
123
+ style={{
124
+ background: "transparent",
125
+ padding: "16px",
126
+ borderRadius: "4px",
127
+ border: "1px solid #eaeaea",
128
+ }}
129
+ >
130
+ <Typography variant="pi" style={{ lineHeight: "1.6" }}>
131
+ <strong>Download the domain verification file</strong> from
132
+ your Payone merchant portal and place it in the following
133
+ locations:
134
+ </Typography>
135
+
136
+ <Box>
137
+ <Typography
138
+ variant="pi"
139
+ style={{
140
+ fontFamily: "monospace",
141
+ fontSize: "12px",
142
+ lineHeight: "1.8",
143
+ }}
144
+ >
145
+ <div style={{ marginBottom: "8px" }}>
146
+ <strong>Strapi:</strong>{" "}
147
+ <code>
148
+ public/.well-known/apple-developer-merchantid-domain-association
149
+ </code>
150
+ </div>
151
+ <div>
152
+ <strong>Frontend:</strong>{" "}
153
+ <code>
154
+ public/.well-known/apple-developer-merchantid-domain-association
155
+ </code>
156
+ </div>
157
+ </Typography>
158
+ </Box>
159
+
160
+ <Box style={{ marginTop: "16px" }}>
161
+ <Typography variant="pi" style={{ lineHeight: "1.6" }}>
162
+ <strong>Download URL:</strong> Get the domain verification
163
+ file from Payone documentation:
164
+ </Typography>
165
+ <Box
166
+ padding={2}
167
+ background="primary100"
168
+ style={{ marginTop: "8px", borderRadius: "4px" }}
169
+ >
170
+ <Link
171
+ href="https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev"
172
+ target="_blank"
173
+ rel="noopener noreferrer"
174
+ style={{
175
+ color: "#4945ff",
176
+ textDecoration: "none",
177
+ fontWeight: "500",
178
+ fontSize: "14px",
179
+ }}
180
+ >
181
+
182
+ https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev
183
+ </Link>
184
+ </Box>
185
+ </Box>
186
+
187
+ <Box
188
+ padding={2}
189
+ background="danger100"
190
+ style={{
191
+ marginTop: "16px",
192
+ borderRadius: "4px",
193
+ borderLeft: "3px solid #d02b20",
194
+ }}
195
+ >
196
+ <Typography
197
+ variant="pi"
198
+ textColor="danger600"
199
+ style={{ fontWeight: "600" }}
200
+ >
201
+ ⚠️ Without this file, Apple Pay will NOT work on your
202
+ domain!
203
+ </Typography>
204
+ </Box>
205
+ </Box>
206
+ </Box>
207
+
208
+ <Box padding={3} borderRadius="4px">
209
+ <Typography variant="pi" textColor="neutral600">
210
+ Configure Apple Pay settings:{" "}
211
+ <Link
212
+ href={`/plugins/${pluginId}/apple-pay-config`}
213
+ onClick={(e) => {
214
+ e.preventDefault();
215
+ onNavigateToConfig("apple-pay");
216
+ }}
217
+ style={{
218
+ cursor: "pointer",
219
+ textDecoration: "underline",
220
+ color: "#0066ff",
221
+ }}
222
+ >
223
+ /plugins/{pluginId}/apple-pay-config
224
+ </Link>
225
+ </Typography>
226
+ </Box>
227
+ </>
228
+ )}
229
+ {paymentActions.paymentState.paymentMethod === "gpp" &&
230
+ onNavigateToConfig && (
231
+ <>
232
+ <Alert
233
+ closeLabel="Close"
234
+ title="⚠️ Important: Middleware Configuration Required"
235
+ variant="warning"
236
+ >
237
+ <Typography variant="pi" marginTop={2}>
238
+ <strong>Google Pay requires middleware configuration</strong>{" "}
239
+ to work properly. You must configure Content Security Policy
240
+ (CSP) in <code>config/middlewares.js</code> to allow Google
241
+ Pay scripts, otherwise Google Pay will NOT work.
242
+ </Typography>
243
+ <Typography variant="pi" marginTop={2}>
244
+ Required CSP directives for Google Pay:
245
+ </Typography>
246
+ <Box
247
+ marginTop={2}
248
+ padding={2}
249
+ background="neutral100"
250
+ borderRadius="4px"
251
+ >
252
+ <Typography
253
+ variant="pi"
254
+ style={{ fontFamily: "monospace", fontSize: "12px" }}
255
+ >
256
+ 'script-src': ['https://pay.google.com']
257
+ <br />
258
+ 'connect-src': ['https://pay.google.com']
259
+ <br />
260
+ 'frame-src': ['https://pay.google.com']
261
+ </Typography>
262
+ </Box>
263
+ <Typography variant="pi" marginTop={2} fontWeight="bold">
264
+ ⚠️ Without this configuration, Google Pay will NOT work!
265
+ </Typography>
266
+ </Alert>
267
+ <Box padding={3} background="neutral100" borderRadius="4px">
268
+ <Typography variant="pi" textColor="neutral600">
269
+ Configure Google Pay settings:{" "}
270
+ <Link
271
+ href={`/plugins/${pluginId}/google-pay-config`}
272
+ onClick={(e) => {
273
+ e.preventDefault();
274
+ onNavigateToConfig("google-pay");
275
+ }}
276
+ style={{
277
+ cursor: "pointer",
278
+ textDecoration: "underline",
279
+ color: "#0066ff",
280
+ }}
281
+ >
282
+ /plugins/{pluginId}/google-pay-config
283
+ </Link>
284
+ </Typography>
285
+ </Box>
286
+ </>
287
+ )}
288
+ {paymentActions.paymentState.paymentMethod !== "apl" &&
289
+ supportsCaptureMode(paymentActions.paymentState.paymentMethod) && (
290
+ <RenderInput
291
+ name="captureMode"
292
+ label="Capture Mode"
293
+ value={paymentActions.paymentState.captureMode || ""}
294
+ onChange={(e) => {
295
+ const value = e.target?.value || e;
296
+ paymentActions.handleFieldChange("captureMode", value);
297
+ }}
298
+ inputType="select"
299
+ options={getCaptureModeOptions().map((option) => ({
300
+ value: option.value,
301
+ label: option.label,
302
+ }))}
303
+ placeholder="Select capture mode"
304
+ hint="Select capture mode for wallet payments"
305
+ tooltipContent="Choose how the payment should be captured for wallet payments"
306
+ />
307
+ )}
308
+ </Flex>
309
+ </Box>
310
+ );
311
+ };
312
+
313
+ export default PaymentMethodSelector;
@@ -0,0 +1,133 @@
1
+ import * as React from "@strapi/strapi/admin";
2
+ import { Card, CardBody, Flex, Typography, Alert } from "@strapi/design-system";
3
+ import StatusBadge from "../StatusBadge";
4
+ import { formatTransactionData } from "../../../utils/formatTransactionData";
5
+
6
+ const PaymentResult = ({ paymentError, paymentResult }) => {
7
+ if (!paymentError && !paymentResult) {
8
+ return null;
9
+ }
10
+ console.log(paymentResult);
11
+ console.log(paymentError);
12
+
13
+ return (
14
+ <>
15
+ {paymentError && (
16
+ <Alert variant="danger" title="Error" className="payment-alert">
17
+ {paymentError}
18
+ </Alert>
19
+ )}
20
+
21
+ {paymentResult && (
22
+ <Card>
23
+ <CardBody>
24
+ <Flex direction="column" gap={4} alignItems={"stretch"}>
25
+ <Flex direction={"row"} alignItems={"center"} gap={2}>
26
+ <Typography
27
+ variant="delta"
28
+ as="h3"
29
+ className="payment-section-title"
30
+ >
31
+ Payment Result
32
+ </Typography>
33
+ {paymentResult?.Status && (
34
+ <StatusBadge status={paymentResult.Status} />
35
+ )}
36
+ </Flex>
37
+
38
+ <Flex direction="column" gap={3} alignItems={"stretch"}>
39
+ {formatTransactionData(paymentResult).map((item, index) => (
40
+ <Flex
41
+ key={index}
42
+ justifyContent="space-between"
43
+ alignItems="start"
44
+ style={{
45
+ padding: "8px 0",
46
+ borderBottom:
47
+ index < formatTransactionData(paymentResult).length - 1
48
+ ? "1px solid #e8e8ea"
49
+ : "none",
50
+ }}
51
+ >
52
+ <Typography
53
+ variant="pi"
54
+ textColor="neutral600"
55
+ style={{ minWidth: "200px", fontWeight: "500" }}
56
+ >
57
+ {item.key}:
58
+ </Typography>
59
+ <Typography
60
+ variant="pi"
61
+ style={{
62
+ flex: 1,
63
+ textAlign: "right",
64
+ fontWeight: "400",
65
+ wordBreak: "break-word",
66
+ fontFamily: item.key.toLowerCase().includes("raw")
67
+ ? "monospace"
68
+ : "inherit",
69
+ fontSize: item.key.toLowerCase().includes("raw")
70
+ ? "11px"
71
+ : "inherit",
72
+ }}
73
+ >
74
+ {item.value}
75
+ </Typography>
76
+ </Flex>
77
+ ))}
78
+ </Flex>
79
+ {paymentResult?.is3DSRequired && !paymentResult?.redirectUrl && (
80
+ <Alert
81
+ variant="warning"
82
+ title="3D Secure Authentication Required"
83
+ >
84
+ <Flex direction="column" gap={2}>
85
+ <Typography variant="pi">
86
+ Payone requires 3D Secure authentication, but no redirect
87
+ URL was provided in the response.
88
+ </Typography>
89
+ <Typography variant="pi" fontWeight="semiBold">
90
+ Possible solutions:
91
+ </Typography>
92
+ <Typography
93
+ variant="pi"
94
+ component="ul"
95
+ style={{ marginLeft: "20px" }}
96
+ >
97
+ <li>
98
+ Check Payone portal configuration for 3DS settings
99
+ </li>
100
+ <li>
101
+ Verify that redirect URLs (successurl, errorurl,
102
+ backurl) are properly configured
103
+ </li>
104
+ <li>
105
+ Ensure you're using test mode with proper test
106
+ credentials
107
+ </li>
108
+ <li>
109
+ Check if 3dscheck request is needed before authorization
110
+ </li>
111
+ </Typography>
112
+ <Typography
113
+ variant="pi"
114
+ textColor="neutral600"
115
+ marginTop={2}
116
+ >
117
+ <strong>Error Code:</strong>{" "}
118
+ {paymentResult?.errorCode ||
119
+ paymentResult?.ErrorCode ||
120
+ "4219"}
121
+ </Typography>
122
+ </Flex>
123
+ </Alert>
124
+ )}
125
+ </Flex>
126
+ </CardBody>
127
+ </Card>
128
+ )}
129
+ </>
130
+ );
131
+ };
132
+
133
+ export default PaymentResult;