strapi-plugin-payone-provider 1.6.0 → 1.6.1

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 (42) hide show
  1. package/admin/src/components/Initializer/index.js +16 -0
  2. package/admin/src/components/PluginIcon/index.js +6 -0
  3. package/admin/src/pages/App/components/AppHeader.js +55 -0
  4. package/admin/src/pages/App/components/AppTabs.js +158 -0
  5. package/admin/src/pages/App/components/ApplePayButton.js +950 -0
  6. package/admin/src/pages/App/components/ApplePayConfig.js +364 -0
  7. package/admin/src/pages/App/components/ApplePayConfigPanel.js +81 -0
  8. package/admin/src/pages/App/components/ConfigurationPanel.js +280 -0
  9. package/admin/src/pages/App/components/DocsPanel.js +1057 -0
  10. package/admin/src/pages/App/components/GooglePayConfig.js +217 -0
  11. package/admin/src/pages/App/components/GooglePayConfigPanel.js +82 -0
  12. package/admin/src/pages/App/components/GooglePaybutton.js +300 -0
  13. package/admin/src/pages/App/components/HistoryPanel.js +285 -0
  14. package/admin/src/pages/App/components/PaymentActionsPanel.js +190 -0
  15. package/admin/src/pages/App/components/StatusBadge.js +24 -0
  16. package/admin/src/pages/App/components/TransactionHistoryItem.js +377 -0
  17. package/admin/src/pages/App/components/icons/BankIcon.js +10 -0
  18. package/admin/src/pages/App/components/icons/ChevronDownIcon.js +9 -0
  19. package/admin/src/pages/App/components/icons/ChevronUpIcon.js +9 -0
  20. package/admin/src/pages/App/components/icons/CreditCardIcon.js +9 -0
  21. package/admin/src/pages/App/components/icons/ErrorIcon.js +10 -0
  22. package/admin/src/pages/App/components/icons/InfoIcon.js +9 -0
  23. package/admin/src/pages/App/components/icons/PaymentIcon.js +10 -0
  24. package/admin/src/pages/App/components/icons/PendingIcon.js +9 -0
  25. package/admin/src/pages/App/components/icons/PersonIcon.js +9 -0
  26. package/admin/src/pages/App/components/icons/SuccessIcon.js +9 -0
  27. package/admin/src/pages/App/components/icons/WalletIcon.js +9 -0
  28. package/admin/src/pages/App/components/icons/index.js +11 -0
  29. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.js +195 -0
  30. package/admin/src/pages/App/components/paymentActions/CaptureForm.js +65 -0
  31. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.js +191 -0
  32. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.js +156 -0
  33. package/admin/src/pages/App/components/paymentActions/PaymentResult.js +148 -0
  34. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.js +199 -0
  35. package/admin/src/pages/App/components/paymentActions/RefundForm.js +90 -0
  36. package/admin/src/pages/App/index.js +127 -0
  37. package/admin/src/pages/hooks/usePaymentActions.js +171 -0
  38. package/package.json +49 -49
  39. package/server/bootstrap.js +7 -0
  40. package/server/controllers/payone.js +0 -2
  41. package/server/services/transactionService.js +28 -0
  42. package/server/utils/paymentMethodParams.js +1 -7
@@ -0,0 +1,280 @@
1
+ import React, { useEffect } from "react";
2
+ import {
3
+ Box,
4
+ Button,
5
+ Card,
6
+ CardBody,
7
+ Flex,
8
+ Stack,
9
+ Typography,
10
+ TextInput,
11
+ Select,
12
+ Option,
13
+ Alert
14
+ } from "@strapi/design-system";
15
+ import { Play } from "@strapi/icons";
16
+
17
+ const ConfigurationPanel = ({
18
+ settings,
19
+ isSaving,
20
+ isTesting,
21
+ testResult,
22
+ onSave,
23
+ onTestConnection,
24
+ onInputChange
25
+ }) => {
26
+ const mode = (settings?.mode || "test").toLowerCase();
27
+
28
+ useEffect(() => {
29
+ if (settings?.mode) {
30
+ const currentMode = (settings.mode || "test").toLowerCase();
31
+ console.log("[ConfigurationPanel] Mode updated:", currentMode);
32
+ }
33
+ }, [settings?.mode]);
34
+
35
+
36
+ return (
37
+ <Box
38
+ className="payment-container"
39
+ paddingTop={8}
40
+ paddingBottom={8}
41
+ paddingLeft={8}
42
+ paddingRight={8}
43
+ >
44
+ <Flex direction="column" alignItems="stretch" gap={8}>
45
+ <Box>
46
+ <Typography variant="beta" as="h2" fontWeight="bold" className="payment-title" style={{ fontSize: '20px', marginBottom: '4px' }}>
47
+ Payone API Configuration
48
+ </Typography>
49
+ <Typography variant="pi" textColor="neutral600" marginTop={2} className="payment-subtitle" style={{ fontSize: '14px' }}>
50
+ Configure your Payone payment gateway settings
51
+ </Typography>
52
+ </Box>
53
+
54
+ <Box>
55
+ <Card className="payment-card">
56
+ <CardBody padding={6}>
57
+ <Stack spacing={6}>
58
+ <Flex gap={4} wrap="wrap">
59
+ <TextInput
60
+ label="Account ID (aid)"
61
+ name="aid"
62
+ value={settings.aid || ""}
63
+ onChange={(e) => onInputChange("aid", e.target.value)}
64
+ required
65
+ hint="Your Payone account ID"
66
+ className="payment-input"
67
+ style={{ flex: 1, minWidth: "300px" }}
68
+ />
69
+
70
+ <TextInput
71
+ label="Portal ID"
72
+ name="portalid"
73
+ value={settings.portalid || ""}
74
+ onChange={(e) => onInputChange("portalid", e.target.value)}
75
+ required
76
+ hint="Your Payone portal ID"
77
+ className="payment-input"
78
+ style={{ flex: 1, minWidth: "300px" }}
79
+ />
80
+ </Flex>
81
+
82
+ <Flex gap={4} wrap="wrap">
83
+ <TextInput
84
+ label="Merchant ID (mid)"
85
+ name="mid"
86
+ value={settings.mid || ""}
87
+ onChange={(e) => onInputChange("mid", e.target.value)}
88
+ required
89
+ hint="Your Payone merchant ID"
90
+ className="payment-input"
91
+ style={{ flex: 1, minWidth: "300px" }}
92
+ />
93
+
94
+ <TextInput
95
+ label="Portal Key"
96
+ name="key"
97
+ type="password"
98
+ value={settings.key || ""}
99
+ onChange={(e) => onInputChange("key", e.target.value)}
100
+ required
101
+ hint="Your Payone portal key (will be encrypted)"
102
+ className="payment-input"
103
+ style={{ flex: 1, minWidth: "300px" }}
104
+ />
105
+ </Flex>
106
+
107
+ <Flex gap={4} wrap="wrap">
108
+ <Select
109
+ label="Mode"
110
+ name="mode"
111
+ value={settings.mode || "test"}
112
+ onChange={(value) => onInputChange("mode", value)}
113
+ hint="Select the API mode"
114
+ className="payment-input"
115
+ style={{ flex: 1, minWidth: "300px" }}
116
+ >
117
+ <Option value="test">Test</Option>
118
+ <Option value="live">Live</Option>
119
+ </Select>
120
+
121
+ <TextInput
122
+ label="API Version"
123
+ name="api_version"
124
+ value={settings.api_version || "3.10"}
125
+ onChange={(e) =>
126
+ onInputChange("api_version", e.target.value)
127
+ }
128
+ hint="Payone API version"
129
+ className="payment-input"
130
+ style={{ flex: 1, minWidth: "300px" }}
131
+ />
132
+ </Flex>
133
+
134
+ <Flex direction="column" wrap="wrap" gap={1} alignItems="flex-start">
135
+ <Select
136
+ label="Enable 3D Secure"
137
+ name="enable3DSecure"
138
+ value={settings.enable3DSecure ? "yes" : "no"}
139
+ onChange={(value) =>
140
+ onInputChange("enable3DSecure", value === "yes")
141
+ }
142
+ hint="Enable 3D Secure authentication for credit card payments"
143
+ className="payment-input"
144
+ >
145
+ <Option value="yes">Enabled</Option>
146
+ <Option value="no">Disabled</Option>
147
+ </Select>
148
+ <Typography variant="pi" textColor="neutral600" marginTop={1}>
149
+ When enabled, credit card payments will require 3D Secure authentication (SCA compliance)
150
+ </Typography>
151
+ </Flex>
152
+ </Stack>
153
+ </CardBody>
154
+ </Card>
155
+ </Box>
156
+
157
+ <Box paddingTop={6}>
158
+ <Card className="payment-card">
159
+ <CardBody padding={6}>
160
+ <Stack spacing={6}>
161
+ <Box>
162
+ <Typography
163
+ variant="delta"
164
+ as="h3"
165
+ fontWeight="bold"
166
+ marginBottom={2}
167
+ >
168
+ Test Connection
169
+ </Typography>
170
+ <Typography variant="pi" textColor="neutral600">
171
+ Verify your Payone configuration by testing the API
172
+ connection
173
+ </Typography>
174
+ </Box>
175
+
176
+ <Button
177
+ variant="default"
178
+ onClick={onTestConnection}
179
+ loading={isTesting}
180
+ startIcon={<Play />}
181
+ className="payment-button payment-button-success"
182
+ disabled={mode === 'live'}
183
+ >
184
+ {isTesting ? "Testing Connection..." : "Test Connection"}
185
+ </Button>
186
+ {mode === 'live' && (
187
+ <Typography variant="pi" textColor="neutral600" style={{ marginTop: "8px" }}>
188
+ Test Connection is disabled in live mode for security reasons.
189
+ </Typography>
190
+ )}
191
+
192
+ {testResult && (
193
+ <Alert
194
+ variant={Boolean(testResult.success) ? "success" : "danger"}
195
+ title={
196
+ Boolean(testResult.success)
197
+ ? "Connection Successful"
198
+ : "Connection Failed"
199
+ }
200
+ className="payment-alert"
201
+ >
202
+ <Typography
203
+ variant="pi"
204
+ fontWeight="medium"
205
+ marginBottom={2}
206
+ >
207
+ {testResult.message}
208
+ </Typography>
209
+ {testResult.details && (
210
+ <Box paddingTop={3}>
211
+ {Boolean(testResult.success) ? (
212
+ <Card className="payment-card">
213
+ <CardBody padding={4}>
214
+ <Typography variant="pi">
215
+ <strong>Mode:</strong> {testResult.details.mode}{" "}
216
+ |<strong> AID:</strong> {testResult.details.aid}{" "}
217
+ |<strong> Portal ID:</strong>{" "}
218
+ {testResult.details.portalid} |
219
+ <strong> Merchant ID:</strong>{" "}
220
+ {testResult.details.mid || ""}
221
+ </Typography>
222
+ </CardBody>
223
+ </Card>
224
+ ) : (
225
+ <Card className="payment-card" style={{ background: "#fff5f5" }}>
226
+ <CardBody padding={4}>
227
+ <Stack spacing={2}>
228
+ {testResult.errorcode && (
229
+ <Typography
230
+ variant="pi"
231
+ textColor="neutral600"
232
+ >
233
+ <strong>Error Code:</strong>{" "}
234
+ {testResult.errorcode}
235
+ </Typography>
236
+ )}
237
+ {testResult.details.errorCode && (
238
+ <Typography
239
+ variant="pi"
240
+ textColor="neutral600"
241
+ >
242
+ <strong>Error Code:</strong>{" "}
243
+ {testResult.details.errorCode}
244
+ </Typography>
245
+ )}
246
+ {testResult.details &&
247
+ testResult.details.rawResponse && (
248
+ <Typography
249
+ variant="pi"
250
+ textColor="neutral600"
251
+ >
252
+ <strong>Debug Info:</strong>{" "}
253
+ {testResult.details.rawResponse}
254
+ </Typography>
255
+ )}
256
+ </Stack>
257
+ </CardBody>
258
+ </Card>
259
+ )}
260
+ </Box>
261
+ )}
262
+ </Alert>
263
+ )}
264
+ </Stack>
265
+ </CardBody>
266
+ </Card>
267
+ </Box>
268
+
269
+ <Box paddingTop={4}>
270
+ <Typography variant="sigma" textColor="neutral600">
271
+ Note: These settings are used for all Payone API requests. Make sure
272
+ to use the correct credentials for your selected mode.
273
+ </Typography>
274
+ </Box>
275
+ </Flex>
276
+ </Box>
277
+ );
278
+ };
279
+
280
+ export default ConfigurationPanel;