strapi-plugin-payone-provider 4.6.10 → 4.6.12

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 (68) hide show
  1. package/README.md +64 -0
  2. package/admin/src/pages/App/components/AppHeader.jsx +3 -2
  3. package/admin/src/pages/App/components/AppTabs.jsx +34 -88
  4. package/admin/src/pages/App/components/DocsPanel.jsx +1726 -1726
  5. package/admin/src/pages/App/components/GooglePaybutton.jsx +300 -300
  6. package/admin/src/pages/App/components/StatusBadge.jsx +1 -1
  7. package/admin/src/pages/App/components/common/InfoTooltip.jsx +16 -0
  8. package/admin/src/pages/App/components/{ApplePayConfig.jsx → configuration/ApplePayConfig.jsx} +191 -62
  9. package/admin/src/pages/App/components/{ApplePayConfigPanel.jsx → configuration/ApplePayConfigPanel.jsx} +71 -70
  10. package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +408 -0
  11. package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +67 -0
  12. package/admin/src/pages/App/components/{GooglePayConfig.jsx → configuration/GooglePayConfig.jsx} +254 -254
  13. package/admin/src/pages/App/components/{GooglePayConfigPanel.jsx → configuration/GooglePayConfigPanel.jsx} +82 -82
  14. package/admin/src/pages/App/components/configuration/TestConnection.jsx +129 -0
  15. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +137 -95
  16. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +119 -14
  17. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.jsx +85 -24
  18. package/admin/src/pages/App/components/paymentActions/PaymentActionsPanel.jsx +361 -0
  19. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +22 -4
  20. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +91 -20
  21. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationForm.jsx +157 -0
  22. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormFields.jsx +308 -0
  23. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormHeader.jsx +27 -0
  24. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationPaymentButtons.jsx +93 -0
  25. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationForm.jsx +134 -0
  26. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormFields.jsx +295 -0
  27. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormHeader.jsx +27 -0
  28. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationPaymentButtons.jsx +53 -0
  29. package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +182 -0
  30. package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +49 -0
  31. package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +199 -0
  32. package/admin/src/pages/App/components/transaction-history/TransactionTablePagination.jsx +28 -0
  33. package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +155 -0
  34. package/admin/src/pages/App/index.jsx +5 -29
  35. package/admin/src/pages/hooks/usePaymentActions.js +87 -11
  36. package/admin/src/pages/hooks/useSettings.js +64 -22
  37. package/admin/src/pages/hooks/useTransactionHistory.js +121 -85
  38. package/admin/src/pages/utils/api.js +31 -3
  39. package/admin/src/pages/utils/countryLanguageUtils.js +236 -0
  40. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  41. package/package.json +2 -2
  42. package/server/bootstrap.js +6 -6
  43. package/server/content-types/index.js +5 -0
  44. package/server/content-types/transactions/index.js +5 -0
  45. package/server/content-types/transactions/schema.json +87 -0
  46. package/server/controllers/payone.js +29 -3
  47. package/server/index.js +2 -1
  48. package/server/policies/index.js +2 -1
  49. package/server/policies/is-payone-notification.js +31 -0
  50. package/server/routes/index.js +10 -0
  51. package/server/services/applePayService.js +0 -2
  52. package/server/services/payone.js +16 -4
  53. package/server/services/settingsService.js +8 -2
  54. package/server/services/testConnectionService.js +11 -72
  55. package/server/services/transactionService.js +147 -154
  56. package/server/services/transactionStatusService.js +63 -0
  57. package/server/utils/sanitize.js +41 -0
  58. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  59. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  60. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  61. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  62. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  63. package/admin/src/pages/App/components/TransactionHistoryItem.jsx +0 -522
  64. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  65. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  66. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  67. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  68. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
@@ -1,254 +1,254 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Flex,
5
- Typography,
6
- Select,
7
- Option,
8
- Checkbox,
9
- Stack,
10
- } from "@strapi/design-system";
11
- import {
12
- GOOGLE_PAY_SUPPORTED_COUNTRIES,
13
- GOOGLE_PAY_SUPPORTED_CURRENCIES,
14
- GOOGLE_PAY_SUPPORTED_NETWORKS,
15
- GOOGLE_PAY_AUTH_METHODS,
16
- DEFAULT_GOOGLE_PAY_CONFIG,
17
- } from "../../utils/googlePayConstants";
18
-
19
- const GooglePayConfig = ({ config, onConfigChange, settings }) => {
20
- const {
21
- countryCode = DEFAULT_GOOGLE_PAY_CONFIG.countryCode,
22
- currencyCode = DEFAULT_GOOGLE_PAY_CONFIG.currencyCode,
23
- allowedCardNetworks = DEFAULT_GOOGLE_PAY_CONFIG.allowedCardNetworks,
24
- allowedAuthMethods = DEFAULT_GOOGLE_PAY_CONFIG.allowedAuthMethods,
25
- merchantName = DEFAULT_GOOGLE_PAY_CONFIG.merchantName,
26
- } = config || {};
27
-
28
- const handleCountryChange = (value) => {
29
- onConfigChange({
30
- ...config,
31
- countryCode: value,
32
- });
33
- };
34
-
35
- const handleCurrencyChange = (value) => {
36
- onConfigChange({
37
- ...config,
38
- currencyCode: value,
39
- });
40
- };
41
-
42
- const handleNetworkToggle = (networkCode) => {
43
- const currentNetworks = allowedCardNetworks || [];
44
- const newNetworks = currentNetworks.includes(networkCode)
45
- ? currentNetworks.filter((n) => n !== networkCode)
46
- : [...currentNetworks, networkCode];
47
-
48
- onConfigChange({
49
- ...config,
50
- allowedCardNetworks: newNetworks,
51
- });
52
- };
53
-
54
- const handleAuthMethodToggle = (authMethodCode) => {
55
- const currentMethods = allowedAuthMethods || [];
56
- const newMethods = currentMethods.includes(authMethodCode)
57
- ? currentMethods.filter((m) => m !== authMethodCode)
58
- : [...currentMethods, authMethodCode];
59
-
60
- onConfigChange({
61
- ...config,
62
- allowedAuthMethods: newMethods,
63
- });
64
- };
65
-
66
- return (
67
- <Box>
68
- <Stack spacing={6}>
69
- {/* Country and Currency */}
70
- <Flex gap={4} wrap="wrap">
71
- <Box style={{ flex: 1, minWidth: "300px" }}>
72
- <Select
73
- label="Country Code"
74
- name="countryCode"
75
- value={countryCode}
76
- onChange={handleCountryChange}
77
- hint="Select the country where your business operates"
78
- required
79
- >
80
- {GOOGLE_PAY_SUPPORTED_COUNTRIES.map((country) => (
81
- <Option key={country.code} value={country.code}>
82
- {country.name} ({country.code})
83
- </Option>
84
- ))}
85
- </Select>
86
- </Box>
87
-
88
- <Box style={{ flex: 1, minWidth: "300px" }}>
89
- <Select
90
- label="Currency Code"
91
- name="currencyCode"
92
- value={currencyCode}
93
- onChange={handleCurrencyChange}
94
- hint="Select the currency for transactions"
95
- required
96
- >
97
- {GOOGLE_PAY_SUPPORTED_CURRENCIES.map((currency) => (
98
- <Option key={currency.code} value={currency.code}>
99
- {currency.name} ({currency.code}) {currency.symbol}
100
- </Option>
101
- ))}
102
- </Select>
103
- </Box>
104
- </Flex>
105
-
106
- {/* Merchant Name */}
107
- <Box>
108
- <Typography
109
- variant="pi"
110
- fontWeight="semiBold"
111
- style={{ marginLeft: "2px" }}
112
- >
113
- Merchant Name
114
- </Typography>
115
- <Typography
116
- variant="pi"
117
- textColor="neutral600"
118
- style={{ marginLeft: "2px" }}
119
- >
120
- The name of your business as it will appear in Google Pay
121
- </Typography>
122
- <input
123
- type="text"
124
- value={merchantName}
125
- onChange={(e) =>
126
- onConfigChange({ ...config, merchantName: e.target.value })
127
- }
128
- style={{
129
- width: "100%",
130
- padding: "8px 12px",
131
- marginTop: "8px",
132
- border: "1px solid #dcdce4",
133
- borderRadius: "4px",
134
- fontSize: "14px",
135
- }}
136
- placeholder="Your Store Name"
137
- />
138
- </Box>
139
-
140
- {/* Allowed Card Networks */}
141
- <Box>
142
- <Typography
143
- variant="pi"
144
- fontWeight="semiBold"
145
- style={{ marginLeft: "2px" }}
146
- >
147
- Allowed Card Networks
148
- </Typography>
149
- <Typography
150
- variant="pi"
151
- textColor="neutral600"
152
- style={{ marginLeft: "2px" }}
153
- >
154
- Select payment card networks to accept
155
- </Typography>
156
- <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
157
- {GOOGLE_PAY_SUPPORTED_NETWORKS.map((network) => {
158
- const isSelected = allowedCardNetworks?.includes(network.code);
159
-
160
- return (
161
- <Box
162
- key={network.code}
163
- style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
164
- >
165
- <Checkbox
166
- name={`network-${network.code}`}
167
- checked={isSelected}
168
- onChange={() => handleNetworkToggle(network.code)}
169
- >
170
- {network.name} ({network.code})
171
- </Checkbox>
172
- </Box>
173
- );
174
- })}
175
- </Flex>
176
- {allowedCardNetworks?.length === 0 && (
177
- <Typography
178
- variant="pi"
179
- textColor="danger600"
180
- style={{ marginTop: "8px" }}
181
- >
182
- At least one card network must be selected
183
- </Typography>
184
- )}
185
- </Box>
186
-
187
- {/* Allowed Authentication Methods */}
188
- <Box>
189
- <Typography
190
- variant="pi"
191
- fontWeight="semiBold"
192
- style={{ marginLeft: "2px" }}
193
- >
194
- Allowed Authentication Methods
195
- </Typography>
196
- <Typography
197
- variant="pi"
198
- textColor="neutral600"
199
- style={{ marginLeft: "2px" }}
200
- >
201
- Select authentication methods for card payments
202
- </Typography>
203
- <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
204
- {GOOGLE_PAY_AUTH_METHODS.map((method) => {
205
- const isSelected = allowedAuthMethods?.includes(method.code);
206
-
207
- return (
208
- <Box
209
- key={method.code}
210
- style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
211
- >
212
- <Checkbox
213
- name={`auth-method-${method.code}`}
214
- checked={isSelected}
215
- onChange={() => handleAuthMethodToggle(method.code)}
216
- >
217
- {method.name} - {method.description}
218
- </Checkbox>
219
- </Box>
220
- );
221
- })}
222
- </Flex>
223
- {allowedAuthMethods?.length === 0 && (
224
- <Typography
225
- variant="pi"
226
- textColor="danger600"
227
- style={{ marginTop: "8px" }}
228
- >
229
- At least one authentication method must be selected
230
- </Typography>
231
- )}
232
- </Box>
233
-
234
- {/* Gateway Merchant ID Info */}
235
- <Box>
236
- <Typography
237
- variant="pi"
238
- fontWeight="semiBold"
239
- style={{ marginLeft: "2px" }}
240
- >
241
- Gateway Merchant ID
242
- </Typography>
243
- <Typography variant="pi" textColor="neutral600">
244
- {settings?.mid || settings?.portalid
245
- ? `Using: ${settings.mid || settings.portalid}`
246
- : "Gateway merchant ID will be obtained from your Payone Merchant ID (MID) or Portal ID. Make sure these are configured in the main Configuration tab."}
247
- </Typography>
248
- </Box>
249
- </Stack>
250
- </Box>
251
- );
252
- };
253
-
254
- export default GooglePayConfig;
1
+ import React from "react";
2
+ import {
3
+ Box,
4
+ Flex,
5
+ Typography,
6
+ Select,
7
+ Option,
8
+ Checkbox,
9
+ Stack,
10
+ TextInput,
11
+ } from "@strapi/design-system";
12
+ import InfoTooltip from "../common/InfoTooltip";
13
+ import {
14
+ GOOGLE_PAY_SUPPORTED_COUNTRIES,
15
+ GOOGLE_PAY_SUPPORTED_CURRENCIES,
16
+ GOOGLE_PAY_SUPPORTED_NETWORKS,
17
+ GOOGLE_PAY_AUTH_METHODS,
18
+ DEFAULT_GOOGLE_PAY_CONFIG,
19
+ } from "../../../utils/googlePayConstants";
20
+
21
+ const GooglePayConfig = ({ config, onConfigChange, settings }) => {
22
+ const {
23
+ countryCode = DEFAULT_GOOGLE_PAY_CONFIG.countryCode,
24
+ currencyCode = DEFAULT_GOOGLE_PAY_CONFIG.currencyCode,
25
+ allowedCardNetworks = DEFAULT_GOOGLE_PAY_CONFIG.allowedCardNetworks,
26
+ allowedAuthMethods = DEFAULT_GOOGLE_PAY_CONFIG.allowedAuthMethods,
27
+ merchantName = DEFAULT_GOOGLE_PAY_CONFIG.merchantName,
28
+ } = config || {};
29
+
30
+ const handleCountryChange = (value) => {
31
+ onConfigChange({
32
+ ...config,
33
+ countryCode: value,
34
+ });
35
+ };
36
+
37
+ const handleCurrencyChange = (value) => {
38
+ onConfigChange({
39
+ ...config,
40
+ currencyCode: value,
41
+ });
42
+ };
43
+
44
+ const handleNetworkToggle = (networkCode) => {
45
+ const currentNetworks = allowedCardNetworks || [];
46
+ const newNetworks = currentNetworks.includes(networkCode)
47
+ ? currentNetworks.filter((n) => n !== networkCode)
48
+ : [...currentNetworks, networkCode];
49
+
50
+ onConfigChange({
51
+ ...config,
52
+ allowedCardNetworks: newNetworks,
53
+ });
54
+ };
55
+
56
+ const handleAuthMethodToggle = (authMethodCode) => {
57
+ const currentMethods = allowedAuthMethods || [];
58
+ const newMethods = currentMethods.includes(authMethodCode)
59
+ ? currentMethods.filter((m) => m !== authMethodCode)
60
+ : [...currentMethods, authMethodCode];
61
+
62
+ onConfigChange({
63
+ ...config,
64
+ allowedAuthMethods: newMethods,
65
+ });
66
+ };
67
+
68
+ return (
69
+ <Box>
70
+ <Stack spacing={6}>
71
+ {/* Country and Currency */}
72
+ <Flex gap={4} wrap="wrap">
73
+ <Box style={{ flex: 1, minWidth: "300px" }}>
74
+ <Select
75
+ label="Country Code"
76
+ name="countryCode"
77
+ value={countryCode}
78
+ onChange={handleCountryChange}
79
+ required
80
+ labelAction={
81
+ <InfoTooltip
82
+ label="Country Code"
83
+ description="Select the country where your business operates"
84
+ id="countryCode-tooltip"
85
+ />
86
+ }
87
+ >
88
+ {GOOGLE_PAY_SUPPORTED_COUNTRIES.map((country) => (
89
+ <Option key={country.code} value={country.code}>
90
+ {country.name} ({country.code})
91
+ </Option>
92
+ ))}
93
+ </Select>
94
+ </Box>
95
+
96
+ <Box style={{ flex: 1, minWidth: "300px" }}>
97
+ <Select
98
+ label="Currency Code"
99
+ name="currencyCode"
100
+ value={currencyCode}
101
+ onChange={handleCurrencyChange}
102
+ required
103
+ labelAction={
104
+ <InfoTooltip
105
+ label="Currency Code"
106
+ description="Select the currency for transactions. Should match the selected country."
107
+ id="currencyCode-tooltip"
108
+ />
109
+ }
110
+ >
111
+ {GOOGLE_PAY_SUPPORTED_CURRENCIES.map((currency) => (
112
+ <Option key={currency.code} value={currency.code}>
113
+ {currency.name} ({currency.code}) {currency.symbol}
114
+ </Option>
115
+ ))}
116
+ </Select>
117
+ </Box>
118
+ </Flex>
119
+
120
+ {/* Merchant Name */}
121
+ <Box>
122
+ <TextInput
123
+ name="merchantName"
124
+ label="Merchant Name"
125
+ value={merchantName}
126
+ onChange={(e) =>
127
+ onConfigChange({ ...config, merchantName: e.target.value })
128
+ }
129
+ placeholder="Your Store Name"
130
+ endAction={
131
+ <InfoTooltip
132
+ label="Merchant Name"
133
+ description="The name of your business as it will appear in Google Pay"
134
+ id="merchantName-tooltip"
135
+ />
136
+ }
137
+ />
138
+ </Box>
139
+
140
+ {/* Allowed Card Networks */}
141
+ <Box>
142
+ <Typography
143
+ variant="pi"
144
+ fontWeight="semiBold"
145
+ style={{ marginLeft: "2px" }}
146
+ >
147
+ Allowed Card Networks
148
+ </Typography>
149
+ <Typography
150
+ variant="pi"
151
+ textColor="neutral600"
152
+ style={{ marginLeft: "2px" }}
153
+ >
154
+ Select payment card networks to accept
155
+ </Typography>
156
+ <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
157
+ {GOOGLE_PAY_SUPPORTED_NETWORKS.map((network) => {
158
+ const isSelected = allowedCardNetworks?.includes(network.code);
159
+
160
+ return (
161
+ <Box
162
+ key={network.code}
163
+ style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
164
+ >
165
+ <Checkbox
166
+ name={`network-${network.code}`}
167
+ checked={isSelected}
168
+ onChange={() => handleNetworkToggle(network.code)}
169
+ >
170
+ {network.name} ({network.code})
171
+ </Checkbox>
172
+ </Box>
173
+ );
174
+ })}
175
+ </Flex>
176
+ {allowedCardNetworks?.length === 0 && (
177
+ <Typography
178
+ variant="pi"
179
+ textColor="danger600"
180
+ style={{ marginTop: "8px" }}
181
+ >
182
+ At least one card network must be selected
183
+ </Typography>
184
+ )}
185
+ </Box>
186
+
187
+ {/* Allowed Authentication Methods */}
188
+ <Box>
189
+ <Typography
190
+ variant="pi"
191
+ fontWeight="semiBold"
192
+ style={{ marginLeft: "2px" }}
193
+ >
194
+ Allowed Authentication Methods
195
+ </Typography>
196
+ <Typography
197
+ variant="pi"
198
+ textColor="neutral600"
199
+ style={{ marginLeft: "2px" }}
200
+ >
201
+ Select authentication methods for card payments
202
+ </Typography>
203
+ <Flex wrap="wrap" gap={4} style={{ marginTop: "12px" }}>
204
+ {GOOGLE_PAY_AUTH_METHODS.map((method) => {
205
+ const isSelected = allowedAuthMethods?.includes(method.code);
206
+
207
+ return (
208
+ <Box
209
+ key={method.code}
210
+ style={{ flex: "0 0 calc(50% - 8px)", minWidth: "250px" }}
211
+ >
212
+ <Checkbox
213
+ name={`auth-method-${method.code}`}
214
+ checked={isSelected}
215
+ onChange={() => handleAuthMethodToggle(method.code)}
216
+ >
217
+ {method.name} - {method.description}
218
+ </Checkbox>
219
+ </Box>
220
+ );
221
+ })}
222
+ </Flex>
223
+ {allowedAuthMethods?.length === 0 && (
224
+ <Typography
225
+ variant="pi"
226
+ textColor="danger600"
227
+ style={{ marginTop: "8px" }}
228
+ >
229
+ At least one authentication method must be selected
230
+ </Typography>
231
+ )}
232
+ </Box>
233
+
234
+ {/* Gateway Merchant ID Info */}
235
+ <Box>
236
+ <Typography
237
+ variant="pi"
238
+ fontWeight="semiBold"
239
+ style={{ marginLeft: "2px" }}
240
+ >
241
+ Gateway Merchant ID
242
+ </Typography>
243
+ <Typography variant="pi" textColor="neutral600">
244
+ {settings?.mid || settings?.portalid
245
+ ? `Using: ${settings.mid || settings.portalid}`
246
+ : "Gateway merchant ID will be obtained from your Payone Merchant ID (MID) or Portal ID. Make sure these are configured in the main Configuration tab."}
247
+ </Typography>
248
+ </Box>
249
+ </Stack>
250
+ </Box>
251
+ );
252
+ };
253
+
254
+ export default GooglePayConfig;