strapi-plugin-payone-provider 1.6.7 → 5.6.9

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 (94) hide show
  1. package/README.md +24 -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 -156
  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 +27 -16
  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 -67
  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 +109 -47
  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 -25
  69. package/admin/src/pages/utils/tooltipHelpers.js +18 -0
  70. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  71. package/package.json +7 -12
  72. package/server/config/index.js +18 -2
  73. package/server/controllers/payone.js +80 -31
  74. package/server/policies/is-auth.js +9 -3
  75. package/server/policies/isSuperAdmin.js +7 -5
  76. package/server/services/paymentService.js +6 -22
  77. package/server/services/payone.js +3 -3
  78. package/server/services/settingsService.js +13 -3
  79. package/server/services/testConnectionService.js +11 -73
  80. package/server/services/transactionService.js +61 -32
  81. package/server/utils/normalize.js +0 -12
  82. package/server/utils/paymentMethodParams.js +0 -1
  83. package/server/utils/responseParser.js +9 -14
  84. package/strapi-admin.js +3 -1
  85. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  86. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -312
  87. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  88. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +0 -95
  89. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  90. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
  91. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
  92. package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
  93. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
  94. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
@@ -1,192 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Card,
5
- CardBody,
6
- Divider,
7
- Flex,
8
- Stack,
9
- Typography,
10
- Alert,
11
- } from "@strapi/design-system";
12
- import StatusBadge from "../StatusBadge";
13
- import { formatTransactionData } from "../../../utils/formatTransactionData";
14
-
15
- const PaymentResult = ({ paymentError, paymentResult }) => {
16
- if (!paymentError && !paymentResult) {
17
- return null;
18
- }
19
-
20
- const status = paymentResult?.status || paymentResult?.Status || "";
21
- const errorCode =
22
- paymentResult?.errorcode ||
23
- paymentResult?.errorCode ||
24
- paymentResult?.ErrorCode;
25
- const errorMessage =
26
- paymentResult?.errormessage ||
27
- paymentResult?.errorMessage ||
28
- paymentResult?.ErrorMessage;
29
- const customerMessage =
30
- paymentResult?.customermessage ||
31
- paymentResult?.customerMessage ||
32
- paymentResult?.CustomerMessage;
33
- const isError = status === "ERROR" || status === "INVALID" || errorCode;
34
-
35
- return (
36
- <>
37
- {paymentError && (
38
- <Alert variant="danger" title="Error" className="payment-alert">
39
- {paymentError}
40
- </Alert>
41
- )}
42
-
43
- {paymentResult && (
44
- <Card className="payment-result-card">
45
- <CardBody>
46
- <Stack spacing={4}>
47
- <Flex justifyContent="space-between" alignItems="center">
48
- <Typography
49
- variant="delta"
50
- as="h3"
51
- className="payment-section-title"
52
- >
53
- Payment Result
54
- </Typography>
55
- {(status || paymentResult.Status) && (
56
- <StatusBadge status={status || paymentResult.Status} />
57
- )}
58
- </Flex>
59
-
60
- <hr className="payment-divider" style={{ margin: "16px 0" }} />
61
-
62
- {/* Show error information prominently if error */}
63
- {isError && (
64
- <Alert variant="danger" title="Transaction Failed">
65
- <Stack spacing={2}>
66
- {errorCode && (
67
- <Typography variant="pi">
68
- <strong>Error Code:</strong> {errorCode}
69
- </Typography>
70
- )}
71
- {errorMessage && (
72
- <Typography variant="pi">
73
- <strong>Error Message:</strong> {errorMessage}
74
- </Typography>
75
- )}
76
- {customerMessage && (
77
- <Typography variant="pi">
78
- <strong>Customer Message:</strong> {customerMessage}
79
- </Typography>
80
- )}
81
- </Stack>
82
- </Alert>
83
- )}
84
-
85
- <Box>
86
- <Typography
87
- variant="omega"
88
- fontWeight="semiBold"
89
- marginBottom={2}
90
- >
91
- Full Response Details:
92
- </Typography>
93
- <Stack spacing={3}>
94
- {formatTransactionData(paymentResult).map((item, index) => (
95
- <Flex
96
- key={index}
97
- justifyContent="space-between"
98
- alignItems="start"
99
- style={{
100
- padding: "8px 0",
101
- borderBottom:
102
- index <
103
- formatTransactionData(paymentResult).length - 1
104
- ? "1px solid #e8e8ea"
105
- : "none",
106
- }}
107
- >
108
- <Typography
109
- variant="pi"
110
- textColor="neutral600"
111
- style={{ minWidth: "200px", fontWeight: "500" }}
112
- >
113
- {item.key}:
114
- </Typography>
115
- <Typography
116
- variant="pi"
117
- style={{
118
- flex: 1,
119
- textAlign: "right",
120
- fontWeight: "400",
121
- wordBreak: "break-word",
122
- fontFamily: item.key.toLowerCase().includes("raw")
123
- ? "monospace"
124
- : "inherit",
125
- fontSize: item.key.toLowerCase().includes("raw")
126
- ? "11px"
127
- : "inherit",
128
- }}
129
- >
130
- {item.value}
131
- </Typography>
132
- </Flex>
133
- ))}
134
- </Stack>
135
- </Box>
136
-
137
- {/* 3DS Required Warning */}
138
- {paymentResult?.is3DSRequired && !paymentResult?.redirectUrl && (
139
- <Alert
140
- variant="warning"
141
- title="3D Secure Authentication Required"
142
- >
143
- <Stack spacing={2}>
144
- <Typography variant="pi">
145
- Payone requires 3D Secure authentication, but no redirect
146
- URL was provided in the response.
147
- </Typography>
148
- <Typography variant="pi" fontWeight="semiBold">
149
- Possible solutions:
150
- </Typography>
151
- <Typography
152
- variant="pi"
153
- component="ul"
154
- style={{ marginLeft: "20px" }}
155
- >
156
- <li>
157
- Check Payone portal configuration for 3DS settings
158
- </li>
159
- <li>
160
- Verify that redirect URLs (successurl, errorurl,
161
- backurl) are properly configured
162
- </li>
163
- <li>
164
- Ensure you're using test mode with proper test
165
- credentials
166
- </li>
167
- <li>
168
- Check if 3dscheck request is needed before authorization
169
- </li>
170
- </Typography>
171
- <Typography
172
- variant="pi"
173
- textColor="neutral600"
174
- marginTop={2}
175
- >
176
- <strong>Error Code:</strong>{" "}
177
- {paymentResult?.errorCode ||
178
- paymentResult?.ErrorCode ||
179
- "4219"}
180
- </Typography>
181
- </Stack>
182
- </Alert>
183
- )}
184
- </Stack>
185
- </CardBody>
186
- </Card>
187
- )}
188
- </>
189
- );
190
- };
191
-
192
- export default PaymentResult;
@@ -1,142 +0,0 @@
1
- import React from "react";
2
- import {
3
- Box,
4
- Flex,
5
- Typography,
6
- TextInput,
7
- Button,
8
- } from "@strapi/design-system";
9
- import { Play } from "@strapi/icons";
10
- import GooglePayButton from "../GooglePaybutton";
11
- import CardDetailsInput from "./CardDetailsInput";
12
-
13
- const PreauthorizationForm = ({
14
- paymentAmount,
15
- setPaymentAmount,
16
- preauthReference,
17
- setPreauthReference,
18
- isProcessingPayment,
19
- onPreauthorization,
20
- paymentMethod,
21
- settings,
22
- setGooglePayToken,
23
- cardtype,
24
- setCardtype,
25
- cardpan,
26
- setCardpan,
27
- cardexpiredate,
28
- setCardexpiredate,
29
- cardcvc2,
30
- setCardcvc2,
31
- isLiveMode = false,
32
- }) => {
33
- const handleGooglePayToken = (token, paymentData) => {
34
- if (!token) {
35
- return;
36
- }
37
- setGooglePayToken(token);
38
- onPreauthorization(token);
39
- };
40
-
41
- const handleGooglePayError = (error) => {
42
- console.error("Google Pay error:", error);
43
- };
44
-
45
- return (
46
- <Flex direction="column" alignItems="stretch" gap={4}>
47
- <Flex direction="row" gap={2}>
48
- <Typography
49
- variant="omega"
50
- fontWeight="semiBold"
51
- textColor="neutral800"
52
- className="payment-form-title"
53
- >
54
- Preauthorization
55
- </Typography>
56
- <Typography
57
- variant="pi"
58
- textColor="neutral600"
59
- className="payment-form-description"
60
- >
61
- Reserve an amount on a credit card without capturing it immediately.
62
- </Typography>
63
- </Flex>
64
-
65
- <Flex gap={4} wrap="wrap">
66
- <TextInput
67
- label="Amount (in cents) *"
68
- name="paymentAmount"
69
- value={paymentAmount}
70
- onChange={(e) => setPaymentAmount(e.target.value)}
71
- placeholder="Enter amount (e.g., 1000 for €10.00)"
72
- hint="Amount in cents (e.g., 1000 = €10.00)"
73
- required
74
- className="payment-input"
75
- style={{ flex: 1, minWidth: "250px" }}
76
- />
77
-
78
- <TextInput
79
- label="Reference *"
80
- name="preauthReference"
81
- value={preauthReference}
82
- onChange={(e) => setPreauthReference(e.target.value)}
83
- placeholder="Auto-generated if empty"
84
- hint="Reference will be auto-generated if left empty"
85
- className="payment-input"
86
- style={{ flex: 1, minWidth: "250px" }}
87
- />
88
- </Flex>
89
-
90
- {paymentMethod === "cc" && settings?.enable3DSecure && (
91
- <Box marginTop={4}>
92
- <CardDetailsInput
93
- cardtype={cardtype}
94
- setCardtype={setCardtype}
95
- cardpan={cardpan}
96
- setCardpan={setCardpan}
97
- cardexpiredate={cardexpiredate}
98
- setCardexpiredate={setCardexpiredate}
99
- cardcvc2={cardcvc2}
100
- setCardcvc2={setCardcvc2}
101
- />
102
- </Box>
103
- )}
104
-
105
- {paymentMethod === "gpp" ? (
106
- <GooglePayButton
107
- amount={paymentAmount}
108
- currency="EUR"
109
- onTokenReceived={handleGooglePayToken}
110
- onError={handleGooglePayError}
111
- settings={settings}
112
- />
113
- ) : paymentMethod === "apl" ? (
114
- <Box>
115
- <Typography variant="pi" textColor="neutral600">
116
- Apple Pay is only supported for Authorization, not Preauthorization.
117
- </Typography>
118
- </Box>
119
- ) : (
120
- <Button
121
- variant="default"
122
- onClick={onPreauthorization}
123
- loading={isProcessingPayment}
124
- startIcon={<Play />}
125
- style={{ maxWidth: "200px" }}
126
- className="payment-button payment-button-primary"
127
- disabled={
128
- !paymentAmount.trim() ||
129
- (paymentMethod === "cc" &&
130
- settings?.enable3DSecure !== false &&
131
- (!cardtype || !cardpan || !cardexpiredate || !cardcvc2)) ||
132
- isLiveMode
133
- }
134
- >
135
- Process Preauthorization
136
- </Button>
137
- )}
138
- </Flex>
139
- );
140
- };
141
-
142
- export default PreauthorizationForm;
@@ -1,90 +0,0 @@
1
- import React from "react";
2
- import { Box, Flex, Typography, TextInput, Button } from "@strapi/design-system";
3
- import { Play } from "@strapi/icons";
4
-
5
- const RefundForm = ({
6
- paymentAmount,
7
- setPaymentAmount,
8
- refundTxid,
9
- setRefundTxid,
10
- refundSequenceNumber,
11
- setRefundSequenceNumber,
12
- refundReference,
13
- setRefundReference,
14
- isProcessingPayment,
15
- onRefund
16
- }) => {
17
- return (
18
- <Flex direction="column" alignItems="stretch" gap={4}>
19
- <Flex direction="row" gap={2}>
20
- <Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
21
- Refund
22
- </Typography>
23
- <Typography variant="pi" textColor="neutral600" className="payment-form-description">
24
- Refund a previously captured amount.
25
- </Typography>
26
- </Flex>
27
-
28
- <Flex gap={4} wrap="wrap">
29
- <TextInput
30
- label="Transaction ID"
31
- name="refundTxid"
32
- value={refundTxid}
33
- onChange={(e) => setRefundTxid(e.target.value)}
34
- placeholder="Enter TxId from capture"
35
- hint="Transaction ID from a previous capture"
36
- className="payment-input"
37
- style={{ flex: 1, minWidth: "200px" }}
38
- />
39
-
40
- <TextInput
41
- label="Sequence Number"
42
- name="refundSequenceNumber"
43
- value={refundSequenceNumber}
44
- onChange={(e) => setRefundSequenceNumber(e.target.value)}
45
- placeholder="2"
46
- hint="Sequence number for this refund (1-127) and by default for first 2"
47
- className="payment-input"
48
- style={{ flex: 1, minWidth: "200px" }}
49
- />
50
-
51
- <TextInput
52
- label="Amount (in cents)"
53
- name="refundAmount"
54
- value={paymentAmount}
55
- onChange={(e) => setPaymentAmount(e.target.value)}
56
- placeholder="1000"
57
- hint="Amount in cents to refund (will be negative)"
58
- className="payment-input"
59
- style={{ flex: 1, minWidth: "200px" }}
60
- />
61
-
62
- <TextInput
63
- label="Reference"
64
- name="refundReference"
65
- value={refundReference}
66
- onChange={(e) => setRefundReference(e.target.value)}
67
- placeholder="Optional reference"
68
- hint="Optional reference for this refund"
69
- className="payment-input"
70
- style={{ flex: 1, minWidth: "200px" }}
71
- />
72
- </Flex>
73
-
74
- <Button
75
- variant="default"
76
- onClick={onRefund}
77
- loading={isProcessingPayment}
78
- startIcon={<Play />}
79
- style={{ maxWidth: '200px' }}
80
- className="payment-button payment-button-primary"
81
- disabled={!refundTxid.trim() || !paymentAmount.trim()}
82
- >
83
- Process Refund
84
- </Button>
85
- </Flex>
86
- );
87
- };
88
-
89
- export default RefundForm;
90
-