strapi-plugin-payone-provider 4.6.10 → 4.6.11

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 (62) hide show
  1. package/README.md +64 -0
  2. package/admin/src/pages/App/components/AppHeader.jsx +3 -2
  3. package/admin/src/pages/App/components/AppTabs.jsx +34 -88
  4. package/admin/src/pages/App/components/DocsPanel.jsx +1726 -1726
  5. package/admin/src/pages/App/components/GooglePaybutton.jsx +300 -300
  6. package/admin/src/pages/App/components/StatusBadge.jsx +1 -1
  7. package/admin/src/pages/App/components/common/InfoTooltip.jsx +16 -0
  8. package/admin/src/pages/App/components/{ApplePayConfig.jsx → configuration/ApplePayConfig.jsx} +191 -62
  9. package/admin/src/pages/App/components/{ApplePayConfigPanel.jsx → configuration/ApplePayConfigPanel.jsx} +71 -70
  10. package/admin/src/pages/App/components/configuration/ConfigurationFields.jsx +408 -0
  11. package/admin/src/pages/App/components/configuration/ConfigurationPanel.jsx +67 -0
  12. package/admin/src/pages/App/components/{GooglePayConfig.jsx → configuration/GooglePayConfig.jsx} +254 -254
  13. package/admin/src/pages/App/components/{GooglePayConfigPanel.jsx → configuration/GooglePayConfigPanel.jsx} +82 -82
  14. package/admin/src/pages/App/components/configuration/TestConnection.jsx +129 -0
  15. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +137 -95
  16. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +119 -14
  17. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.jsx +85 -24
  18. package/admin/src/pages/App/components/paymentActions/PaymentActionsPanel.jsx +361 -0
  19. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +22 -4
  20. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +91 -20
  21. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationForm.jsx +157 -0
  22. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormFields.jsx +308 -0
  23. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationFormHeader.jsx +27 -0
  24. package/admin/src/pages/App/components/paymentActions/authorization/AuthorizationPaymentButtons.jsx +93 -0
  25. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationForm.jsx +134 -0
  26. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormFields.jsx +295 -0
  27. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationFormHeader.jsx +27 -0
  28. package/admin/src/pages/App/components/paymentActions/preauthorization/PreauthorizationPaymentButtons.jsx +53 -0
  29. package/admin/src/pages/App/components/transaction-history/FiltersPanel.jsx +182 -0
  30. package/admin/src/pages/App/components/transaction-history/HistoryPanel.jsx +49 -0
  31. package/admin/src/pages/App/components/transaction-history/TransactionTable.jsx +169 -0
  32. package/admin/src/pages/App/components/transaction-history/TransactionTablePagination.jsx +28 -0
  33. package/admin/src/pages/App/components/transaction-history/details/TransactionDetails.jsx +155 -0
  34. package/admin/src/pages/App/index.jsx +5 -29
  35. package/admin/src/pages/hooks/usePaymentActions.js +87 -11
  36. package/admin/src/pages/hooks/useSettings.js +64 -22
  37. package/admin/src/pages/hooks/useTransactionHistory.js +100 -88
  38. package/admin/src/pages/utils/api.js +31 -3
  39. package/admin/src/pages/utils/countryLanguageUtils.js +236 -0
  40. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  41. package/package.json +1 -1
  42. package/server/bootstrap.js +6 -6
  43. package/server/controllers/payone.js +27 -3
  44. package/server/policies/index.js +2 -1
  45. package/server/policies/is-payone-notification.js +31 -0
  46. package/server/routes/index.js +10 -0
  47. package/server/services/payone.js +11 -4
  48. package/server/services/settingsService.js +8 -2
  49. package/server/services/testConnectionService.js +11 -72
  50. package/server/services/transactionService.js +58 -78
  51. package/server/services/transactionStatusService.js +87 -0
  52. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  53. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  54. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  55. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  56. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  57. package/admin/src/pages/App/components/TransactionHistoryItem.jsx +0 -522
  58. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  59. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  60. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  61. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  62. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
@@ -0,0 +1,49 @@
1
+ import { Box, Divider, Flex, Typography } from "@strapi/design-system";
2
+ import TransactionTable from "./TransactionTable";
3
+
4
+ const HistoryPanel = () => {
5
+ return (
6
+ <Box
7
+ className="payment-container"
8
+ paddingTop={8}
9
+ paddingBottom={8}
10
+ paddingLeft={8}
11
+ paddingRight={8}
12
+ >
13
+ <Flex direction="column" alignItems="stretch" gap={8}>
14
+ <Box>
15
+ <Typography
16
+ variant="beta"
17
+ as="h2"
18
+ className="payment-title"
19
+ style={{ fontSize: "20px", marginBottom: "4px" }}
20
+ >
21
+ Transaction Management
22
+ </Typography>
23
+ <Typography
24
+ variant="pi"
25
+ textColor="neutral600"
26
+ className="payment-subtitle"
27
+ style={{ fontSize: "14px", marginTop: "4px" }}
28
+ >
29
+ View and filter all payment transactions processed through Payone
30
+ </Typography>
31
+ </Box>
32
+
33
+ <Divider />
34
+
35
+ <TransactionTable />
36
+
37
+ <Box paddingTop={4}>
38
+ <Typography variant="sigma" textColor="neutral600">
39
+ Note: This shows all Payone transactions processed through this
40
+ plugin. Transactions are automatically logged with detailed
41
+ request/response data.
42
+ </Typography>
43
+ </Box>
44
+ </Flex>
45
+ </Box>
46
+ );
47
+ };
48
+
49
+ export default HistoryPanel;
@@ -0,0 +1,169 @@
1
+ import React from "react";
2
+ import { Box, Button, Flex, Typography, Tr, Td } from "@strapi/design-system";
3
+ import { Table } from "@strapi/helper-plugin";
4
+ import { ChevronDown, ChevronUp } from "@strapi/icons";
5
+
6
+ import StatusBadge from "../StatusBadge";
7
+ import FiltersPanel from "./FiltersPanel";
8
+ import TransactionDetails from "./details/TransactionDetails";
9
+ import TransactionTablePagination from "./TransactionTablePagination";
10
+ import useTransactionHistory from "../../../hooks/useTransactionHistory";
11
+ import {
12
+ formatAmount,
13
+ formatDate,
14
+ getPaymentMethodName,
15
+ } from "../../../utils/transactionTableUtils";
16
+
17
+ const TransactionTable = () => {
18
+ const {
19
+ transactions,
20
+ isLoadingHistory,
21
+ selectedTransaction,
22
+ filters,
23
+ handleFiltersChange,
24
+ handleTransactionSelect,
25
+ pagination,
26
+ } = useTransactionHistory();
27
+
28
+ const headers = [
29
+ { name: "txid", label: "TxId" },
30
+ { name: "reference", label: "Reference" },
31
+ { name: "amount", label: "Amount" },
32
+ { name: "paymentMethod", label: "Payment Method" },
33
+ { name: "type", label: "Type" },
34
+ { name: "status", label: "Status" },
35
+ { name: "created_at", label: "Created At" },
36
+ { name: "updated_at", label: "Updated At" },
37
+ { name: "details", label: "Details" },
38
+ ];
39
+
40
+ return (
41
+ <Flex direction="column" alignItems="stretch" gap={4} minHeight={"800px"}>
42
+ <FiltersPanel
43
+ filters={filters}
44
+ handleFiltersChange={handleFiltersChange}
45
+ isLoading={isLoadingHistory}
46
+ />
47
+ <Box>
48
+ <Table.Root
49
+ colCount={9}
50
+ rows={transactions}
51
+ isLoading={isLoadingHistory}
52
+ isFetching={isLoadingHistory}
53
+ >
54
+ <Table.Content footer={null}>
55
+ <Table.Head>
56
+ {headers.map((header) => (
57
+ <Table.HeaderCell
58
+ fieldSchemaType="custom"
59
+ isSortable={true}
60
+ key={header.name}
61
+ label={header.label}
62
+ name={header.name}
63
+ />
64
+ ))}
65
+ </Table.Head>
66
+ <Table.Body>
67
+ <Table.LoadingBody />
68
+ {transactions.length === 0 && !isLoadingHistory && (
69
+ <Tr>
70
+ <Td colSpan={9}>
71
+ <Box padding={6}>
72
+ <Typography textAlign="center" textColor="neutral600">
73
+ No transactions found
74
+ </Typography>
75
+ </Box>
76
+ </Td>
77
+ </Tr>
78
+ )}
79
+ {transactions.length > 0 &&
80
+ transactions.map((transaction) => {
81
+ const isSelected = selectedTransaction?.id === transaction.id;
82
+ return (
83
+ <React.Fragment key={transaction.id}>
84
+ <Tr>
85
+ <Td>
86
+ <Typography variant="pi" textColor="neutral600">
87
+ {transaction.txid || "N/A"}
88
+ </Typography>
89
+ </Td>
90
+ <Td>
91
+ <Typography variant="pi" fontWeight="medium">
92
+ {transaction.reference || "N/A"}
93
+ </Typography>
94
+ </Td>
95
+ <Td>
96
+ <Typography variant="pi" textColor="neutral600">
97
+ {formatAmount(
98
+ transaction.amount,
99
+ transaction.currency
100
+ )}
101
+ </Typography>
102
+ </Td>
103
+ <Td>
104
+ <Typography variant="pi">
105
+ {getPaymentMethodName(
106
+ transaction.raw_request?.clearingtype,
107
+ transaction.raw_request?.wallettype,
108
+ transaction.raw_request?.cardtype
109
+ )}
110
+ </Typography>
111
+ </Td>
112
+ <Td>
113
+ <Typography variant="pi" fontWeight="semiBold">
114
+ {transaction.request_type || "N/A"}
115
+ </Typography>
116
+ </Td>
117
+ <Td>
118
+ <StatusBadge
119
+ status={transaction?.status}
120
+ transaction={transaction}
121
+ />
122
+ </Td>
123
+ <Td>
124
+ <Typography variant="pi" textColor="neutral600">
125
+ {formatDate(transaction.created_at)}
126
+ </Typography>
127
+ </Td>
128
+ <Td>
129
+ <Typography variant="pi" textColor="neutral600">
130
+ {formatDate(transaction.updated_at)}
131
+ </Typography>
132
+ </Td>
133
+ <Td>
134
+ <Button
135
+ variant="tertiary"
136
+ size="S"
137
+ minWidth="100px"
138
+ startIcon={
139
+ isSelected ? <ChevronUp /> : <ChevronDown />
140
+ }
141
+ onClick={() => handleTransactionSelect(transaction)}
142
+ >
143
+ {isSelected ? "Hide" : "Details"}
144
+ </Button>
145
+ </Td>
146
+ </Tr>
147
+ {isSelected && (
148
+ <Tr>
149
+ <Td colSpan={9}>
150
+ <TransactionDetails transaction={transaction} />
151
+ </Td>
152
+ </Tr>
153
+ )}
154
+ </React.Fragment>
155
+ );
156
+ })}
157
+ </Table.Body>
158
+ </Table.Content>
159
+ </Table.Root>
160
+ </Box>
161
+
162
+ {transactions.length > 0 && (
163
+ <TransactionTablePagination pageCount={pagination.pageCount} />
164
+ )}
165
+ </Flex>
166
+ );
167
+ };
168
+
169
+ export default TransactionTable;
@@ -0,0 +1,28 @@
1
+ import { Flex, Box } from "@strapi/design-system";
2
+ import { PageSizeURLQuery, PaginationURLQuery } from "@strapi/helper-plugin";
3
+
4
+ const TransactionHistoryTablePagination = ({ pageCount }) => {
5
+ return (
6
+ <Box paddingTop={6} paddingBottom={4}>
7
+ <Flex
8
+ direction="row"
9
+ gap={2}
10
+ alignItems="center"
11
+ justifyContent="space-between"
12
+ wrap="wrap"
13
+ >
14
+ <PageSizeURLQuery
15
+ options={["5", "10", "20", "50", "100"]}
16
+ defaultValue={"10"}
17
+ />
18
+ <PaginationURLQuery
19
+ pagination={{ pageCount }}
20
+ boundaryCount={1}
21
+ siblingCount={1}
22
+ />
23
+ </Flex>
24
+ </Box>
25
+ );
26
+ };
27
+
28
+ export default TransactionHistoryTablePagination;
@@ -0,0 +1,155 @@
1
+ import JsonView from "@uiw/react-json-view";
2
+ import { githubDarkTheme } from "@uiw/react-json-view/githubDark";
3
+ import { Box, Flex, Typography } from "@strapi/design-system";
4
+ import { getCardTypeName } from "../../../../utils/transactionTableUtils";
5
+
6
+ const TransactionDetails = ({ transaction }) => {
7
+ return (
8
+ <Flex direction="column" gap={4} alignItems={"stretch"} marginTop={4}>
9
+ {transaction.status === "ERROR" && (
10
+ <Box padding={3} background="danger100" hasRadius>
11
+ <Typography
12
+ variant="pi"
13
+ fontWeight="bold"
14
+ textColor="danger600"
15
+ marginBottom={1}
16
+ >
17
+ Error: {transaction.error_message || "Unknown error"}
18
+ </Typography>
19
+ {transaction.customer_message && (
20
+ <Typography variant="pi" textColor="danger600">
21
+ Customer Message: {transaction.customer_message}
22
+ </Typography>
23
+ )}
24
+ </Box>
25
+ )}
26
+
27
+ <Box
28
+ style={{
29
+ display: "grid",
30
+ gridTemplateColumns: "repeat(auto-fit,minmax(400px,1fr))",
31
+ gap: "16px",
32
+ marginBottom: "1.5rem",
33
+ }}
34
+ >
35
+ <Flex direction="column" gap={2} alignItems={"stretch"}>
36
+ <Typography
37
+ variant="pi"
38
+ fontWeight="bold"
39
+ textColor="neutral800"
40
+ marginBottom={3}
41
+ >
42
+ Customer Information
43
+ </Typography>
44
+ <Flex gap={3}>
45
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
46
+ Name:
47
+ </Typography>
48
+ <Typography variant="pi" textColor="neutral800">
49
+ {transaction.raw_request?.firstname}{" "}
50
+ {transaction.raw_request?.lastname}
51
+ </Typography>
52
+ </Flex>
53
+ <Flex gap={3}>
54
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
55
+ Email:
56
+ </Typography>
57
+ <Typography variant="pi" textColor="neutral800">
58
+ {transaction.raw_request?.email || "N/A"}
59
+ </Typography>
60
+ </Flex>
61
+ <Flex gap={3}>
62
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
63
+ Phone:
64
+ </Typography>
65
+ <Typography variant="pi" textColor="neutral800">
66
+ {transaction.raw_request?.telephonenumber || "N/A"}
67
+ </Typography>
68
+ </Flex>
69
+ <Flex gap={3}>
70
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
71
+ Address:
72
+ </Typography>
73
+ <Typography variant="pi" textColor="neutral800">
74
+ {transaction.raw_request?.street}, {transaction.raw_request?.zip}{" "}
75
+ {transaction.raw_request?.city}
76
+ </Typography>
77
+ </Flex>
78
+ </Flex>
79
+ <Flex direction="column" gap={2} alignItems={"stretch"}>
80
+ <Typography
81
+ variant="pi"
82
+ fontWeight="bold"
83
+ textColor="neutral800"
84
+ marginBottom={3}
85
+ >
86
+ Payment Details
87
+ </Typography>
88
+ <Flex gap={3}>
89
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
90
+ TX ID:
91
+ </Typography>
92
+ <Typography variant="pi" textColor="neutral800">
93
+ {transaction.txid || "N/A"}
94
+ </Typography>
95
+ </Flex>
96
+ {transaction.raw_request?.clearingtype === "cc" && (
97
+ <>
98
+ <Flex gap={3}>
99
+ <Typography
100
+ variant="pi"
101
+ textColor="neutral600"
102
+ fontWeight="medium"
103
+ >
104
+ Card Type:
105
+ </Typography>
106
+ <Typography variant="pi" textColor="neutral800">
107
+ {getCardTypeName(transaction.raw_request?.cardtype)}
108
+ </Typography>
109
+ </Flex>
110
+ <Flex gap={3}>
111
+ <Typography
112
+ variant="pi"
113
+ textColor="neutral600"
114
+ fontWeight="medium"
115
+ >
116
+ Card Number:
117
+ </Typography>
118
+ <Typography variant="pi" textColor="neutral800">
119
+ **** **** ****{" "}
120
+ {transaction.raw_request?.cardpan?.slice(-4) || "****"}
121
+ </Typography>
122
+ </Flex>
123
+ </>
124
+ )}
125
+ <Flex gap={3}>
126
+ <Typography variant="pi" textColor="neutral600" fontWeight="medium">
127
+ Mode:
128
+ </Typography>
129
+ <Typography variant="pi" textColor="neutral800">
130
+ {transaction.raw_request?.mode || "N/A"}
131
+ </Typography>
132
+ </Flex>
133
+ </Flex>
134
+ </Box>
135
+
136
+ <Box>
137
+ <Typography variant="pi" fontWeight="bold" textColor="neutral800">
138
+ Transaction Data
139
+ </Typography>
140
+ <Box marginTop={4}>
141
+ <JsonView
142
+ value={transaction?.body}
143
+ style={githubDarkTheme}
144
+ displayDataTypes={false}
145
+ enableClipboard
146
+ collapsed={false}
147
+ displayObjectSize={false}
148
+ />
149
+ </Box>
150
+ </Box>
151
+ </Flex>
152
+ );
153
+ };
154
+
155
+ export default TransactionDetails;
@@ -2,12 +2,11 @@ import React, { useState, useEffect } from "react";
2
2
  import { useLocation, useHistory } from "react-router-dom";
3
3
  import { Layout, ContentLayout, Box } from "@strapi/design-system";
4
4
  import useSettings from "../hooks/useSettings";
5
- import useTransactionHistory from "../hooks/useTransactionHistory";
6
5
  import usePaymentActions from "../hooks/usePaymentActions";
7
6
  import AppHeader from "./components/AppHeader";
8
7
  import AppTabs from "./components/AppTabs";
9
- import ApplePayConfigPanel from "./components/ApplePayConfigPanel";
10
- import GooglePayConfigPanel from "./components/GooglePayConfigPanel";
8
+ import ApplePayConfigPanel from "./components/configuration/ApplePayConfigPanel";
9
+ import GooglePayConfigPanel from "./components/configuration/GooglePayConfigPanel";
11
10
  import "./styles.css";
12
11
  import pluginId from "../../pluginId";
13
12
 
@@ -18,7 +17,6 @@ const App = () => {
18
17
 
19
18
  // Custom hooks
20
19
  const settings = useSettings();
21
- const transactionHistory = useTransactionHistory();
22
20
  const paymentActions = usePaymentActions();
23
21
 
24
22
  useEffect(() => {
@@ -44,13 +42,11 @@ const App = () => {
44
42
 
45
43
  if (isApplePayConfigPage) {
46
44
  return (
47
- <Layout>
45
+ <Layout sideNav={null}>
48
46
  <AppHeader
49
- title="Apple Pay Configuration"
50
47
  activeTab={null}
51
48
  isSaving={settings.isSaving}
52
49
  onSave={settings.handleSave}
53
- onBack={() => history.push(`/plugins/${pluginId}`)}
54
50
  />
55
51
  <ContentLayout>
56
52
  <Box padding={6}>
@@ -68,13 +64,11 @@ const App = () => {
68
64
 
69
65
  if (isGooglePayConfigPage) {
70
66
  return (
71
- <Layout>
67
+ <Layout sideNav={null}>
72
68
  <AppHeader
73
- title="Google Pay Configuration"
74
69
  activeTab={null}
75
70
  isSaving={settings.isSaving}
76
71
  onSave={settings.handleSave}
77
- onBack={() => history.push(`/plugins/${pluginId}`)}
78
72
  />
79
73
  <ContentLayout>
80
74
  <Box padding={6}>
@@ -92,7 +86,7 @@ const App = () => {
92
86
  }
93
87
 
94
88
  return (
95
- <Layout>
89
+ <Layout sideNav={null}>
96
90
  <AppHeader
97
91
  activeTab={activeTab}
98
92
  isSaving={settings.isSaving}
@@ -104,29 +98,11 @@ const App = () => {
104
98
  activeTab={activeTab}
105
99
  setActiveTab={setActiveTab}
106
100
  settings={settings.settings}
107
- isSaving={settings.isSaving}
108
101
  isTesting={settings.isTesting}
109
102
  testResult={settings.testResult}
110
- onSave={settings.handleSave}
111
103
  onTestConnection={settings.handleTestConnection}
112
104
  onInputChange={settings.handleInputChange}
113
105
  onPaymentMethodToggle={settings.handlePaymentMethodToggle}
114
- filters={transactionHistory.filters}
115
- onFilterChange={transactionHistory.handleFilterChange}
116
- onFilterApply={transactionHistory.handleFilterApply}
117
- sorting={transactionHistory.sorting}
118
- onSort={transactionHistory.handleSort}
119
- isLoadingHistory={transactionHistory.isLoadingHistory}
120
- transactionHistory={transactionHistory.transactionHistory}
121
- paginatedTransactions={transactionHistory.paginatedTransactions}
122
- currentPage={transactionHistory.currentPage}
123
- totalPages={transactionHistory.totalPages}
124
- pageSize={transactionHistory.pageSize}
125
- onRefresh={transactionHistory.loadTransactionHistory}
126
- onPageChange={transactionHistory.handlePageChange}
127
- onPageSizeChange={transactionHistory.handlePageSizeChange}
128
- selectedTransaction={transactionHistory.selectedTransaction}
129
- onTransactionSelect={transactionHistory.handleTransactionSelect}
130
106
  paymentActions={paymentActions}
131
107
  history={history}
132
108
  />
@@ -52,6 +52,26 @@ const usePaymentActions = () => {
52
52
  const [cardexpiredate, setCardexpiredate] = useState("");
53
53
  const [cardcvc2, setCardcvc2] = useState("");
54
54
 
55
+ // Additional customer fields
56
+ const [firstname, setFirstname] = useState("");
57
+ const [lastname, setLastname] = useState("");
58
+ const [email, setEmail] = useState("");
59
+ const [telephonenumber, setTelephonenumber] = useState("");
60
+ const [gender, setGender] = useState("");
61
+ const [salutation, setSalutation] = useState("");
62
+ const [country, setCountry] = useState("");
63
+ const [currency, setCurrency] = useState("EUR");
64
+ const [city, setCity] = useState("");
65
+ const [street, setStreet] = useState("");
66
+ const [zip, setZip] = useState("");
67
+
68
+ // Capture form fields
69
+ const [captureCurrency, setCaptureCurrency] = useState("EUR");
70
+ const [captureSequenceNumber, setCaptureSequenceNumber] = useState("1");
71
+
72
+ // Refund form fields
73
+ const [refundCurrency, setRefundCurrency] = useState("EUR");
74
+
55
75
  const [isProcessingPayment, setIsProcessingPayment] = useState(false);
56
76
  const [paymentResult, setPaymentResult] = useState(null);
57
77
  const [paymentError, setPaymentError] = useState(null);
@@ -85,16 +105,27 @@ const usePaymentActions = () => {
85
105
  setPreauthReference(finalPreauthReference);
86
106
  }
87
107
 
88
- const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
108
+ const finalCurrency = currency || ((paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR");
89
109
 
90
110
  const baseParams = {
91
111
  amount: parseInt(paymentAmount),
92
- currency: currency,
112
+ currency: finalCurrency,
93
113
  reference: finalPreauthReference,
94
114
  enable3DSecure: settings.enable3DSecure !== false,
95
115
  invoiceid: finalPreauthReference,
96
116
  narrative_text: "Preauthorization for order " + finalPreauthReference,
97
- ...DEFAULT_PAYMENT_DATA
117
+ ...DEFAULT_PAYMENT_DATA,
118
+ // Override with form values if provided
119
+ ...(firstname && { firstname }),
120
+ ...(lastname && { lastname }),
121
+ ...(email && { email }),
122
+ ...(telephonenumber && { telephonenumber }),
123
+ ...(gender && { gender }),
124
+ ...(salutation && { salutation }),
125
+ ...(country && { country }),
126
+ ...(city && { city }),
127
+ ...(street && { street }),
128
+ ...(zip && { zip }),
98
129
  };
99
130
 
100
131
  if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
@@ -210,16 +241,27 @@ const usePaymentActions = () => {
210
241
  setAuthReference(finalAuthReference);
211
242
  }
212
243
 
213
- const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
244
+ const finalCurrency = currency || ((paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR");
214
245
 
215
246
  const baseParams = {
216
247
  amount: parseInt(paymentAmount),
217
- currency: currency,
248
+ currency: finalCurrency,
218
249
  reference: finalAuthReference,
219
250
  enable3DSecure: settings.enable3DSecure !== false,
220
251
  invoiceid: finalAuthReference,
221
252
  narrative_text: "Authorization for order " + finalAuthReference,
222
- ...DEFAULT_PAYMENT_DATA
253
+ ...DEFAULT_PAYMENT_DATA,
254
+ // Override with form values if provided
255
+ ...(firstname && { firstname }),
256
+ ...(lastname && { lastname }),
257
+ ...(email && { email }),
258
+ ...(telephonenumber && { telephonenumber }),
259
+ ...(gender && { gender }),
260
+ ...(salutation && { salutation }),
261
+ ...(country && { country }),
262
+ ...(city && { city }),
263
+ ...(street && { street }),
264
+ ...(zip && { zip }),
223
265
  };
224
266
 
225
267
  if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
@@ -337,9 +379,9 @@ const usePaymentActions = () => {
337
379
  const params = getCaptureParams(paymentMethod, {
338
380
  txid: captureTxid,
339
381
  amount: parseInt(paymentAmount),
340
- currency: "EUR",
382
+ currency: captureCurrency || "EUR",
341
383
  captureMode: captureMode,
342
- sequencenumber: 1
384
+ sequencenumber: parseInt(captureSequenceNumber) || 1
343
385
  });
344
386
 
345
387
  const result = await payoneRequests.capture(params);
@@ -363,9 +405,9 @@ const usePaymentActions = () => {
363
405
  try {
364
406
  const params = getRefundParams(paymentMethod, {
365
407
  txid: refundTxid,
366
- sequencenumber: parseInt(refundSequenceNumber),
408
+ sequencenumber: parseInt(refundSequenceNumber) || 2,
367
409
  amount: parseInt(paymentAmount),
368
- currency: "EUR",
410
+ currency: refundCurrency || "EUR",
369
411
  reference: refundReference || `REFUND-${Date.now()}`
370
412
  });
371
413
 
@@ -427,7 +469,41 @@ const usePaymentActions = () => {
427
469
  cardexpiredate,
428
470
  setCardexpiredate,
429
471
  cardcvc2,
430
- setCardcvc2
472
+ setCardcvc2,
473
+
474
+ // Customer fields
475
+ firstname,
476
+ setFirstname,
477
+ lastname,
478
+ setLastname,
479
+ email,
480
+ setEmail,
481
+ telephonenumber,
482
+ setTelephonenumber,
483
+ gender,
484
+ setGender,
485
+ salutation,
486
+ setSalutation,
487
+ country,
488
+ setCountry,
489
+ currency,
490
+ setCurrency,
491
+ city,
492
+ setCity,
493
+ street,
494
+ setStreet,
495
+ zip,
496
+ setZip,
497
+
498
+ // Capture form fields
499
+ captureCurrency,
500
+ setCaptureCurrency,
501
+ captureSequenceNumber,
502
+ setCaptureSequenceNumber,
503
+
504
+ // Refund form fields
505
+ refundCurrency,
506
+ setRefundCurrency,
431
507
  };
432
508
  };
433
509