strapi-plugin-payone-provider 1.5.8 → 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 (53) hide show
  1. package/admin/src/components/Initializer/index.jsx +16 -0
  2. package/admin/src/components/PluginIcon/index.jsx +6 -0
  3. package/admin/src/index.js +3 -3
  4. package/admin/src/pages/App/components/AppHeader.jsx +55 -0
  5. package/admin/src/pages/App/components/AppTabs.jsx +158 -0
  6. package/admin/src/pages/App/components/ApplePayBtn.jsx +304 -0
  7. package/admin/src/pages/App/components/ApplePayButton.js +139 -93
  8. package/admin/src/pages/App/components/ApplePayButton.jsx +908 -0
  9. package/admin/src/pages/App/components/ApplePayConfig.jsx +298 -0
  10. package/admin/src/pages/App/components/ApplePayConfigPanel.jsx +81 -0
  11. package/admin/src/pages/App/components/ConfigurationPanel.jsx +280 -0
  12. package/admin/src/pages/App/components/DocsPanel.jsx +1057 -0
  13. package/admin/src/pages/App/components/GooglePayConfig.jsx +217 -0
  14. package/admin/src/pages/App/components/GooglePayConfigPanel.jsx +82 -0
  15. package/admin/src/pages/App/components/GooglePaybutton.jsx +300 -0
  16. package/admin/src/pages/App/components/HistoryPanel.jsx +285 -0
  17. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +238 -0
  18. package/admin/src/pages/App/components/StatusBadge.jsx +24 -0
  19. package/admin/src/pages/App/components/TransactionHistoryItem.jsx +377 -0
  20. package/admin/src/pages/App/components/icons/BankIcon.jsx +10 -0
  21. package/admin/src/pages/App/components/icons/ChevronDownIcon.jsx +9 -0
  22. package/admin/src/pages/App/components/icons/ChevronUpIcon.jsx +9 -0
  23. package/admin/src/pages/App/components/icons/CreditCardIcon.jsx +9 -0
  24. package/admin/src/pages/App/components/icons/ErrorIcon.jsx +10 -0
  25. package/admin/src/pages/App/components/icons/InfoIcon.jsx +9 -0
  26. package/admin/src/pages/App/components/icons/PaymentIcon.jsx +10 -0
  27. package/admin/src/pages/App/components/icons/PendingIcon.jsx +9 -0
  28. package/admin/src/pages/App/components/icons/PersonIcon.jsx +9 -0
  29. package/admin/src/pages/App/components/icons/SuccessIcon.jsx +9 -0
  30. package/admin/src/pages/App/components/icons/WalletIcon.jsx +9 -0
  31. package/admin/src/pages/App/components/icons/index.jsx +11 -0
  32. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +205 -0
  33. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +65 -0
  34. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.jsx +191 -0
  35. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +236 -0
  36. package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +148 -0
  37. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +132 -0
  38. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +90 -0
  39. package/admin/src/pages/App/index.jsx +127 -0
  40. package/admin/src/pages/constants/paymentConstants.js +1 -2
  41. package/admin/src/pages/hooks/usePaymentActions.js +96 -0
  42. package/package.json +2 -2
  43. package/server/bootstrap.js +65 -0
  44. package/server/controllers/payone.js +4 -48
  45. package/server/routes/index.js +1 -1
  46. package/server/services/applePayService.js +51 -407
  47. package/server/services/paymentService.js +0 -68
  48. package/server/services/payone.js +0 -3
  49. package/server/services/settingsService.js +0 -21
  50. package/server/services/testConnectionService.js +0 -14
  51. package/server/services/transactionService.js +14 -0
  52. package/server/utils/paymentMethodParams.js +60 -27
  53. package/server/utils/requestBuilder.js +0 -22
@@ -0,0 +1,285 @@
1
+ import React from "react";
2
+ import {
3
+ Box,
4
+ Button,
5
+ Card,
6
+ CardBody,
7
+ Flex,
8
+ Stack,
9
+ Typography,
10
+ TextInput,
11
+ Divider
12
+ } from "@strapi/design-system";
13
+ import { Search } from "@strapi/icons";
14
+ import TransactionHistoryItem from "./TransactionHistoryItem";
15
+
16
+ const HistoryPanel = ({
17
+ filters,
18
+ onFilterChange,
19
+ onFilterApply,
20
+ isLoadingHistory,
21
+ transactionHistory,
22
+ paginatedTransactions,
23
+ currentPage,
24
+ totalPages,
25
+ pageSize,
26
+ onRefresh,
27
+ onPageChange
28
+ }) => {
29
+
30
+ return (
31
+ <Box
32
+ className="payment-container"
33
+ paddingTop={8}
34
+ paddingBottom={8}
35
+ paddingLeft={8}
36
+ paddingRight={8}
37
+ >
38
+ <Flex direction="column" alignItems="stretch" gap={8}>
39
+ <Box>
40
+ <Typography variant="beta" as="h2" className="payment-title" style={{ fontSize: '20px', marginBottom: '4px' }}>
41
+ Transaction Management
42
+ </Typography>
43
+ <Typography variant="pi" textColor="neutral600" className="payment-subtitle" style={{ fontSize: '14px', marginTop: '4px' }}>
44
+ View and filter all payment transactions processed through Payone
45
+ </Typography>
46
+ </Box>
47
+ {/* Filters */}
48
+ <Box>
49
+ <Box marginBottom={4}>
50
+ <Typography variant="delta" as="h3" fontWeight="bold">
51
+ Transaction Filters
52
+ </Typography>
53
+ <Typography variant="pi" textColor="neutral600" marginTop={2}>
54
+ Filter transactions by status, type, date range, and more
55
+ </Typography>
56
+ </Box>
57
+ <Card className="payment-card">
58
+ <CardBody padding={6}>
59
+ <Stack spacing={4}>
60
+ <Flex gap={4} wrap="wrap" alignItems="center">
61
+ <TextInput
62
+ label="Status"
63
+ name="status"
64
+ value={filters.status}
65
+ onChange={(e) => onFilterChange("status", e.target.value)}
66
+ placeholder="APPROVED, ERROR, etc."
67
+ className="payment-input"
68
+ style={{ flex: 1, minWidth: "200px" }}
69
+ />
70
+ <TextInput
71
+ label="Request Type"
72
+ name="request_type"
73
+ value={filters.request_type}
74
+ onChange={(e) =>
75
+ onFilterChange("request_type", e.target.value)
76
+ }
77
+ placeholder="preauthorization, authorization, etc."
78
+ className="payment-input"
79
+ style={{ flex: 1, minWidth: "200px" }}
80
+ />
81
+ <TextInput
82
+ label="Transaction ID"
83
+ name="txid"
84
+ value={filters.txid}
85
+ onChange={(e) => onFilterChange("txid", e.target.value)}
86
+ placeholder="Enter TxId"
87
+ className="payment-input"
88
+ style={{ flex: 1, minWidth: "200px" }}
89
+ />
90
+ <TextInput
91
+ label="Reference"
92
+ name="reference"
93
+ value={filters.reference}
94
+ onChange={(e) =>
95
+ onFilterChange("reference", e.target.value)
96
+ }
97
+ placeholder="Enter reference"
98
+ className="payment-input"
99
+ style={{ flex: 1, minWidth: "200px" }}
100
+ />
101
+ <TextInput
102
+ label="Date From"
103
+ name="date_from"
104
+ value={filters.date_from}
105
+ onChange={(e) =>
106
+ onFilterChange("date_from", e.target.value)
107
+ }
108
+ placeholder="YYYY-MM-DD"
109
+ type="date"
110
+ className="payment-input"
111
+ style={{ flex: 1, minWidth: "200px" }}
112
+ />
113
+ <TextInput
114
+ label="Date To"
115
+ name="date_to"
116
+ value={filters.date_to}
117
+ onChange={(e) => onFilterChange("date_to", e.target.value)}
118
+ placeholder="YYYY-MM-DD"
119
+ type="date"
120
+ className="payment-input"
121
+ style={{ flex: 1, minWidth: "200px" }}
122
+ />
123
+ <Button
124
+ variant="default"
125
+ onClick={onFilterApply}
126
+ loading={isLoadingHistory}
127
+ startIcon={<Search />}
128
+ className="payment-button payment-button-primary"
129
+ >
130
+ Apply Filters
131
+ </Button>
132
+ </Flex>
133
+ </Stack>
134
+ </CardBody>
135
+ </Card>
136
+ </Box>
137
+
138
+ <Divider />
139
+
140
+ {/* Transaction History */}
141
+ <Box>
142
+ <Box marginBottom={6}>
143
+ <Flex
144
+ justifyContent="space-between"
145
+ alignItems="center"
146
+ marginBottom={4}
147
+ >
148
+ <Box>
149
+ <Typography variant="delta" as="h3" fontWeight="bold">
150
+ Transaction History
151
+ </Typography>
152
+ <Typography variant="pi" textColor="neutral600" marginTop={2}>
153
+ {transactionHistory.length} total transactions •{" "}
154
+ {paginatedTransactions.length} on page {currentPage} of{" "}
155
+ {totalPages}
156
+ </Typography>
157
+ </Box>
158
+ <Button
159
+ variant="default"
160
+ onClick={onRefresh}
161
+ loading={isLoadingHistory}
162
+ startIcon={<Search />}
163
+ size="S"
164
+ className="payment-button payment-button-success"
165
+ >
166
+ Refresh
167
+ </Button>
168
+ </Flex>
169
+ </Box>
170
+
171
+ {isLoadingHistory ? (
172
+ <Box padding={4} textAlign="center">
173
+ <Typography>Loading transactions...</Typography>
174
+ </Box>
175
+ ) : transactionHistory.length === 0 ? (
176
+ <Box padding={4} textAlign="center">
177
+ <Typography textColor="neutral600">
178
+ No transactions found
179
+ </Typography>
180
+ </Box>
181
+ ) : (
182
+ <Box>
183
+ {paginatedTransactions.map((transaction) => (
184
+ <TransactionHistoryItem
185
+ key={transaction.id}
186
+ transaction={transaction}
187
+ />
188
+ ))}
189
+
190
+ {/* Pagination */}
191
+ <Box paddingTop={6} paddingBottom={4}>
192
+ <Card className="payment-card">
193
+ <CardBody padding={4}>
194
+ <Flex justifyContent="space-between" alignItems="center">
195
+ {transactionHistory.length > pageSize &&
196
+ totalPages > 1 ? (
197
+ <Flex gap={3} alignItems="center">
198
+ <Button
199
+ variant="default"
200
+ size="S"
201
+ onClick={() =>
202
+ onPageChange(Math.max(1, currentPage - 1))
203
+ }
204
+ disabled={currentPage === 1}
205
+ className={`payment-button ${currentPage === 1 ? '' : 'payment-button-success'}`}
206
+ style={{
207
+ background: currentPage === 1 ? "#f6f6f9" : undefined,
208
+ color: currentPage === 1 ? "#666687" : undefined
209
+ }}
210
+ >
211
+ ← Previous
212
+ </Button>
213
+
214
+ <Box
215
+ padding={2}
216
+ background="#f6f6f9"
217
+ borderRadius="6px"
218
+ >
219
+ <Typography
220
+ variant="pi"
221
+ textColor="neutral600"
222
+ fontWeight="bold"
223
+ >
224
+ Page {currentPage} of {totalPages}
225
+ </Typography>
226
+ </Box>
227
+
228
+ <Button
229
+ variant="default"
230
+ size="S"
231
+ onClick={() =>
232
+ onPageChange(
233
+ Math.min(totalPages, currentPage + 1)
234
+ )
235
+ }
236
+ disabled={currentPage === totalPages}
237
+ className={`payment-button ${currentPage === totalPages ? '' : 'payment-button-success'}`}
238
+ style={{
239
+ background: currentPage === totalPages ? "#f6f6f9" : undefined,
240
+ color: currentPage === totalPages ? "#666687" : undefined
241
+ }}
242
+ >
243
+ Next →
244
+ </Button>
245
+ </Flex>
246
+ ) : (
247
+ <Typography
248
+ variant="pi"
249
+ textColor="neutral600"
250
+ fontWeight="medium"
251
+ >
252
+ {transactionHistory.length <= pageSize
253
+ ? "All transactions shown"
254
+ : "No pagination needed"}
255
+ </Typography>
256
+ )}
257
+ </Flex>
258
+ </CardBody>
259
+ </Card>
260
+ <Typography
261
+ variant="pi"
262
+ textColor="neutral600"
263
+ fontWeight="medium"
264
+ >
265
+ Showing {paginatedTransactions.length} of{" "}
266
+ {transactionHistory.length} transactions
267
+ </Typography>
268
+ </Box>
269
+ </Box>
270
+ )}
271
+ </Box>
272
+
273
+ <Box paddingTop={4}>
274
+ <Typography variant="sigma" textColor="neutral600">
275
+ Note: This shows all Payone transactions processed through this
276
+ plugin. Transactions are automatically logged with detailed
277
+ request/response data.
278
+ </Typography>
279
+ </Box>
280
+ </Flex>
281
+ </Box>
282
+ );
283
+ };
284
+
285
+ export default HistoryPanel;
@@ -0,0 +1,238 @@
1
+ import React from "react";
2
+ import { Box, Flex, Typography } from "@strapi/design-system";
3
+ import PaymentMethodSelector from "./paymentActions/PaymentMethodSelector";
4
+ import PreauthorizationForm from "./paymentActions/PreauthorizationForm";
5
+ import AuthorizationForm from "./paymentActions/AuthorizationForm";
6
+ import CaptureForm from "./paymentActions/CaptureForm";
7
+ import RefundForm from "./paymentActions/RefundForm";
8
+ import PaymentResult from "./paymentActions/PaymentResult";
9
+
10
+ const PaymentActionsPanel = ({
11
+ paymentAmount,
12
+ setPaymentAmount,
13
+ preauthReference,
14
+ setPreauthReference,
15
+ authReference,
16
+ setAuthReference,
17
+ captureTxid,
18
+ setCaptureTxid,
19
+ refundTxid,
20
+ setRefundTxid,
21
+ refundSequenceNumber,
22
+ setRefundSequenceNumber,
23
+ refundReference,
24
+ setRefundReference,
25
+ paymentMethod,
26
+ setPaymentMethod,
27
+ captureMode,
28
+ setCaptureMode,
29
+ isProcessingPayment,
30
+ paymentError,
31
+ paymentResult,
32
+ onPreauthorization,
33
+ onAuthorization,
34
+ onCapture,
35
+ onRefund,
36
+ settings,
37
+ googlePayToken,
38
+ setGooglePayToken,
39
+ applePayToken,
40
+ setApplePayToken,
41
+ cardtype,
42
+ setCardtype,
43
+ cardpan,
44
+ setCardpan,
45
+ cardexpiredate,
46
+ setCardexpiredate,
47
+ cardcvc2,
48
+ setCardcvc2,
49
+ onNavigateToConfig,
50
+ }) => {
51
+ const mode = (settings?.mode || "test").toLowerCase();
52
+ const isLiveMode = mode === "live";
53
+
54
+ return (
55
+ <Box
56
+ className="payment-container"
57
+ paddingTop={8}
58
+ paddingBottom={8}
59
+ paddingLeft={8}
60
+ paddingRight={8}
61
+ >
62
+ <Flex direction="column" alignItems="stretch" gap={6}>
63
+ <Box
64
+ style={{
65
+ display: "flex",
66
+ flexDirection: "column",
67
+ alignItems: "flex-start",
68
+ gap: "8px",
69
+ }}
70
+ >
71
+ <Typography
72
+ variant="beta"
73
+ as="h2"
74
+ className="payment-title"
75
+ style={{ fontSize: "20px", marginBottom: "4px" }}
76
+ >
77
+ Payment Actions
78
+ </Typography>
79
+ <Typography
80
+ variant="pi"
81
+ textColor="neutral600"
82
+ className="payment-subtitle"
83
+ style={{ fontSize: "14px" }}
84
+ >
85
+ Process payments, captures, and refunds with multiple payment
86
+ methods
87
+ </Typography>
88
+ {isLiveMode && (
89
+ <Typography
90
+ variant="pi"
91
+ textColor="danger600"
92
+ style={{ fontSize: "14px", marginTop: "8px", fontWeight: "bold" }}
93
+ >
94
+ ⚠️ Payment Actions are disabled in live mode for security reasons.
95
+ Please use test mode for testing.
96
+ </Typography>
97
+ )}
98
+ </Box>
99
+
100
+ <PaymentMethodSelector
101
+ paymentMethod={paymentMethod}
102
+ setPaymentMethod={setPaymentMethod}
103
+ captureMode={captureMode}
104
+ setCaptureMode={setCaptureMode}
105
+ onNavigateToConfig={onNavigateToConfig}
106
+ settings={settings}
107
+ />
108
+
109
+ <hr className="payment-divider" />
110
+
111
+ <Box
112
+ className="payment-form-section"
113
+ style={{
114
+ opacity: isLiveMode ? 0.5 : 1,
115
+ pointerEvents: isLiveMode ? "none" : "auto",
116
+ }}
117
+ >
118
+ <PreauthorizationForm
119
+ paymentAmount={paymentAmount}
120
+ setPaymentAmount={setPaymentAmount}
121
+ preauthReference={preauthReference}
122
+ setPreauthReference={setPreauthReference}
123
+ isProcessingPayment={isProcessingPayment}
124
+ onPreauthorization={onPreauthorization}
125
+ paymentMethod={paymentMethod}
126
+ settings={settings}
127
+ googlePayToken={googlePayToken}
128
+ setGooglePayToken={setGooglePayToken}
129
+ applePayToken={applePayToken}
130
+ setApplePayToken={setApplePayToken}
131
+ cardtype={cardtype}
132
+ setCardtype={setCardtype}
133
+ cardpan={cardpan}
134
+ setCardpan={setCardpan}
135
+ cardexpiredate={cardexpiredate}
136
+ setCardexpiredate={setCardexpiredate}
137
+ cardcvc2={cardcvc2}
138
+ setCardcvc2={setCardcvc2}
139
+ isLiveMode={isLiveMode}
140
+ />
141
+ </Box>
142
+
143
+ <hr className="payment-divider" />
144
+
145
+ <Box
146
+ className="payment-form-section"
147
+ style={{
148
+ opacity: isLiveMode ? 0.5 : 1,
149
+ pointerEvents: isLiveMode ? "none" : "auto",
150
+ }}
151
+ >
152
+ <AuthorizationForm
153
+ paymentAmount={paymentAmount}
154
+ setPaymentAmount={setPaymentAmount}
155
+ authReference={authReference}
156
+ setAuthReference={setAuthReference}
157
+ isProcessingPayment={isProcessingPayment}
158
+ onAuthorization={onAuthorization}
159
+ paymentMethod={paymentMethod}
160
+ settings={settings}
161
+ googlePayToken={googlePayToken}
162
+ setGooglePayToken={setGooglePayToken}
163
+ applePayToken={applePayToken}
164
+ setApplePayToken={setApplePayToken}
165
+ cardtype={cardtype}
166
+ setCardtype={setCardtype}
167
+ cardpan={cardpan}
168
+ setCardpan={setCardpan}
169
+ cardexpiredate={cardexpiredate}
170
+ setCardexpiredate={setCardexpiredate}
171
+ cardcvc2={cardcvc2}
172
+ setCardcvc2={setCardcvc2}
173
+ isLiveMode={isLiveMode}
174
+ />
175
+ </Box>
176
+
177
+ <hr className="payment-divider" />
178
+
179
+ <Box
180
+ className="payment-form-section"
181
+ style={{
182
+ opacity: isLiveMode ? 0.5 : 1,
183
+ pointerEvents: isLiveMode ? "none" : "auto",
184
+ }}
185
+ >
186
+ <CaptureForm
187
+ paymentAmount={paymentAmount}
188
+ setPaymentAmount={setPaymentAmount}
189
+ captureTxid={captureTxid}
190
+ setCaptureTxid={setCaptureTxid}
191
+ isProcessingPayment={isProcessingPayment}
192
+ onCapture={onCapture}
193
+ />
194
+ </Box>
195
+
196
+ <hr className="payment-divider" />
197
+
198
+ <Box
199
+ className="payment-form-section"
200
+ style={{
201
+ opacity: isLiveMode ? 0.5 : 1,
202
+ pointerEvents: isLiveMode ? "none" : "auto",
203
+ }}
204
+ >
205
+ <RefundForm
206
+ paymentAmount={paymentAmount}
207
+ setPaymentAmount={setPaymentAmount}
208
+ refundTxid={refundTxid}
209
+ setRefundTxid={setRefundTxid}
210
+ refundSequenceNumber={refundSequenceNumber}
211
+ setRefundSequenceNumber={setRefundSequenceNumber}
212
+ refundReference={refundReference}
213
+ setRefundReference={setRefundReference}
214
+ isProcessingPayment={isProcessingPayment}
215
+ onRefund={onRefund}
216
+ />
217
+ </Box>
218
+
219
+ <hr className="payment-divider" />
220
+
221
+ <PaymentResult
222
+ paymentError={paymentError}
223
+ paymentResult={paymentResult}
224
+ />
225
+
226
+ <Box paddingTop={4}>
227
+ <Typography variant="sigma" textColor="neutral600">
228
+ Note: These payment actions allow you to test the complete payment
229
+ flow: Preauthorization → Capture → Refund. Make sure to use valid
230
+ Transaction IDs for capture and refund operations.
231
+ </Typography>
232
+ </Box>
233
+ </Flex>
234
+ </Box>
235
+ );
236
+ };
237
+
238
+ export default PaymentActionsPanel;
@@ -0,0 +1,24 @@
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
+ INVALID: "danger",
11
+ REDIRECT: "secondary"
12
+ };
13
+
14
+ return (
15
+ <Badge
16
+ textColor="neutral0"
17
+ backgroundColor={statusColors[status] || "default"}
18
+ >
19
+ {status}
20
+ </Badge>
21
+ );
22
+ };
23
+
24
+ export default StatusBadge;