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,255 @@
1
+ import * as React from "react";
2
+ import {
3
+ Button,
4
+ Card,
5
+ CardBody,
6
+ Flex,
7
+ Typography,
8
+ } from "@strapi/design-system";
9
+ import { Cog } from "@strapi/icons";
10
+ import RenderInput from "../RenderInput";
11
+
12
+ const ConfigurationFields = ({
13
+ settings,
14
+ onInputChange,
15
+ onPaymentMethodToggle,
16
+ onNavigateToConfig,
17
+ }) => {
18
+ const handleNavigateToApplePayConfig = () => {
19
+ if (onNavigateToConfig) {
20
+ onNavigateToConfig("apple-pay-config");
21
+ }
22
+ };
23
+
24
+ const handleNavigateToGooglePayConfig = () => {
25
+ if (onNavigateToConfig) {
26
+ onNavigateToConfig("google-pay-config");
27
+ }
28
+ };
29
+
30
+ return (
31
+ <Card padding={8}>
32
+ <CardBody
33
+ style={{
34
+ display: "grid",
35
+ gap: "16px",
36
+ gridTemplateColumns: "repeat(auto-fit, minmax(250px, 1fr))",
37
+ }}
38
+ >
39
+ <Flex direction="column" alignItems={"stretch"} gap={6}>
40
+ <Flex direction="row" gap={2}>
41
+ <RenderInput
42
+ label="Account ID (aid)"
43
+ name="aid"
44
+ value={settings.aid}
45
+ onChange={(e) => onInputChange("aid", e.target.value)}
46
+ required
47
+ inputType="textInput"
48
+ tooltipContent={"Your Payone account ID"}
49
+ />
50
+
51
+ <RenderInput
52
+ label="Portal ID"
53
+ name="portalid"
54
+ value={settings.portalid}
55
+ onChange={(e) => onInputChange("portalid", e.target.value)}
56
+ required
57
+ inputType="textInput"
58
+ tooltipContent={"Your Payone portal ID"}
59
+ />
60
+ </Flex>
61
+ <Flex direction="row" gap={2}>
62
+ <RenderInput
63
+ label="Merchant ID (mid)"
64
+ name="mid"
65
+ value={settings.mid}
66
+ onChange={(e) => onInputChange("mid", e.target.value)}
67
+ required
68
+ inputType="textInput"
69
+ tooltipContent={"Your Payone merchant ID"}
70
+ />
71
+
72
+ <RenderInput
73
+ label="Portal Key"
74
+ name="key"
75
+ type="password"
76
+ value={settings.key}
77
+ onChange={(e) => onInputChange("key", e.target.value)}
78
+ required
79
+ inputType="textInput"
80
+ tooltipContent={"Your Payone portal key (will be encrypted)"}
81
+ />
82
+ </Flex>
83
+ <Flex direction="row" gap={2}>
84
+ <RenderInput
85
+ label="Domain Name"
86
+ name="domainName"
87
+ value={settings.domainName}
88
+ onChange={(e) => onInputChange("domainName", e.target.value)}
89
+ inputType="textInput"
90
+ tooltipContent={"Your Payone domain name"}
91
+ />
92
+
93
+ <RenderInput
94
+ label="Display Name"
95
+ name="displayName"
96
+ value={settings.displayName}
97
+ onChange={(e) => onInputChange("displayName", e.target.value)}
98
+ inputType="textInput"
99
+ tooltipContent={"Display name for payment methods (optional)"}
100
+ />
101
+ </Flex>
102
+ <Flex direction="row" gap={2}>
103
+ <RenderInput
104
+ label="Mode"
105
+ name="mode"
106
+ value={settings.mode || "test"}
107
+ onChange={(e) => onInputChange("mode", e.target.value)}
108
+ required
109
+ inputType="select"
110
+ tooltipContent={"Select the API mode"}
111
+ options={[
112
+ { value: "test", label: "Test" },
113
+ { value: "live", label: "Live" },
114
+ ]}
115
+ />
116
+ <RenderInput
117
+ label="Enable 3D Secure"
118
+ name="enable3DSecure"
119
+ value={settings.enable3DSecure ? "yes" : "no"}
120
+ onChange={(e) =>
121
+ onInputChange("enable3DSecure", e.target.value === "yes")
122
+ }
123
+ required
124
+ inputType="select"
125
+ tooltipContent={
126
+ "Enable 3D Secure authentication for credit card payments"
127
+ }
128
+ options={[
129
+ { value: "yes", label: "Enabled" },
130
+ { value: "no", label: "Disabled" },
131
+ ]}
132
+ />
133
+ </Flex>
134
+ <Flex direction="row">
135
+ <RenderInput
136
+ label="API Version"
137
+ name="api_version"
138
+ value={settings.api_version || "3.10"}
139
+ onChange={(e) => onInputChange("api_version", e.target.value)}
140
+ required
141
+ inputType="textInput"
142
+ tooltipContent={"Payone API version"}
143
+ />
144
+ </Flex>
145
+ </Flex>
146
+
147
+ <Flex direction="column" alignItems="stretch" gap={4} marginTop={6}>
148
+ <Typography variant="pi" textColor="neutral600" marginBottom={4}>
149
+ Enable or disable payment methods for your Payone integration
150
+ </Typography>
151
+
152
+ <RenderInput
153
+ label="Credit Card (Visa, Mastercard)"
154
+ name="enableCreditCard"
155
+ value={settings.enableCreditCard === true}
156
+ onChange={(selected) =>
157
+ onPaymentMethodToggle("enableCreditCard", selected)
158
+ }
159
+ inputType="switch"
160
+ labelDirection="row"
161
+ labelStyle={{ fontSize: "16px" }}
162
+ tooltipContent="Enable or disable credit card payments"
163
+ />
164
+
165
+ <RenderInput
166
+ label="PayPal"
167
+ name="enablePayPal"
168
+ value={settings.enablePayPal === true}
169
+ onChange={(selected) =>
170
+ onPaymentMethodToggle("enablePayPal", selected)
171
+ }
172
+ inputType="switch"
173
+ labelDirection="row"
174
+ labelStyle={{ fontSize: "16px" }}
175
+ tooltipContent="Enable or disable PayPal payments"
176
+ />
177
+
178
+ <RenderInput
179
+ label="Google Pay"
180
+ name="enableGooglePay"
181
+ value={settings.enableGooglePay === true}
182
+ onChange={(selected) =>
183
+ onPaymentMethodToggle("enableGooglePay", selected)
184
+ }
185
+ inputType="switch"
186
+ labelDirection="row"
187
+ labelStyle={{ fontSize: "16px" }}
188
+ tooltipContent="Enable or disable Google Pay payments"
189
+ />
190
+
191
+ <RenderInput
192
+ label="Apple Pay"
193
+ name="enableApplePay"
194
+ value={settings.enableApplePay === true}
195
+ onChange={(selected) =>
196
+ onPaymentMethodToggle("enableApplePay", selected)
197
+ }
198
+ inputType="switch"
199
+ labelDirection="row"
200
+ labelStyle={{ fontSize: "16px" }}
201
+ tooltipContent="Enable or disable Apple Pay payments"
202
+ />
203
+
204
+ <RenderInput
205
+ label="Sofort Banking"
206
+ name="enableSofort"
207
+ value={settings.enableSofort === true}
208
+ onChange={(selected) =>
209
+ onPaymentMethodToggle("enableSofort", selected)
210
+ }
211
+ inputType="switch"
212
+ labelDirection="row"
213
+ labelStyle={{ fontSize: "16px" }}
214
+ tooltipContent="Enable or disable Sofort Banking payments"
215
+ />
216
+
217
+ <RenderInput
218
+ label="SEPA Direct Debit"
219
+ name="enableSepaDirectDebit"
220
+ value={settings.enableSepaDirectDebit === true}
221
+ onChange={(selected) =>
222
+ onPaymentMethodToggle("enableSepaDirectDebit", selected)
223
+ }
224
+ inputType="switch"
225
+ labelDirection="row"
226
+ labelStyle={{ fontSize: "16px" }}
227
+ tooltipContent="Enable or disable SEPA Direct Debit payments"
228
+ />
229
+
230
+ <Flex direction="row" gap={2} marginTop={10}>
231
+ <Button
232
+ variant="secondary"
233
+ startIcon={<Cog />}
234
+ onClick={handleNavigateToApplePayConfig}
235
+ className="payment-button"
236
+ >
237
+ Apple Pay Config
238
+ </Button>
239
+ <Button
240
+ variant="secondary"
241
+ startIcon={<Cog />}
242
+ onClick={handleNavigateToGooglePayConfig}
243
+ className="payment-button"
244
+ >
245
+ Google Pay Config
246
+ </Button>
247
+ </Flex>
248
+ </Flex>
249
+ </CardBody>
250
+ </Card>
251
+ );
252
+ };
253
+
254
+ export default ConfigurationFields;
255
+
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { Box, Flex, Typography } from "@strapi/design-system";
3
+ import ConfigurationFields from "./ConfigurationFields";
4
+ import TestConnection from "./TestConnection";
5
+
6
+ const ConfigurationPanel = ({ settings }) => {
7
+ return (
8
+ <Flex direction="column" alignItems="stretch" gap={8} paddingTop={8}>
9
+ <Box>
10
+ <Typography
11
+ variant="beta"
12
+ as="h2"
13
+ fontWeight="bold"
14
+ className="payment-title"
15
+ style={{ fontSize: "20px", marginBottom: "4px" }}
16
+ >
17
+ Payone API Configuration
18
+ </Typography>
19
+ <Typography
20
+ variant="pi"
21
+ textColor="neutral600"
22
+ marginTop={2}
23
+ className="payment-subtitle"
24
+ style={{ fontSize: "14px" }}
25
+ >
26
+ Configure your Payone payment gateway settings
27
+ </Typography>
28
+ </Box>
29
+
30
+ <ConfigurationFields
31
+ settings={settings.settings}
32
+ onInputChange={settings.handleInputChange}
33
+ onPaymentMethodToggle={settings.handlePaymentMethodToggle}
34
+ onNavigateToConfig={settings.onNavigateToConfig}
35
+ />
36
+
37
+ <TestConnection
38
+ settings={settings.settings}
39
+ isTesting={settings.isTesting}
40
+ testResult={settings.testResult}
41
+ onTestConnection={settings.handleTestConnection}
42
+ />
43
+
44
+ <Box paddingTop={4}>
45
+ <Typography variant="sigma" textColor="neutral600">
46
+ Note: These settings are used for all Payone API requests. Make sure
47
+ to use the correct credentials for your selected mode.
48
+ </Typography>
49
+ </Box>
50
+ </Flex>
51
+ );
52
+ };
53
+
54
+ export default ConfigurationPanel;
@@ -0,0 +1,130 @@
1
+ import * as React from "react";
2
+ import {
3
+ Box,
4
+ Button,
5
+ Card,
6
+ CardBody,
7
+ Flex,
8
+ Typography,
9
+ Alert,
10
+ } from "@strapi/design-system";
11
+ import { Play } from "@strapi/icons";
12
+
13
+ const TestConnection = ({
14
+ settings,
15
+ isTesting,
16
+ testResult,
17
+ onTestConnection,
18
+ }) => {
19
+ const mode = (settings?.mode || "test").toLowerCase();
20
+
21
+ return (
22
+ <Card padding={8}>
23
+ <CardBody>
24
+ <Flex direction="column" alignItems="stretch" gap={6} paddingTop={6}>
25
+ <Box>
26
+ <Typography
27
+ variant="delta"
28
+ as="h3"
29
+ fontWeight="bold"
30
+ style={{ marginBottom: "16px" }}
31
+ >
32
+ Test Connection
33
+ </Typography>
34
+
35
+ {mode === "test" ? (
36
+ <Typography variant="pi" textColor="neutral600">
37
+ Verify your Payone configuration by testing the API connection
38
+ </Typography>
39
+ ) : (
40
+ <Typography
41
+ variant="pi"
42
+ textColor="neutral600"
43
+ style={{ marginTop: "8px" }}
44
+ >
45
+ Test Connection is disabled in live mode.
46
+ </Typography>
47
+ )}
48
+ </Box>
49
+
50
+ <Button
51
+ variant="default"
52
+ onClick={onTestConnection}
53
+ loading={isTesting}
54
+ startIcon={<Play />}
55
+ className="payment-button payment-button-success"
56
+ disabled={mode === "live"}
57
+ style={{ maxWidth: "200px" }}
58
+ >
59
+ {isTesting ? "Testing Connection..." : "Test Connection"}
60
+ </Button>
61
+
62
+ {testResult && (
63
+ <Flex direction={"column"} alignItems={"stretch"} gap={2}>
64
+ <Typography
65
+ variant="pi"
66
+ fontWeight="medium"
67
+ style={{ marginBottom: "16px" }}
68
+ >
69
+ {testResult.message}
70
+ </Typography>
71
+ {testResult.details && Boolean(testResult.success) ? (
72
+ <Box paddingTop={3}>
73
+ <Card>
74
+ <CardBody padding={4}>
75
+ <Flex direction="column" alignItems="stretch" gap={2}>
76
+ {testResult.details.mode && (
77
+ <Typography variant="pi" textColor="neutral600">
78
+ <strong>Mode:</strong> {testResult.details.mode}
79
+ </Typography>
80
+ )}
81
+ {testResult.details.aid && (
82
+ <Typography variant="pi" textColor="neutral600">
83
+ <strong>AID:</strong> {testResult.details.aid}
84
+ </Typography>
85
+ )}
86
+ {testResult.details.portalid && (
87
+ <Typography variant="pi" textColor="neutral600">
88
+ <strong>Portal ID:</strong>{" "}
89
+ {testResult.details.portalid}
90
+ </Typography>
91
+ )}
92
+ </Flex>
93
+ </CardBody>
94
+ </Card>
95
+ </Box>
96
+ ) : (
97
+ <Card>
98
+ <CardBody padding={4}>
99
+ <Flex direction="column" alignItems="stretch" gap={2}>
100
+ {testResult.error && (
101
+ <Typography variant="pi" textColor="neutral600">
102
+ <strong>Error Code:</strong>{" "}
103
+ {testResult.error.ErrorCode}
104
+ </Typography>
105
+ )}
106
+ {testResult.error.ErrorMessage && (
107
+ <Typography variant="pi" textColor="neutral600">
108
+ <strong>Error Message:</strong>{" "}
109
+ {testResult.error.ErrorMessage}
110
+ </Typography>
111
+ )}
112
+ {testResult.error.CustomerMessage && (
113
+ <Typography variant="pi" textColor="neutral600">
114
+ <strong>Customer Message:</strong>{" "}
115
+ {testResult.error.CustomerMessage}
116
+ </Typography>
117
+ )}
118
+ </Flex>
119
+ </CardBody>
120
+ </Card>
121
+ )}
122
+ </Flex>
123
+ )}
124
+ </Flex>
125
+ </CardBody>
126
+ </Card>
127
+ );
128
+ };
129
+
130
+ export default TestConnection;