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
@@ -0,0 +1,280 @@
1
+ export const COUNTRY_LANGUAGE_MAP = {
2
+ US: "en",
3
+ GB: "en",
4
+ CA: "en",
5
+ AU: "en",
6
+ NZ: "en",
7
+ IE: "en",
8
+ DE: "de",
9
+ AT: "de",
10
+ CH: "de",
11
+ FR: "fr",
12
+ BE: "fr",
13
+ IT: "it",
14
+ ES: "es",
15
+ PT: "pt",
16
+ NL: "nl",
17
+ PL: "pl",
18
+ CZ: "cs",
19
+ HU: "hu",
20
+ SE: "sv",
21
+ NO: "no",
22
+ DK: "da",
23
+ FI: "fi",
24
+ GR: "el",
25
+ JP: "ja",
26
+ CN: "zh",
27
+ HK: "zh",
28
+ TW: "zh",
29
+ SG: "en",
30
+ BR: "pt",
31
+ MX: "es",
32
+ AE: "ar",
33
+ SA: "ar",
34
+ RU: "ru",
35
+ UA: "uk",
36
+ TR: "tr",
37
+ ZA: "en",
38
+ IN: "en",
39
+ };
40
+
41
+ export const COUNTRIES = [
42
+ { code: "US", name: "United States" },
43
+ { code: "GB", name: "United Kingdom" },
44
+ { code: "CA", name: "Canada" },
45
+ { code: "AU", name: "Australia" },
46
+ { code: "DE", name: "Germany" },
47
+ { code: "FR", name: "France" },
48
+ { code: "IT", name: "Italy" },
49
+ { code: "ES", name: "Spain" },
50
+ { code: "NL", name: "Netherlands" },
51
+ { code: "BE", name: "Belgium" },
52
+ { code: "CH", name: "Switzerland" },
53
+ { code: "AT", name: "Austria" },
54
+ { code: "IE", name: "Ireland" },
55
+ { code: "SE", name: "Sweden" },
56
+ { code: "NO", name: "Norway" },
57
+ { code: "DK", name: "Denmark" },
58
+ { code: "FI", name: "Finland" },
59
+ { code: "PL", name: "Poland" },
60
+ { code: "CZ", name: "Czech Republic" },
61
+ { code: "HU", name: "Hungary" },
62
+ { code: "PT", name: "Portugal" },
63
+ { code: "GR", name: "Greece" },
64
+ { code: "JP", name: "Japan" },
65
+ { code: "CN", name: "China" },
66
+ { code: "HK", name: "Hong Kong" },
67
+ { code: "TW", name: "Taiwan" },
68
+ { code: "SG", name: "Singapore" },
69
+ { code: "NZ", name: "New Zealand" },
70
+ { code: "BR", name: "Brazil" },
71
+ { code: "MX", name: "Mexico" },
72
+ { code: "AE", name: "United Arab Emirates" },
73
+ { code: "SA", name: "Saudi Arabia" },
74
+ { code: "RU", name: "Russia" },
75
+ { code: "UA", name: "Ukraine" },
76
+ { code: "TR", name: "Turkey" },
77
+ { code: "ZA", name: "South Africa" },
78
+ { code: "IN", name: "India" },
79
+ ];
80
+
81
+ export const getLanguageForCountry = (countryCode) => {
82
+ return COUNTRY_LANGUAGE_MAP[countryCode] || "en";
83
+ };
84
+
85
+ export const SALUTATION_OPTIONS = {
86
+ en: [
87
+ { value: "Mr", label: "Mr" },
88
+ { value: "Mrs", label: "Mrs" },
89
+ { value: "Ms", label: "Ms" },
90
+ { value: "Dr", label: "Dr" },
91
+ ],
92
+ de: [
93
+ { value: "Herr", label: "Herr" },
94
+ { value: "Frau", label: "Frau" },
95
+ { value: "Dr", label: "Dr" },
96
+ ],
97
+ fr: [
98
+ { value: "Monsieur", label: "Monsieur" },
99
+ { value: "Madame", label: "Madame" },
100
+ { value: "Mademoiselle", label: "Mademoiselle" },
101
+ ],
102
+ it: [
103
+ { value: "Signore", label: "Signore" },
104
+ { value: "Signora", label: "Signora" },
105
+ { value: "Signorina", label: "Signorina" },
106
+ ],
107
+ es: [
108
+ { value: "Señor", label: "Señor" },
109
+ { value: "Señora", label: "Señora" },
110
+ { value: "Señorita", label: "Señorita" },
111
+ ],
112
+ nl: [
113
+ { value: "Dhr", label: "Dhr" },
114
+ { value: "Mevr", label: "Mevr" },
115
+ ],
116
+ pt: [
117
+ { value: "Senhor", label: "Senhor" },
118
+ { value: "Senhora", label: "Senhora" },
119
+ ],
120
+ default: [
121
+ { value: "Mr", label: "Mr" },
122
+ { value: "Mrs", label: "Mrs" },
123
+ { value: "Ms", label: "Ms" },
124
+ ],
125
+ };
126
+
127
+ export const GENDER_OPTIONS = {
128
+ en: [
129
+ { value: "m", label: "Male" },
130
+ { value: "f", label: "Female" },
131
+ ],
132
+ de: [
133
+ { value: "m", label: "Männlich" },
134
+ { value: "f", label: "Weiblich" },
135
+ ],
136
+ fr: [
137
+ { value: "m", label: "Masculin" },
138
+ { value: "f", label: "Féminin" },
139
+ ],
140
+ it: [
141
+ { value: "m", label: "Maschio" },
142
+ { value: "f", label: "Femmina" },
143
+ ],
144
+ es: [
145
+ { value: "m", label: "Masculino" },
146
+ { value: "f", label: "Femenino" },
147
+ ],
148
+ nl: [
149
+ { value: "m", label: "Man" },
150
+ { value: "f", label: "Vrouw" },
151
+ ],
152
+ pt: [
153
+ { value: "m", label: "Masculino" },
154
+ { value: "f", label: "Feminino" },
155
+ ],
156
+ default: [
157
+ { value: "m", label: "Male" },
158
+ { value: "f", label: "Female" },
159
+ ],
160
+ };
161
+
162
+ export const getSalutationOptions = (countryCode) => {
163
+ const language = getLanguageForCountry(countryCode);
164
+ return SALUTATION_OPTIONS[language] || SALUTATION_OPTIONS.default;
165
+ };
166
+
167
+ export const getGenderOptions = (countryCode) => {
168
+ const language = getLanguageForCountry(countryCode);
169
+ return GENDER_OPTIONS[language] || GENDER_OPTIONS.default;
170
+ };
171
+
172
+ export const COUNTRY_CURRENCY_MAP = {
173
+ US: "USD",
174
+ GB: "GBP",
175
+ CA: "CAD",
176
+ AU: "AUD",
177
+ NZ: "NZD",
178
+ IE: "EUR",
179
+ DE: "EUR",
180
+ AT: "EUR",
181
+ CH: "CHF",
182
+ FR: "EUR",
183
+ BE: "EUR",
184
+ IT: "EUR",
185
+ ES: "EUR",
186
+ NL: "EUR",
187
+ PL: "PLN",
188
+ CZ: "CZK",
189
+ HU: "HUF",
190
+ PT: "EUR",
191
+ GR: "EUR",
192
+ SE: "SEK",
193
+ NO: "NOK",
194
+ DK: "DKK",
195
+ FI: "EUR",
196
+ JP: "JPY",
197
+ CN: "CNY",
198
+ HK: "HKD",
199
+ TW: "TWD",
200
+ SG: "SGD",
201
+ BR: "BRL",
202
+ MX: "MXN",
203
+ AE: "AED",
204
+ SA: "SAR",
205
+ RU: "RUB",
206
+ UA: "UAH",
207
+ TR: "TRY",
208
+ ZA: "ZAR",
209
+ IN: "INR",
210
+ };
211
+
212
+ export const CURRENCIES = [
213
+ { code: "USD", name: "US Dollar", symbol: "$" },
214
+ { code: "EUR", name: "Euro", symbol: "€" },
215
+ { code: "GBP", name: "British Pound", symbol: "£" },
216
+ { code: "CAD", name: "Canadian Dollar", symbol: "C$" },
217
+ { code: "AUD", name: "Australian Dollar", symbol: "A$" },
218
+ { code: "JPY", name: "Japanese Yen", symbol: "¥" },
219
+ { code: "CNY", name: "Chinese Yuan", symbol: "¥" },
220
+ { code: "HKD", name: "Hong Kong Dollar", symbol: "HK$" },
221
+ { code: "TWD", name: "Taiwan Dollar", symbol: "NT$" },
222
+ { code: "SGD", name: "Singapore Dollar", symbol: "S$" },
223
+ { code: "NZD", name: "New Zealand Dollar", symbol: "NZ$" },
224
+ { code: "BRL", name: "Brazilian Real", symbol: "R$" },
225
+ { code: "MXN", name: "Mexican Peso", symbol: "Mex$" },
226
+ { code: "AED", name: "UAE Dirham", symbol: "د.إ" },
227
+ { code: "SAR", name: "Saudi Riyal", symbol: "﷼" },
228
+ { code: "RUB", name: "Russian Ruble", symbol: "₽" },
229
+ { code: "UAH", name: "Ukrainian Hryvnia", symbol: "₴" },
230
+ { code: "TRY", name: "Turkish Lira", symbol: "₺" },
231
+ { code: "ZAR", name: "South African Rand", symbol: "R" },
232
+ { code: "CHF", name: "Swiss Franc", symbol: "CHF" },
233
+ { code: "SEK", name: "Swedish Krona", symbol: "kr" },
234
+ { code: "NOK", name: "Norwegian Krone", symbol: "kr" },
235
+ { code: "DKK", name: "Danish Krone", symbol: "kr" },
236
+ { code: "PLN", name: "Polish Zloty", symbol: "zł" },
237
+ { code: "CZK", name: "Czech Koruna", symbol: "Kč" },
238
+ { code: "HUF", name: "Hungarian Forint", symbol: "Ft" },
239
+ { code: "INR", name: "Indian Rupee", symbol: "₹" },
240
+ ];
241
+
242
+ export const getCurrencyForCountry = (countryCode) => {
243
+ return COUNTRY_CURRENCY_MAP[countryCode] || "EUR";
244
+ };
245
+
246
+ export const getCurrencyOptions = () => {
247
+ return CURRENCIES.map((c) => ({
248
+ value: c.code,
249
+ label: `${c.name} (${c.code}) ${c.symbol}`,
250
+ }));
251
+ };
252
+
253
+ export const getCountryOptions = (paymentMethod) => {
254
+ let supportedCountryCodes = [];
255
+
256
+ if (paymentMethod === "apl") {
257
+ supportedCountryCodes = [
258
+ "US", "GB", "CA", "AU", "DE", "FR", "IT", "ES", "NL", "BE", "CH", "AT", "IE",
259
+ "SE", "NO", "DK", "FI", "PL", "CZ", "HU", "PT", "GR", "JP", "CN", "HK", "TW",
260
+ "SG", "NZ", "BR", "MX", "AE", "SA", "RU", "UA", "TR", "ZA"
261
+ ];
262
+ } else if (paymentMethod === "gpp") {
263
+ supportedCountryCodes = [
264
+ "US", "GB", "CA", "AU", "DE", "FR", "IT", "ES", "NL", "BE", "CH", "AT", "IE",
265
+ "SE", "NO", "DK", "FI", "PL", "BR", "MX", "JP", "SG", "NZ", "IN"
266
+ ];
267
+ }
268
+
269
+ const hasRestriction = supportedCountryCodes.length > 0;
270
+
271
+ return COUNTRIES.map((country) => {
272
+ const isSupported = !hasRestriction || supportedCountryCodes.includes(country.code);
273
+ return {
274
+ value: country.code,
275
+ label: `${country.name} (${country.code})`,
276
+ disabled: hasRestriction && !isSupported,
277
+ };
278
+ });
279
+ };
280
+
@@ -0,0 +1,225 @@
1
+ import {
2
+ TextInput,
3
+ NumberInput,
4
+ SingleSelect,
5
+ SingleSelectOption,
6
+ Switch,
7
+ DesignSystemProvider,
8
+ Tooltip,
9
+ Textarea,
10
+ Toggle,
11
+ Checkbox,
12
+ Typography,
13
+ } from "@strapi/design-system";
14
+ import { Information } from "@strapi/icons";
15
+ export const InputComponent = ({
16
+ inputType,
17
+ name,
18
+ value,
19
+ onChange,
20
+ tooltipContent,
21
+ options,
22
+ required = false,
23
+ placeholder = "",
24
+ onLabel = "True",
25
+ offLabel = "False",
26
+ systemTheme,
27
+ theme,
28
+ className = "payment-input",
29
+ type = "text",
30
+ ...props
31
+ }) => {
32
+ switch (inputType) {
33
+ case "textInput":
34
+ return (
35
+ <TextInput
36
+ className={className}
37
+ name={name}
38
+ value={value ?? ""}
39
+ id={name}
40
+ placeholder={placeholder}
41
+ required={required}
42
+ onChange={onChange}
43
+ type={type}
44
+ endAction={
45
+ tooltipContent ? (
46
+ <DesignSystemProvider theme={theme}>
47
+ <Tooltip label={tooltipContent ?? ""}>
48
+ <Information
49
+ style={{
50
+ cursor: "pointer",
51
+ color: systemTheme === "dark" ? "#fff" : "#000",
52
+ }}
53
+ />
54
+ </Tooltip>
55
+ </DesignSystemProvider>
56
+ ) : null
57
+ }
58
+ {...props}
59
+ />
60
+ );
61
+
62
+ case "numberInput":
63
+ return (
64
+ <NumberInput
65
+ className={className}
66
+ onValueChange={onChange}
67
+ value={value ?? ""}
68
+ id={name}
69
+ name={name}
70
+ placeholder={placeholder}
71
+ required={required}
72
+ startAction={
73
+ tooltipContent ? (
74
+ <DesignSystemProvider theme={theme}>
75
+ <Tooltip label={tooltipContent ?? ""}>
76
+ <Information
77
+ style={{
78
+ cursor: "pointer",
79
+ color: systemTheme === "dark" ? "#fff" : "#000",
80
+ }}
81
+ />
82
+ </Tooltip>
83
+ </DesignSystemProvider>
84
+ ) : null
85
+ }
86
+ {...props}
87
+ />
88
+ );
89
+
90
+ case "textarea":
91
+ return (
92
+ <Textarea
93
+ className={className}
94
+ name={name}
95
+ value={value ?? ""}
96
+ onChange={(e) => onChange(e.target.value)}
97
+ id={name}
98
+ placeholder={placeholder}
99
+ required={required}
100
+ cols={9}
101
+ rows={3}
102
+ {...props}
103
+ />
104
+ );
105
+
106
+ case "toggle":
107
+ return (
108
+ <Toggle
109
+ className={className}
110
+ name={name}
111
+ checked={value === true}
112
+ onChange={onChange}
113
+ id={name}
114
+ required={required}
115
+ onLabel={onLabel}
116
+ offLabel={offLabel}
117
+ {...props}
118
+ />
119
+ );
120
+
121
+ case "checkbox":
122
+ return (
123
+ <Checkbox
124
+ className={className}
125
+ name={name}
126
+ checked={value === true}
127
+ onCheckedChange={onChange}
128
+ id={name}
129
+ required={required}
130
+ {...props}
131
+ />
132
+ );
133
+
134
+ case "dateInput":
135
+ return (
136
+ <TextInput
137
+ className={className}
138
+ name={name}
139
+ value={value ?? ""}
140
+ onChange={onChange}
141
+ placeholder={placeholder}
142
+ required={required}
143
+ type="date"
144
+ startAction={
145
+ tooltipContent ? (
146
+ <DesignSystemProvider theme={theme}>
147
+ <Tooltip label={tooltipContent ?? ""}>
148
+ <Information
149
+ style={{
150
+ cursor: "pointer",
151
+ color: systemTheme === "dark" ? "#fff" : "#000",
152
+ }}
153
+ />
154
+ </Tooltip>
155
+ </DesignSystemProvider>
156
+ ) : null
157
+ }
158
+ {...props}
159
+ />
160
+ );
161
+
162
+ case "switch":
163
+ return (
164
+ <Switch
165
+ className={className}
166
+ onCheckedChange={onChange}
167
+ checked={value === true}
168
+ {...props}
169
+ />
170
+ );
171
+
172
+ case "select":
173
+ return (
174
+ <SingleSelect
175
+ className={className}
176
+ name={name}
177
+ value={value ?? ""}
178
+ onChange={(selectedValue) => {
179
+ if (typeof onChange === "function") {
180
+ const syntheticEvent = {
181
+ target: { value: selectedValue },
182
+ currentTarget: { value: selectedValue },
183
+ };
184
+ onChange(syntheticEvent);
185
+ }
186
+ }}
187
+ required={required}
188
+ placeholder={placeholder}
189
+ startIcon={
190
+ tooltipContent ? (
191
+ <DesignSystemProvider theme={theme}>
192
+ <Tooltip label={tooltipContent ?? ""}>
193
+ <Information
194
+ style={{
195
+ cursor: "pointer",
196
+ color: systemTheme === "dark" ? "#fff" : "#000",
197
+ }}
198
+ />
199
+ </Tooltip>
200
+ </DesignSystemProvider>
201
+ ) : null
202
+ }
203
+ {...props}
204
+ >
205
+ {options.map((option) => (
206
+ <SingleSelectOption
207
+ className={className}
208
+ key={option.value}
209
+ value={option.value}
210
+ disabled={option.disabled || false}
211
+ >
212
+ {option.label}
213
+ </SingleSelectOption>
214
+ ))}
215
+ </SingleSelect>
216
+ );
217
+
218
+ default:
219
+ return (
220
+ <Typography variant="omega" fontWeight="semiBold">
221
+ Invalid input type: {inputType}
222
+ </Typography>
223
+ );
224
+ }
225
+ };
@@ -1,11 +1,4 @@
1
- /**
2
- * Google Pay Constants
3
- * Based on Google Pay documentation and Payone requirements
4
- * https://developers.google.com/pay/api/web/overview
5
- * https://docs.payone.com/display/public/PLATFORM/Google+Pay
6
- */
7
1
 
8
- // Google Pay supported card networks
9
2
  export const GOOGLE_PAY_SUPPORTED_NETWORKS = [
10
3
  { code: "MASTERCARD", name: "Mastercard" },
11
4
  { code: "VISA", name: "Visa" },
@@ -14,10 +7,10 @@ export const GOOGLE_PAY_SUPPORTED_NETWORKS = [
14
7
  { code: "JCB", name: "JCB" }
15
8
  ];
16
9
 
17
- // Google Pay supported authentication methods
18
10
  export const GOOGLE_PAY_AUTH_METHODS = [
19
11
  { code: "PAN_ONLY", name: "PAN Only", description: "Basic card authentication" },
20
- { code: "CRYPTOGRAM_3DS", name: "3D Secure", description: "3D Secure authentication" }
12
+ { code: "CRYPTOGRAM_3DS", name: "3D Secure", description: "3D Secure authentication" },
13
+
21
14
  ];
22
15
 
23
16
  // Google Pay supported countries
@@ -9,18 +9,15 @@ export function getValidCardExpiryDate(cardexpiredate) {
9
9
  return `${nextYear}${monthStr}`;
10
10
  }
11
11
 
12
- // Validate format (must be 4 digits)
13
12
  if (!/^\d{4}$/.test(cardexpiredate)) {
14
13
  const nextYear = currentYear + 1;
15
14
  const monthStr = String(currentMonth).padStart(2, '0');
16
15
  return `${nextYear}${monthStr}`;
17
16
  }
18
17
 
19
- // Parse YYMM format
20
18
  const year = parseInt(cardexpiredate.substring(0, 2), 10);
21
19
  const month = parseInt(cardexpiredate.substring(2, 4), 10);
22
20
 
23
- // Validate month (1-12)
24
21
  if (month < 1 || month > 12) {
25
22
  const nextYear = currentYear + 1;
26
23
  const monthStr = String(currentMonth).padStart(2, '0');
@@ -100,16 +97,12 @@ export const getBaseParams = (options = {}) => {
100
97
  city,
101
98
  country: country.toUpperCase(),
102
99
  email,
103
-
104
- // Additional customer details
105
100
  salutation,
106
101
  gender,
107
102
  telephonenumber,
108
103
  ip,
109
104
  customer_is_present,
110
105
  language,
111
-
112
- // URL parameters (required for redirect-based payments)
113
106
  successurl,
114
107
  errorurl,
115
108
  backurl
@@ -128,14 +121,12 @@ export const getPaymentMethodParams = (paymentMethod, options = {}) => {
128
121
  iban,
129
122
  bic,
130
123
  bankaccountholder,
131
- // Shipping address for wallet payments (Google Pay, Apple Pay, PayPal)
132
124
  shipping_firstname,
133
125
  shipping_lastname,
134
126
  shipping_street,
135
127
  shipping_zip,
136
128
  shipping_city,
137
129
  shipping_country,
138
- // Billing address (used as fallback for shipping)
139
130
  firstname,
140
131
  lastname,
141
132
  street,
@@ -144,10 +135,8 @@ export const getPaymentMethodParams = (paymentMethod, options = {}) => {
144
135
  country
145
136
  } = options;
146
137
 
147
- // Use cardtype if provided, otherwise fall back to cardType, otherwise default to "V"
148
138
  const finalCardType = cardtype || cardType || "V";
149
139
 
150
- // Helper to get shipping params for wallet payments
151
140
  const getShippingParams = () => ({
152
141
  shipping_firstname: shipping_firstname || firstname || "John",
153
142
  shipping_lastname: shipping_lastname || lastname || "Doe",
@@ -158,19 +147,19 @@ export const getPaymentMethodParams = (paymentMethod, options = {}) => {
158
147
  });
159
148
 
160
149
  switch (paymentMethod) {
161
- case "cc": // Credit Card (Visa, Mastercard, Amex)
150
+ case "cc":
162
151
  return {
163
152
  clearingtype: "cc",
164
- cardtype: finalCardType, // V = Visa, M = Mastercard, A = Amex
165
- cardpan: cardpan || "4111111111111111", // Test Visa card
153
+ cardtype: finalCardType,
154
+ cardpan: cardpan || "4111111111111111",
166
155
  cardexpiredate: getValidCardExpiryDate(cardexpiredate),
167
- cardcvc2: cardcvc2 || "123" // 3-digit security code
156
+ cardcvc2: cardcvc2 || "123"
168
157
  };
169
158
 
170
- case "wlt": // PayPal
159
+ case "wlt":
171
160
  return {
172
161
  clearingtype: "wlt",
173
- wallettype: "PPE", // PayPal Express
162
+ wallettype: "PPE",
174
163
  ...getShippingParams()
175
164
  };
176
165
 
@@ -194,10 +183,10 @@ export const getPaymentMethodParams = (paymentMethod, options = {}) => {
194
183
 
195
184
  return googlePayParams;
196
185
 
197
- case "apl": // Apple Pay
186
+ case "apl":
198
187
  const applePayParams = {
199
188
  clearingtype: "wlt",
200
- wallettype: "APL", // Apple Pay
189
+ wallettype: "APL",
201
190
  ...getShippingParams()
202
191
  };
203
192
 
@@ -214,24 +203,23 @@ export const getPaymentMethodParams = (paymentMethod, options = {}) => {
214
203
 
215
204
  return applePayParams;
216
205
 
217
- case "sb": // Sofort Banking
206
+ case "sb":
218
207
  return {
219
208
  clearingtype: "sb",
220
209
  bankcountry: "DE",
221
- onlinebanktransfertype: "PNT" // Sofort Banking
210
+ onlinebanktransfertype: "PNT"
222
211
  };
223
212
 
224
- case "elv": // SEPA Direct Debit
213
+ case "elv":
225
214
  return {
226
215
  clearingtype: "elv",
227
216
  bankcountry: "DE",
228
- iban: iban || "DE89370400440532013000", // Test IBAN
229
- bic: bic || "COBADEFFXXX", // Test BIC
217
+ iban: iban || "DE89370400440532013000",
218
+ bic: bic || "COBADEFFXXX",
230
219
  bankaccountholder: bankaccountholder || "John Doe"
231
220
  };
232
221
 
233
222
  default:
234
- // Default to credit card for unknown payment methods
235
223
  return {
236
224
  clearingtype: "cc",
237
225
  cardtype: "V",
@@ -0,0 +1,18 @@
1
+
2
+ export const shouldShowTooltip = (inputType, tooltipContent) => {
3
+ if (!tooltipContent) {
4
+ return false;
5
+ }
6
+
7
+ const inputTypesWithTooltip = ["switch", "toggle", "checkbox", "textarea"];
8
+
9
+ return inputTypesWithTooltip.includes(inputType);
10
+ };
11
+
12
+
13
+ export const getTooltipProps = (tooltipContent) => {
14
+ return {
15
+ label: tooltipContent,
16
+ position: "top",
17
+ };
18
+ };