strapi-plugin-payone-provider 1.0.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.
- package/README.md +571 -0
- package/admin/src/components/Initializer/index.js +16 -0
- package/admin/src/components/PluginIcon/index.js +6 -0
- package/admin/src/index.js +37 -0
- package/admin/src/pages/App/components/ConfigurationPanel.js +265 -0
- package/admin/src/pages/App/components/HistoryPanel.js +298 -0
- package/admin/src/pages/App/components/PaymentActionsPanel.js +333 -0
- package/admin/src/pages/App/components/StatusBadge.js +22 -0
- package/admin/src/pages/App/components/TransactionHistoryItem.js +374 -0
- package/admin/src/pages/App/components/icons/BankIcon.js +10 -0
- package/admin/src/pages/App/components/icons/ChevronDownIcon.js +9 -0
- package/admin/src/pages/App/components/icons/ChevronUpIcon.js +9 -0
- package/admin/src/pages/App/components/icons/CreditCardIcon.js +9 -0
- package/admin/src/pages/App/components/icons/ErrorIcon.js +10 -0
- package/admin/src/pages/App/components/icons/InfoIcon.js +9 -0
- package/admin/src/pages/App/components/icons/PaymentIcon.js +10 -0
- package/admin/src/pages/App/components/icons/PendingIcon.js +9 -0
- package/admin/src/pages/App/components/icons/PersonIcon.js +9 -0
- package/admin/src/pages/App/components/icons/SuccessIcon.js +9 -0
- package/admin/src/pages/App/components/icons/WalletIcon.js +9 -0
- package/admin/src/pages/App/components/icons/index.js +11 -0
- package/admin/src/pages/App/index.js +483 -0
- package/admin/src/pages/utils/api.js +75 -0
- package/admin/src/pages/utils/formatTransactionData.js +16 -0
- package/admin/src/pages/utils/paymentUtils.js +528 -0
- package/admin/src/pluginId.js +5 -0
- package/package.json +43 -0
- package/server/bootstrap.js +26 -0
- package/server/config/index.js +42 -0
- package/server/controllers/index.js +7 -0
- package/server/controllers/payone.js +134 -0
- package/server/destroy.js +5 -0
- package/server/index.js +21 -0
- package/server/policies/index.js +6 -0
- package/server/policies/isAuth.js +23 -0
- package/server/policies/isSuperAdmin.js +18 -0
- package/server/register.js +5 -0
- package/server/routes/index.js +124 -0
- package/server/services/index.js +7 -0
- package/server/services/payone.js +679 -0
- package/strapi-admin.js +3 -0
- package/strapi-server.js +3 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
CardBody,
|
|
7
|
+
Divider,
|
|
8
|
+
Flex,
|
|
9
|
+
Stack,
|
|
10
|
+
Typography,
|
|
11
|
+
TextInput,
|
|
12
|
+
Alert
|
|
13
|
+
} from "@strapi/design-system";
|
|
14
|
+
import { Play } from "@strapi/icons";
|
|
15
|
+
import StatusBadge from "./StatusBadge";
|
|
16
|
+
import { formatTransactionData } from "../../utils/formatTransactionData";
|
|
17
|
+
|
|
18
|
+
const PaymentActionsPanel = ({
|
|
19
|
+
paymentAmount,
|
|
20
|
+
setPaymentAmount,
|
|
21
|
+
preauthReference,
|
|
22
|
+
setPreauthReference,
|
|
23
|
+
authReference,
|
|
24
|
+
setAuthReference,
|
|
25
|
+
captureTxid,
|
|
26
|
+
setCaptureTxid,
|
|
27
|
+
refundTxid,
|
|
28
|
+
setRefundTxid,
|
|
29
|
+
refundSequenceNumber,
|
|
30
|
+
setRefundSequenceNumber,
|
|
31
|
+
refundReference,
|
|
32
|
+
setRefundReference,
|
|
33
|
+
isProcessingPayment,
|
|
34
|
+
paymentError,
|
|
35
|
+
paymentResult,
|
|
36
|
+
onPreauthorization,
|
|
37
|
+
onAuthorization,
|
|
38
|
+
onCapture,
|
|
39
|
+
onRefund
|
|
40
|
+
}) => {
|
|
41
|
+
return (
|
|
42
|
+
<Box
|
|
43
|
+
background="neutral0"
|
|
44
|
+
hasRadius
|
|
45
|
+
shadow="filterShadow"
|
|
46
|
+
paddingTop={6}
|
|
47
|
+
paddingBottom={6}
|
|
48
|
+
paddingLeft={7}
|
|
49
|
+
paddingRight={7}
|
|
50
|
+
>
|
|
51
|
+
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
52
|
+
<Typography variant="beta" as="h2">
|
|
53
|
+
Payment Actions
|
|
54
|
+
</Typography>
|
|
55
|
+
|
|
56
|
+
{/* Preauthorization */}
|
|
57
|
+
<Box>
|
|
58
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
59
|
+
<Typography variant="delta" as="h3">
|
|
60
|
+
Preauthorization
|
|
61
|
+
</Typography>
|
|
62
|
+
<Typography variant="pi" textColor="neutral600">
|
|
63
|
+
Reserve an amount on a credit card without capturing it
|
|
64
|
+
immediately.
|
|
65
|
+
</Typography>
|
|
66
|
+
|
|
67
|
+
<Flex gap={4}>
|
|
68
|
+
<TextInput
|
|
69
|
+
label="Amount (in cents) *"
|
|
70
|
+
name="paymentAmount"
|
|
71
|
+
value={paymentAmount}
|
|
72
|
+
onChange={(e) => setPaymentAmount(e.target.value)}
|
|
73
|
+
placeholder="Enter amount (e.g., 1000 for €10.00)"
|
|
74
|
+
hint="Amount in cents (e.g., 1000 = €10.00)"
|
|
75
|
+
required
|
|
76
|
+
style={{ flex: 1 }}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<TextInput
|
|
80
|
+
label="Reference *"
|
|
81
|
+
name="preauthReference"
|
|
82
|
+
value={preauthReference}
|
|
83
|
+
onChange={(e) => setPreauthReference(e.target.value)}
|
|
84
|
+
placeholder="Enter reference"
|
|
85
|
+
hint="Reference for this transaction"
|
|
86
|
+
required
|
|
87
|
+
style={{ flex: 1 }}
|
|
88
|
+
/>
|
|
89
|
+
</Flex>
|
|
90
|
+
|
|
91
|
+
<Button
|
|
92
|
+
variant="default"
|
|
93
|
+
onClick={onPreauthorization}
|
|
94
|
+
loading={isProcessingPayment}
|
|
95
|
+
startIcon={<Play />}
|
|
96
|
+
fullWidth={false}
|
|
97
|
+
disabled={!paymentAmount.trim() || !preauthReference.trim()}
|
|
98
|
+
>
|
|
99
|
+
Process Preauthorization
|
|
100
|
+
</Button>
|
|
101
|
+
</Flex>
|
|
102
|
+
</Box>
|
|
103
|
+
|
|
104
|
+
<Divider />
|
|
105
|
+
|
|
106
|
+
{/* Authorization */}
|
|
107
|
+
<Box>
|
|
108
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
109
|
+
<Typography variant="delta" as="h3">
|
|
110
|
+
Authorization
|
|
111
|
+
</Typography>
|
|
112
|
+
<Typography variant="pi" textColor="neutral600">
|
|
113
|
+
Authorize and capture an amount immediately.
|
|
114
|
+
</Typography>
|
|
115
|
+
|
|
116
|
+
<Flex gap={4}>
|
|
117
|
+
<TextInput
|
|
118
|
+
label="Amount (in cents) *"
|
|
119
|
+
name="authAmount"
|
|
120
|
+
value={paymentAmount}
|
|
121
|
+
onChange={(e) => setPaymentAmount(e.target.value)}
|
|
122
|
+
placeholder="Enter amount (e.g., 1000 for €10.00)"
|
|
123
|
+
hint="Amount in cents (e.g., 1000 = €10.00)"
|
|
124
|
+
required
|
|
125
|
+
style={{ flex: 1 }}
|
|
126
|
+
/>
|
|
127
|
+
|
|
128
|
+
<TextInput
|
|
129
|
+
label="Reference *"
|
|
130
|
+
name="authReference"
|
|
131
|
+
value={authReference}
|
|
132
|
+
onChange={(e) => setAuthReference(e.target.value)}
|
|
133
|
+
placeholder="Enter reference"
|
|
134
|
+
hint="Reference for this transaction"
|
|
135
|
+
required
|
|
136
|
+
style={{ flex: 1 }}
|
|
137
|
+
/>
|
|
138
|
+
</Flex>
|
|
139
|
+
|
|
140
|
+
<Button
|
|
141
|
+
variant="default"
|
|
142
|
+
onClick={onAuthorization}
|
|
143
|
+
loading={isProcessingPayment}
|
|
144
|
+
startIcon={<Play />}
|
|
145
|
+
fullWidth={false}
|
|
146
|
+
disabled={!paymentAmount.trim() || !authReference.trim()}
|
|
147
|
+
>
|
|
148
|
+
Process Authorization
|
|
149
|
+
</Button>
|
|
150
|
+
</Flex>
|
|
151
|
+
</Box>
|
|
152
|
+
|
|
153
|
+
<Divider />
|
|
154
|
+
|
|
155
|
+
{/* Capture */}
|
|
156
|
+
<Box>
|
|
157
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
158
|
+
<Typography variant="delta" as="h3">
|
|
159
|
+
Capture
|
|
160
|
+
</Typography>
|
|
161
|
+
<Typography variant="pi" textColor="neutral600">
|
|
162
|
+
Capture a previously authorized amount. Note: Reference parameter
|
|
163
|
+
is not supported by Payone capture.
|
|
164
|
+
</Typography>
|
|
165
|
+
|
|
166
|
+
<Flex gap={4}>
|
|
167
|
+
<TextInput
|
|
168
|
+
label="Transaction ID"
|
|
169
|
+
name="captureTxid"
|
|
170
|
+
value={captureTxid}
|
|
171
|
+
onChange={(e) => setCaptureTxid(e.target.value)}
|
|
172
|
+
placeholder="Enter TxId from preauthorization"
|
|
173
|
+
hint="Transaction ID from a previous preauthorization"
|
|
174
|
+
style={{ flex: 1 }}
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
<TextInput
|
|
178
|
+
label="Amount (in cents)"
|
|
179
|
+
name="captureAmount"
|
|
180
|
+
value={paymentAmount}
|
|
181
|
+
onChange={(e) => setPaymentAmount(e.target.value)}
|
|
182
|
+
placeholder="1000"
|
|
183
|
+
hint="Amount in cents to capture"
|
|
184
|
+
style={{ flex: 1 }}
|
|
185
|
+
/>
|
|
186
|
+
</Flex>
|
|
187
|
+
|
|
188
|
+
<Button
|
|
189
|
+
variant="default"
|
|
190
|
+
onClick={onCapture}
|
|
191
|
+
loading={isProcessingPayment}
|
|
192
|
+
startIcon={<Play />}
|
|
193
|
+
fullWidth={false}
|
|
194
|
+
disabled={!captureTxid.trim() || !paymentAmount.trim()}
|
|
195
|
+
>
|
|
196
|
+
Process Capture
|
|
197
|
+
</Button>
|
|
198
|
+
</Flex>
|
|
199
|
+
</Box>
|
|
200
|
+
|
|
201
|
+
<Divider />
|
|
202
|
+
|
|
203
|
+
{/* Refund */}
|
|
204
|
+
<Box>
|
|
205
|
+
<Flex direction="column" alignItems="stretch" gap={4}>
|
|
206
|
+
<Typography variant="delta" as="h3">
|
|
207
|
+
Refund
|
|
208
|
+
</Typography>
|
|
209
|
+
<Typography variant="pi" textColor="neutral600">
|
|
210
|
+
Refund a previously captured amount.
|
|
211
|
+
</Typography>
|
|
212
|
+
|
|
213
|
+
<Flex gap={4}>
|
|
214
|
+
<TextInput
|
|
215
|
+
label="Transaction ID"
|
|
216
|
+
name="refundTxid"
|
|
217
|
+
value={refundTxid}
|
|
218
|
+
onChange={(e) => setRefundTxid(e.target.value)}
|
|
219
|
+
placeholder="Enter TxId from capture"
|
|
220
|
+
hint="Transaction ID from a previous capture"
|
|
221
|
+
style={{ flex: 1 }}
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
<TextInput
|
|
225
|
+
label="Sequence Number"
|
|
226
|
+
name="refundSequenceNumber"
|
|
227
|
+
value={refundSequenceNumber}
|
|
228
|
+
onChange={(e) => setRefundSequenceNumber(e.target.value)}
|
|
229
|
+
placeholder="2"
|
|
230
|
+
hint="Sequence number for this refund (1-127) and by default for first 2"
|
|
231
|
+
style={{ flex: 1 }}
|
|
232
|
+
/>
|
|
233
|
+
|
|
234
|
+
<TextInput
|
|
235
|
+
label="Amount (in cents)"
|
|
236
|
+
name="refundAmount"
|
|
237
|
+
value={paymentAmount}
|
|
238
|
+
onChange={(e) => setPaymentAmount(e.target.value)}
|
|
239
|
+
placeholder="1000"
|
|
240
|
+
hint="Amount in cents to refund (will be negative)"
|
|
241
|
+
style={{ flex: 1 }}
|
|
242
|
+
/>
|
|
243
|
+
|
|
244
|
+
<TextInput
|
|
245
|
+
label="Reference"
|
|
246
|
+
name="refundReference"
|
|
247
|
+
value={refundReference}
|
|
248
|
+
onChange={(e) => setRefundReference(e.target.value)}
|
|
249
|
+
placeholder="Optional reference"
|
|
250
|
+
hint="Optional reference for this refund"
|
|
251
|
+
style={{ flex: 1 }}
|
|
252
|
+
/>
|
|
253
|
+
</Flex>
|
|
254
|
+
|
|
255
|
+
<Button
|
|
256
|
+
variant="default"
|
|
257
|
+
onClick={onRefund}
|
|
258
|
+
loading={isProcessingPayment}
|
|
259
|
+
startIcon={<Play />}
|
|
260
|
+
fullWidth={false}
|
|
261
|
+
disabled={!refundTxid.trim() || !paymentAmount.trim()}
|
|
262
|
+
>
|
|
263
|
+
Process Refund
|
|
264
|
+
</Button>
|
|
265
|
+
</Flex>
|
|
266
|
+
</Box>
|
|
267
|
+
|
|
268
|
+
<Divider />
|
|
269
|
+
|
|
270
|
+
{paymentError && (
|
|
271
|
+
<Alert variant="danger" title="Error">
|
|
272
|
+
{paymentError}
|
|
273
|
+
</Alert>
|
|
274
|
+
)}
|
|
275
|
+
|
|
276
|
+
{paymentResult && (
|
|
277
|
+
<Card>
|
|
278
|
+
<CardBody>
|
|
279
|
+
<Stack spacing={4}>
|
|
280
|
+
<Flex justifyContent="space-between" alignItems="center">
|
|
281
|
+
<Typography variant="delta" as="h3">
|
|
282
|
+
Payment Result
|
|
283
|
+
</Typography>
|
|
284
|
+
{paymentResult.Status && (
|
|
285
|
+
<StatusBadge status={paymentResult.Status} />
|
|
286
|
+
)}
|
|
287
|
+
</Flex>
|
|
288
|
+
|
|
289
|
+
<Divider />
|
|
290
|
+
|
|
291
|
+
<Box>
|
|
292
|
+
<Stack spacing={3}>
|
|
293
|
+
{formatTransactionData(paymentResult).map((item, index) => (
|
|
294
|
+
<Flex
|
|
295
|
+
key={index}
|
|
296
|
+
justifyContent="space-between"
|
|
297
|
+
alignItems="start"
|
|
298
|
+
>
|
|
299
|
+
<Typography
|
|
300
|
+
variant="pi"
|
|
301
|
+
textColor="neutral600"
|
|
302
|
+
style={{ minWidth: "200px" }}
|
|
303
|
+
>
|
|
304
|
+
{item.key}:
|
|
305
|
+
</Typography>
|
|
306
|
+
<Typography
|
|
307
|
+
variant="pi"
|
|
308
|
+
style={{ flex: 1, textAlign: "right" }}
|
|
309
|
+
>
|
|
310
|
+
{item.value}
|
|
311
|
+
</Typography>
|
|
312
|
+
</Flex>
|
|
313
|
+
))}
|
|
314
|
+
</Stack>
|
|
315
|
+
</Box>
|
|
316
|
+
</Stack>
|
|
317
|
+
</CardBody>
|
|
318
|
+
</Card>
|
|
319
|
+
)}
|
|
320
|
+
|
|
321
|
+
<Box paddingTop={4}>
|
|
322
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
323
|
+
Note: These payment actions allow you to test the complete payment
|
|
324
|
+
flow: Preauthorization → Capture → Refund. Make sure to use valid
|
|
325
|
+
Transaction IDs for capture and refund operations.
|
|
326
|
+
</Typography>
|
|
327
|
+
</Box>
|
|
328
|
+
</Flex>
|
|
329
|
+
</Box>
|
|
330
|
+
);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
export default PaymentActionsPanel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Badge } from "@strapi/design-system";
|
|
3
|
+
|
|
4
|
+
const StatusBadge = ({ status }) => {
|
|
5
|
+
const statusColors = {
|
|
6
|
+
APPROVED: "success",
|
|
7
|
+
PENDING: "warning",
|
|
8
|
+
ERROR: "danger",
|
|
9
|
+
FAILED: "danger"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Badge
|
|
14
|
+
textColor="neutral0"
|
|
15
|
+
backgroundColor={statusColors[status] || "default"}
|
|
16
|
+
>
|
|
17
|
+
{status}
|
|
18
|
+
</Badge>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default StatusBadge;
|