strapi-plugin-payone-provider 4.6.9 → 5.6.10

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 (104) hide show
  1. package/README.md +156 -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 -162
  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 +24 -71
  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 -70
  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 +105 -108
  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 -26
  69. package/admin/src/pages/utils/tooltipHelpers.js +18 -0
  70. package/admin/src/pages/utils/transactionTableUtils.js +60 -0
  71. package/package.json +8 -14
  72. package/server/config/index.js +18 -2
  73. package/server/controllers/payone.js +98 -31
  74. package/server/policies/index.js +2 -1
  75. package/server/policies/is-auth.js +9 -3
  76. package/server/policies/is-payone-notification.js +31 -0
  77. package/server/policies/isSuperAdmin.js +7 -5
  78. package/server/routes/index.js +11 -0
  79. package/server/services/paymentService.js +6 -22
  80. package/server/services/payone.js +10 -3
  81. package/server/services/settingsService.js +13 -3
  82. package/server/services/testConnectionService.js +11 -73
  83. package/server/services/transactionService.js +62 -99
  84. package/server/services/transactionStatusService.js +87 -0
  85. package/server/utils/normalize.js +0 -12
  86. package/server/utils/paymentMethodParams.js +0 -1
  87. package/server/utils/requestBuilder.js +34 -5
  88. package/server/utils/responseParser.js +9 -14
  89. package/strapi-admin.js +3 -1
  90. package/admin/src/pages/App/components/ConfigurationPanel.jsx +0 -517
  91. package/admin/src/pages/App/components/CustomerInfoPopover.jsx +0 -147
  92. package/admin/src/pages/App/components/HistoryPanel.jsx +0 -94
  93. package/admin/src/pages/App/components/PaymentActionsPanel.jsx +0 -280
  94. package/admin/src/pages/App/components/RawDataPopover.jsx +0 -113
  95. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTableFilters.jsx +0 -113
  96. package/admin/src/pages/App/components/TransactionHistoryTable/TransactionHistoryTablePagination.jsx +0 -180
  97. package/admin/src/pages/App/components/TransactionHistoryTable/index.jsx +0 -225
  98. package/admin/src/pages/App/components/paymentActions/ApplePayPanel.jsx +0 -95
  99. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.jsx +0 -197
  100. package/admin/src/pages/App/components/paymentActions/CaptureForm.jsx +0 -65
  101. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.jsx +0 -306
  102. package/admin/src/pages/App/components/paymentActions/PaymentResult.jsx +0 -192
  103. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.jsx +0 -142
  104. package/admin/src/pages/App/components/paymentActions/RefundForm.jsx +0 -90
@@ -1,12 +1,4 @@
1
- /**
2
- * Apple Pay Constants
3
- * Based on Apple Pay documentation and Payone requirements
4
- * https://developer.apple.com/documentation/applepayontheweb
5
- * https://docs.payone.com/payment-methods/apple-pay/apple-pay-without-dev
6
- */
7
-
8
- // Apple Pay supported countries
9
- // Note: Apple Pay availability varies by country
1
+
10
2
  export const APPLE_PAY_SUPPORTED_COUNTRIES = [
11
3
  { code: "US", name: "United States" },
12
4
  { code: "GB", name: "United Kingdom" },
@@ -46,8 +38,6 @@ export const APPLE_PAY_SUPPORTED_COUNTRIES = [
46
38
  { code: "ZA", name: "South Africa" }
47
39
  ];
48
40
 
49
- // Apple Pay supported currencies
50
- // Note: Some currencies may be restricted in certain countries
51
41
  export const APPLE_PAY_SUPPORTED_CURRENCIES = [
52
42
  { code: "USD", name: "US Dollar", symbol: "$" },
53
43
  { code: "EUR", name: "Euro", symbol: "€" },
@@ -77,7 +67,6 @@ export const APPLE_PAY_SUPPORTED_CURRENCIES = [
77
67
  { code: "HUF", name: "Hungarian Forint", symbol: "Ft" }
78
68
  ];
79
69
 
80
- // Apple Pay supported payment networks
81
70
  export const APPLE_PAY_SUPPORTED_NETWORKS = [
82
71
  { code: "amex", name: "American Express" },
83
72
  { code: "discover", name: "Discover" },
@@ -92,15 +81,12 @@ export const APPLE_PAY_SUPPORTED_NETWORKS = [
92
81
  { code: "privateLabel", name: "Private Label" }
93
82
  ];
94
83
 
95
- // Merchant capabilities
96
84
  export const APPLE_PAY_MERCHANT_CAPABILITIES = [
97
85
  { code: "supports3DS", name: "3D Secure", description: "Required for most payment methods" },
98
86
  { code: "supportsCredit", name: "Credit Cards", description: "Support credit card payments" },
99
87
  { code: "supportsDebit", name: "Debit Cards", description: "Support debit card payments" }
100
88
  ];
101
89
 
102
- // Country-currency restrictions
103
- // Some currencies are not available in certain countries
104
90
  export const COUNTRY_CURRENCY_RESTRICTIONS = {
105
91
  US: ["USD"],
106
92
  GB: ["GBP", "EUR"],
@@ -126,20 +112,16 @@ export const COUNTRY_CURRENCY_RESTRICTIONS = {
126
112
  ZA: ["ZAR"]
127
113
  };
128
114
 
129
- // Get supported currencies for a country
130
115
  export const getSupportedCurrenciesForCountry = (countryCode) => {
131
116
  const restrictions = COUNTRY_CURRENCY_RESTRICTIONS[countryCode];
132
117
  if (restrictions) {
133
- return APPLE_PAY_SUPPORTED_CURRENCIES.filter(currency =>
118
+ return APPLE_PAY_SUPPORTED_CURRENCIES.filter(currency =>
134
119
  restrictions.includes(currency.code)
135
120
  );
136
121
  }
137
- // Default: return all currencies if no restrictions
138
122
  return APPLE_PAY_SUPPORTED_CURRENCIES;
139
123
  };
140
124
 
141
- // Get supported networks for a country
142
- // Some networks are country-specific
143
125
  export const getSupportedNetworksForCountry = (countryCode) => {
144
126
  const countryNetworks = {
145
127
  US: ["amex", "discover", "masterCard", "visa"],
@@ -157,30 +139,23 @@ export const getSupportedNetworksForCountry = (countryCode) => {
157
139
  return countryNetworks[countryCode] || countryNetworks.default;
158
140
  };
159
141
 
160
- // Test data for Apple Pay
161
- // Based on Apple Pay sandbox testing documentation
162
142
  export const APPLE_PAY_TEST_DATA = {
163
- // Test card numbers (for sandbox testing)
164
143
  testCards: {
165
144
  visa: "4111111111111111",
166
145
  mastercard: "5555555555554444",
167
146
  amex: "378282246310005",
168
147
  discover: "6011111111111117"
169
148
  },
170
- // Test merchant identifiers (for development)
171
149
  testMerchantIdentifier: "merchant.com.payone.test",
172
- // Test domain
173
150
  testDomain: "test.payone.com"
174
151
  };
175
152
 
176
- // Apple Pay button styles
177
153
  export const APPLE_PAY_BUTTON_STYLES = [
178
154
  { code: "black", name: "Black" },
179
155
  { code: "white", name: "White with outline" },
180
156
  { code: "white-outline", name: "White" }
181
157
  ];
182
158
 
183
- // Apple Pay button types
184
159
  export const APPLE_PAY_BUTTON_TYPES = [
185
160
  { code: "plain", name: "Plain" },
186
161
  { code: "buy", name: "Buy" },
@@ -201,7 +176,6 @@ export const APPLE_PAY_BUTTON_TYPES = [
201
176
  { code: "set-up", name: "Set Up" }
202
177
  ];
203
178
 
204
- // Default Apple Pay configuration
205
179
  export const DEFAULT_APPLE_PAY_CONFIG = {
206
180
  countryCode: "DE",
207
181
  currencyCode: "EUR",
@@ -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