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,148 @@
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 = paymentResult?.errorcode || paymentResult?.errorCode || paymentResult?.ErrorCode;
22
+ const errorMessage = paymentResult?.errormessage || paymentResult?.errorMessage || paymentResult?.ErrorMessage;
23
+ const customerMessage = paymentResult?.customermessage || paymentResult?.customerMessage || paymentResult?.CustomerMessage;
24
+ const isError = status === "ERROR" || status === "INVALID" || errorCode;
25
+
26
+ return (
27
+ <>
28
+ {paymentError && (
29
+ <Alert
30
+ variant="danger"
31
+ title="Error"
32
+ className="payment-alert"
33
+ >
34
+ {paymentError}
35
+ </Alert>
36
+ )}
37
+
38
+ {paymentResult && (
39
+ <Card className="payment-result-card">
40
+ <CardBody>
41
+ <Stack spacing={4}>
42
+ <Flex justifyContent="space-between" alignItems="center">
43
+ <Typography variant="delta" as="h3" className="payment-section-title">
44
+ Payment Result
45
+ </Typography>
46
+ {(status || paymentResult.Status) && (
47
+ <StatusBadge status={status || paymentResult.Status} />
48
+ )}
49
+ </Flex>
50
+
51
+ <hr className="payment-divider" style={{ margin: '16px 0' }} />
52
+
53
+ {/* Show error information prominently if error */}
54
+ {isError && (
55
+ <Alert variant="danger" title="Transaction Failed">
56
+ <Stack spacing={2}>
57
+ {errorCode && (
58
+ <Typography variant="pi">
59
+ <strong>Error Code:</strong> {errorCode}
60
+ </Typography>
61
+ )}
62
+ {errorMessage && (
63
+ <Typography variant="pi">
64
+ <strong>Error Message:</strong> {errorMessage}
65
+ </Typography>
66
+ )}
67
+ {customerMessage && (
68
+ <Typography variant="pi">
69
+ <strong>Customer Message:</strong> {customerMessage}
70
+ </Typography>
71
+ )}
72
+ </Stack>
73
+ </Alert>
74
+ )}
75
+
76
+ <Box>
77
+ <Typography variant="omega" fontWeight="semiBold" marginBottom={2}>
78
+ Full Response Details:
79
+ </Typography>
80
+ <Stack spacing={3}>
81
+ {formatTransactionData(paymentResult).map((item, index) => (
82
+ <Flex
83
+ key={index}
84
+ justifyContent="space-between"
85
+ alignItems="start"
86
+ style={{
87
+ padding: '8px 0',
88
+ borderBottom: index < formatTransactionData(paymentResult).length - 1 ? '1px solid #e8e8ea' : 'none'
89
+ }}
90
+ >
91
+ <Typography
92
+ variant="pi"
93
+ textColor="neutral600"
94
+ style={{ minWidth: "200px", fontWeight: '500' }}
95
+ >
96
+ {item.key}:
97
+ </Typography>
98
+ <Typography
99
+ variant="pi"
100
+ style={{
101
+ flex: 1,
102
+ textAlign: "right",
103
+ fontWeight: '400',
104
+ wordBreak: 'break-word',
105
+ fontFamily: item.key.toLowerCase().includes('raw') ? 'monospace' : 'inherit',
106
+ fontSize: item.key.toLowerCase().includes('raw') ? '11px' : 'inherit'
107
+ }}
108
+ >
109
+ {item.value}
110
+ </Typography>
111
+ </Flex>
112
+ ))}
113
+ </Stack>
114
+ </Box>
115
+
116
+ {/* 3DS Required Warning */}
117
+ {paymentResult?.is3DSRequired && !paymentResult?.redirectUrl && (
118
+ <Alert variant="warning" title="3D Secure Authentication Required">
119
+ <Stack spacing={2}>
120
+ <Typography variant="pi">
121
+ Payone requires 3D Secure authentication, but no redirect URL was provided in the response.
122
+ </Typography>
123
+ <Typography variant="pi" fontWeight="semiBold">
124
+ Possible solutions:
125
+ </Typography>
126
+ <Typography variant="pi" component="ul" style={{ marginLeft: '20px' }}>
127
+ <li>Check Payone portal configuration for 3DS settings</li>
128
+ <li>Verify that redirect URLs (successurl, errorurl, backurl) are properly configured</li>
129
+ <li>Ensure you're using test mode with proper test credentials</li>
130
+ <li>Check if 3dscheck request is needed before authorization</li>
131
+ </Typography>
132
+ <Typography variant="pi" textColor="neutral600" marginTop={2}>
133
+ <strong>Error Code:</strong> {paymentResult?.errorCode || paymentResult?.ErrorCode || "4219"}
134
+ </Typography>
135
+ </Stack>
136
+ </Alert>
137
+ )}
138
+
139
+ </Stack>
140
+ </CardBody>
141
+ </Card>
142
+ )}
143
+ </>
144
+ );
145
+ };
146
+
147
+ export default PaymentResult;
148
+
@@ -0,0 +1,132 @@
1
+ import React from "react";
2
+ import { Box, Flex, Typography, TextInput, Button } from "@strapi/design-system";
3
+ import { Play } from "@strapi/icons";
4
+ import GooglePayButton from "../GooglePaybutton";
5
+ import CardDetailsInput from "./CardDetailsInput";
6
+
7
+ const PreauthorizationForm = ({
8
+ paymentAmount,
9
+ setPaymentAmount,
10
+ preauthReference,
11
+ setPreauthReference,
12
+ isProcessingPayment,
13
+ onPreauthorization,
14
+ paymentMethod,
15
+ settings,
16
+ setGooglePayToken,
17
+ cardtype,
18
+ setCardtype,
19
+ cardpan,
20
+ setCardpan,
21
+ cardexpiredate,
22
+ setCardexpiredate,
23
+ cardcvc2,
24
+ setCardcvc2,
25
+ isLiveMode = false
26
+ }) => {
27
+ const handleGooglePayToken = (token, paymentData) => {
28
+ if (!token) {
29
+ return;
30
+ }
31
+ setGooglePayToken(token);
32
+ onPreauthorization(token);
33
+ };
34
+
35
+ const handleGooglePayError = (error) => {
36
+ if (onError) {
37
+ onError(error);
38
+ }
39
+ };
40
+
41
+
42
+
43
+ return (
44
+ <Flex direction="column" alignItems="stretch" gap={4}>
45
+ <Flex direction="row" gap={2}>
46
+ <Typography variant="omega" fontWeight="semiBold" textColor="neutral800" className="payment-form-title">
47
+ Preauthorization
48
+ </Typography>
49
+ <Typography variant="pi" textColor="neutral600" className="payment-form-description">
50
+ Reserve an amount on a credit card without capturing it immediately.
51
+ </Typography>
52
+ </Flex>
53
+
54
+ <Flex gap={4} wrap="wrap">
55
+ <TextInput
56
+ label="Amount (in cents) *"
57
+ name="paymentAmount"
58
+ value={paymentAmount}
59
+ onChange={(e) => setPaymentAmount(e.target.value)}
60
+ placeholder="Enter amount (e.g., 1000 for €10.00)"
61
+ hint="Amount in cents (e.g., 1000 = €10.00)"
62
+ required
63
+ className="payment-input"
64
+ style={{ flex: 1, minWidth: "250px" }}
65
+ />
66
+
67
+ <TextInput
68
+ label="Reference *"
69
+ name="preauthReference"
70
+ value={preauthReference}
71
+ onChange={(e) => setPreauthReference(e.target.value)}
72
+ placeholder="Auto-generated if empty"
73
+ hint="Reference will be auto-generated if left empty"
74
+ className="payment-input"
75
+ style={{ flex: 1, minWidth: "250px" }}
76
+ />
77
+ </Flex>
78
+
79
+ {paymentMethod === "cc" && settings?.enable3DSecure && (
80
+ <Box marginTop={4}>
81
+ <CardDetailsInput
82
+ cardtype={cardtype}
83
+ setCardtype={setCardtype}
84
+ cardpan={cardpan}
85
+ setCardpan={setCardpan}
86
+ cardexpiredate={cardexpiredate}
87
+ setCardexpiredate={setCardexpiredate}
88
+ cardcvc2={cardcvc2}
89
+ setCardcvc2={setCardcvc2}
90
+ />
91
+ </Box>
92
+ )}
93
+
94
+ {paymentMethod === "gpp" ? (
95
+ <GooglePayButton
96
+ amount={paymentAmount}
97
+ currency="EUR"
98
+ onTokenReceived={handleGooglePayToken}
99
+ onError={handleGooglePayError}
100
+ settings={settings}
101
+ />
102
+ ) : paymentMethod === "apl" ? (
103
+ <Box>
104
+ <Typography variant="pi" textColor="neutral600">
105
+ Apple Pay is only supported for Authorization, not Preauthorization.
106
+ </Typography>
107
+ </Box>
108
+ ) : (
109
+ <Button
110
+ variant="default"
111
+ onClick={onPreauthorization}
112
+ loading={isProcessingPayment}
113
+ startIcon={<Play />}
114
+ style={{ maxWidth: '200px' }}
115
+ className="payment-button payment-button-primary"
116
+ disabled={
117
+ !paymentAmount.trim() ||
118
+ (paymentMethod === "cc" &&
119
+ settings?.enable3DSecure !== false &&
120
+ (!cardtype || !cardpan || !cardexpiredate || !cardcvc2)) ||
121
+ isLiveMode
122
+ }
123
+ >
124
+ Process Preauthorization
125
+ </Button>
126
+ )}
127
+ </Flex>
128
+ );
129
+ };
130
+
131
+ export default PreauthorizationForm;
132
+
@@ -0,0 +1,90 @@
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
+
@@ -0,0 +1,127 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { useLocation, useHistory } from "react-router-dom";
3
+ import { Layout, ContentLayout, Box } from "@strapi/design-system";
4
+ import useSettings from "../hooks/useSettings";
5
+ import useTransactionHistory from "../hooks/useTransactionHistory";
6
+ import usePaymentActions from "../hooks/usePaymentActions";
7
+ import AppHeader from "./components/AppHeader";
8
+ import AppTabs from "./components/AppTabs";
9
+ import ApplePayConfigPanel from "./components/ApplePayConfigPanel";
10
+ import GooglePayConfigPanel from "./components/GooglePayConfigPanel";
11
+ import "./styles.css";
12
+ import pluginId from "../../pluginId";
13
+
14
+ const App = () => {
15
+ const location = useLocation();
16
+ const history = useHistory();
17
+ const [activeTab, setActiveTab] = useState(0);
18
+
19
+ // Custom hooks
20
+ const settings = useSettings();
21
+ const transactionHistory = useTransactionHistory();
22
+ const paymentActions = usePaymentActions();
23
+
24
+ useEffect(() => {
25
+ if (location.pathname.includes('/apple-pay-config') || location.pathname.includes('/google-pay-config')) {
26
+ } else {
27
+ const tabFromPath = location.pathname.includes('/history') ? 1 :
28
+ location.pathname.includes('/payment-actions') ? 2 :
29
+ location.pathname.includes('/documentation') ? 3 : 0;
30
+ setActiveTab(tabFromPath);
31
+ }
32
+ }, [location.pathname]);
33
+
34
+ const isApplePayConfigPage = location.pathname.includes('/apple-pay-config');
35
+ const isGooglePayConfigPage = location.pathname.includes('/google-pay-config');
36
+
37
+ if (isApplePayConfigPage) {
38
+ return (
39
+ <Layout>
40
+ <AppHeader
41
+ title="Apple Pay Configuration"
42
+ activeTab={null}
43
+ isSaving={settings.isSaving}
44
+ onSave={settings.handleSave}
45
+ onBack={() => history.push(`/plugins/${pluginId}`)}
46
+ />
47
+ <ContentLayout>
48
+ <Box padding={6}>
49
+ <ApplePayConfigPanel
50
+ settings={settings.settings}
51
+ onInputChange={settings.handleInputChange}
52
+ isSaving={settings.isSaving}
53
+ onSave={settings.handleSave}
54
+ />
55
+ </Box>
56
+ </ContentLayout>
57
+ </Layout>
58
+ );
59
+ }
60
+
61
+ if (isGooglePayConfigPage) {
62
+ return (
63
+ <Layout>
64
+ <AppHeader
65
+ title="Google Pay Configuration"
66
+ activeTab={null}
67
+ isSaving={settings.isSaving}
68
+ onSave={settings.handleSave}
69
+ onBack={() => history.push(`/plugins/${pluginId}`)}
70
+ />
71
+ <ContentLayout>
72
+ <Box padding={6}>
73
+ <GooglePayConfigPanel
74
+ settings={settings.settings}
75
+ onInputChange={settings.handleInputChange}
76
+ isSaving={settings.isSaving}
77
+ onSave={settings.handleSave}
78
+ onBack={() => history.push(`/plugins/${pluginId}`)}
79
+ />
80
+ </Box>
81
+ </ContentLayout>
82
+ </Layout>
83
+ );
84
+ }
85
+
86
+ return (
87
+ <Layout>
88
+ <AppHeader
89
+ activeTab={activeTab}
90
+ isSaving={settings.isSaving}
91
+ onSave={settings.handleSave}
92
+ />
93
+ <ContentLayout>
94
+ <Box padding={6}>
95
+ <AppTabs
96
+ activeTab={activeTab}
97
+ setActiveTab={setActiveTab}
98
+ settings={settings.settings}
99
+ isSaving={settings.isSaving}
100
+ isTesting={settings.isTesting}
101
+ testResult={settings.testResult}
102
+ onSave={settings.handleSave}
103
+ onTestConnection={settings.handleTestConnection}
104
+ onInputChange={settings.handleInputChange}
105
+ filters={transactionHistory.filters}
106
+ onFilterChange={transactionHistory.handleFilterChange}
107
+ onFilterApply={transactionHistory.handleFilterApply}
108
+ isLoadingHistory={transactionHistory.isLoadingHistory}
109
+ transactionHistory={transactionHistory.transactionHistory}
110
+ paginatedTransactions={transactionHistory.paginatedTransactions}
111
+ currentPage={transactionHistory.currentPage}
112
+ totalPages={transactionHistory.totalPages}
113
+ pageSize={transactionHistory.pageSize}
114
+ onRefresh={transactionHistory.loadTransactionHistory}
115
+ onPageChange={transactionHistory.handlePageChange}
116
+ selectedTransaction={transactionHistory.selectedTransaction}
117
+ onTransactionSelect={transactionHistory.handleTransactionSelect}
118
+ paymentActions={paymentActions}
119
+ history={history}
120
+ />
121
+ </Box>
122
+ </ContentLayout>
123
+ </Layout>
124
+ );
125
+ };
126
+
127
+ export default App;
@@ -22,11 +22,10 @@ export const DEFAULT_PAYMENT_DATA = {
22
22
  ip: "127.0.0.1",
23
23
  customer_is_present: "yes",
24
24
  language: "de"
25
- // Note: successurl, errorurl, backurl are added conditionally based on 3DS setting
26
25
  };
27
26
 
28
27
  /**
29
- * Default currency
28
+ * Default currency
30
29
  */
31
30
  export const DEFAULT_CURRENCY = "EUR";
32
31