strapi-plugin-payone-provider 1.6.0 → 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 (42) hide show
  1. package/admin/src/components/Initializer/index.js +16 -0
  2. package/admin/src/components/PluginIcon/index.js +6 -0
  3. package/admin/src/pages/App/components/AppHeader.js +55 -0
  4. package/admin/src/pages/App/components/AppTabs.js +158 -0
  5. package/admin/src/pages/App/components/ApplePayButton.js +950 -0
  6. package/admin/src/pages/App/components/ApplePayConfig.js +364 -0
  7. package/admin/src/pages/App/components/ApplePayConfigPanel.js +81 -0
  8. package/admin/src/pages/App/components/ConfigurationPanel.js +280 -0
  9. package/admin/src/pages/App/components/DocsPanel.js +1057 -0
  10. package/admin/src/pages/App/components/GooglePayConfig.js +217 -0
  11. package/admin/src/pages/App/components/GooglePayConfigPanel.js +82 -0
  12. package/admin/src/pages/App/components/GooglePaybutton.js +300 -0
  13. package/admin/src/pages/App/components/HistoryPanel.js +285 -0
  14. package/admin/src/pages/App/components/PaymentActionsPanel.js +190 -0
  15. package/admin/src/pages/App/components/StatusBadge.js +24 -0
  16. package/admin/src/pages/App/components/TransactionHistoryItem.js +377 -0
  17. package/admin/src/pages/App/components/icons/BankIcon.js +10 -0
  18. package/admin/src/pages/App/components/icons/ChevronDownIcon.js +9 -0
  19. package/admin/src/pages/App/components/icons/ChevronUpIcon.js +9 -0
  20. package/admin/src/pages/App/components/icons/CreditCardIcon.js +9 -0
  21. package/admin/src/pages/App/components/icons/ErrorIcon.js +10 -0
  22. package/admin/src/pages/App/components/icons/InfoIcon.js +9 -0
  23. package/admin/src/pages/App/components/icons/PaymentIcon.js +10 -0
  24. package/admin/src/pages/App/components/icons/PendingIcon.js +9 -0
  25. package/admin/src/pages/App/components/icons/PersonIcon.js +9 -0
  26. package/admin/src/pages/App/components/icons/SuccessIcon.js +9 -0
  27. package/admin/src/pages/App/components/icons/WalletIcon.js +9 -0
  28. package/admin/src/pages/App/components/icons/index.js +11 -0
  29. package/admin/src/pages/App/components/paymentActions/AuthorizationForm.js +195 -0
  30. package/admin/src/pages/App/components/paymentActions/CaptureForm.js +65 -0
  31. package/admin/src/pages/App/components/paymentActions/CardDetailsInput.js +191 -0
  32. package/admin/src/pages/App/components/paymentActions/PaymentMethodSelector.js +156 -0
  33. package/admin/src/pages/App/components/paymentActions/PaymentResult.js +148 -0
  34. package/admin/src/pages/App/components/paymentActions/PreauthorizationForm.js +199 -0
  35. package/admin/src/pages/App/components/paymentActions/RefundForm.js +90 -0
  36. package/admin/src/pages/App/index.js +127 -0
  37. package/admin/src/pages/hooks/usePaymentActions.js +171 -0
  38. package/package.json +49 -49
  39. package/server/bootstrap.js +7 -0
  40. package/server/controllers/payone.js +0 -2
  41. package/server/services/transactionService.js +28 -0
  42. package/server/utils/paymentMethodParams.js +1 -7
@@ -13,6 +13,10 @@ import { DEFAULT_PAYMENT_DATA } from "../constants/paymentConstants";
13
13
  const usePaymentActions = () => {
14
14
  const toggleNotification = useNotification();
15
15
 
16
+ <<<<<<< HEAD
17
+ // Load settings to get enable3DSecure value
18
+ =======
19
+ >>>>>>> feature/apple-pay
16
20
  const [settings, setSettings] = useState({ enable3DSecure: false });
17
21
 
18
22
  useEffect(() => {
@@ -23,14 +27,28 @@ const usePaymentActions = () => {
23
27
  setSettings(response.data);
24
28
  }
25
29
  } catch (error) {
30
+ <<<<<<< HEAD
31
+ // Silent fail
32
+ =======
33
+ >>>>>>> feature/apple-pay
26
34
  }
27
35
  };
28
36
  loadSettings();
29
37
  }, []);
30
38
 
39
+ <<<<<<< HEAD
40
+ // Payment form state
31
41
  const [paymentAmount, setPaymentAmount] = useState("1000");
32
42
 
43
+ // Generate order reference using generateLagOrderNumber
44
+ // Sequence number starts from 1000 and increments based on timestamp
33
45
  const generateOrderReference = () => {
46
+ // Use timestamp to generate unique sequence (1000 to 99999 range)
47
+ =======
48
+ const [paymentAmount, setPaymentAmount] = useState("1000");
49
+
50
+ const generateOrderReference = () => {
51
+ >>>>>>> feature/apple-pay
34
52
  const sequence = 1000 + Math.floor((Date.now() % 99000));
35
53
  return generateLagOrderNumber(sequence);
36
54
  };
@@ -46,11 +64,19 @@ const usePaymentActions = () => {
46
64
  const [googlePayToken, setGooglePayToken] = useState(null);
47
65
  const [applePayToken, setApplePayToken] = useState(null);
48
66
 
67
+ <<<<<<< HEAD
68
+ // Card details for 3DS testing
69
+ =======
70
+ >>>>>>> feature/apple-pay
49
71
  const [cardtype, setCardtype] = useState("");
50
72
  const [cardpan, setCardpan] = useState("");
51
73
  const [cardexpiredate, setCardexpiredate] = useState("");
52
74
  const [cardcvc2, setCardcvc2] = useState("");
53
75
 
76
+ <<<<<<< HEAD
77
+ // Payment processing state
78
+ =======
79
+ >>>>>>> feature/apple-pay
54
80
  const [isProcessingPayment, setIsProcessingPayment] = useState(false);
55
81
  const [paymentResult, setPaymentResult] = useState(null);
56
82
  const [paymentError, setPaymentError] = useState(null);
@@ -80,16 +106,29 @@ const usePaymentActions = () => {
80
106
  paymentMethod,
81
107
  amount: paymentAmount
82
108
  });
109
+ <<<<<<< HEAD
110
+
111
+ =======
83
112
 
113
+ >>>>>>> feature/apple-pay
84
114
  setIsProcessingPayment(true);
85
115
  setPaymentError(null);
86
116
  setPaymentResult(null);
87
117
  try {
118
+ <<<<<<< HEAD
119
+ // Auto-generate reference if empty
120
+ =======
121
+ >>>>>>> feature/apple-pay
88
122
  const finalPreauthReference = preauthReference.trim() || generateOrderReference();
89
123
  if (!preauthReference.trim()) {
90
124
  setPreauthReference(finalPreauthReference);
91
125
  }
92
126
 
127
+ <<<<<<< HEAD
128
+ // Determine currency based on card type
129
+ // American Express typically requires USD, other cards use EUR
130
+ =======
131
+ >>>>>>> feature/apple-pay
93
132
  const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
94
133
 
95
134
  const baseParams = {
@@ -100,6 +139,10 @@ const usePaymentActions = () => {
100
139
  ...DEFAULT_PAYMENT_DATA
101
140
  };
102
141
 
142
+ <<<<<<< HEAD
143
+ // Add card details if credit card payment and 3DS enabled
144
+ =======
145
+ >>>>>>> feature/apple-pay
103
146
  if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
104
147
  if (cardtype) baseParams.cardtype = cardtype;
105
148
  if (cardpan) baseParams.cardpan = cardpan;
@@ -113,6 +156,10 @@ const usePaymentActions = () => {
113
156
 
114
157
  if (needsRedirectUrls) {
115
158
  const baseUrl = window.location.origin;
159
+ <<<<<<< HEAD
160
+ // Detect current context (admin or content-ui) from pathname
161
+ =======
162
+ >>>>>>> feature/apple-pay
116
163
  const currentPath = window.location.pathname;
117
164
  const isContentUI = currentPath.includes('/content-ui') || currentPath.includes('/content-manager');
118
165
  const basePath = isContentUI ? '/content-ui' : '/admin';
@@ -136,13 +183,39 @@ const usePaymentActions = () => {
136
183
 
137
184
  const result = await payoneRequests.preauthorization(params);
138
185
  const responseData = result?.data || result;
186
+ <<<<<<< HEAD
187
+
188
+ // Log full response
189
+ console.log("Preauthorization Response:", responseData);
190
+ console.log("Response Status:", responseData.status || responseData.Status);
191
+ console.log("Response Error Code:", responseData.errorcode || responseData.errorCode || responseData.ErrorCode);
192
+ console.log("Response Error Message:", responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage);
193
+ console.log("All redirect URL fields:", {
194
+ redirectUrl: responseData.redirectUrl,
195
+ redirecturl: responseData.redirecturl,
196
+ RedirectUrl: responseData.RedirectUrl,
197
+ redirect_url: responseData.redirect_url,
198
+ url: responseData.url,
199
+ Url: responseData.Url
200
+ });
201
+
202
+ =======
203
+ >>>>>>> feature/apple-pay
139
204
  const status = (responseData.status || responseData.Status || "").toUpperCase();
140
205
  const errorCode = responseData.errorcode || responseData.errorCode || responseData.ErrorCode;
141
206
  const errorMessage = responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage;
142
207
 
208
+ <<<<<<< HEAD
209
+ // Check for 3DS required error (4219)
143
210
  const requires3DSErrorCodes = ["4219", 4219];
144
211
  const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
145
212
 
213
+ // Check all possible redirect URL fields
214
+ =======
215
+ const requires3DSErrorCodes = ["4219", 4219];
216
+ const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
217
+
218
+ >>>>>>> feature/apple-pay
146
219
  const redirectUrl =
147
220
  responseData.redirectUrl ||
148
221
  responseData.redirecturl ||
@@ -152,6 +225,10 @@ const usePaymentActions = () => {
152
225
  responseData.Url ||
153
226
  null;
154
227
 
228
+ <<<<<<< HEAD
229
+ // If 3DS required but no redirect URL, show helpful message
230
+ =======
231
+ >>>>>>> feature/apple-pay
155
232
  if (is3DSRequiredError && !redirectUrl) {
156
233
  console.warn("3DS authentication required (Error 4219) but no redirect URL found in response");
157
234
  console.log("Full response:", JSON.stringify(responseData, null, 2));
@@ -163,6 +240,10 @@ const usePaymentActions = () => {
163
240
  return;
164
241
  }
165
242
 
243
+ <<<<<<< HEAD
244
+ // Check for other errors (but not 3DS required)
245
+ =======
246
+ >>>>>>> feature/apple-pay
166
247
  if ((status === "ERROR" || status === "INVALID" || errorCode) && !is3DSRequiredError) {
167
248
  setPaymentError(
168
249
  errorMessage ||
@@ -185,8 +266,21 @@ const usePaymentActions = () => {
185
266
 
186
267
  setPaymentResult(responseData);
187
268
 
269
+ <<<<<<< HEAD
270
+ console.log("[Payment] Preauthorization result:", {
271
+ status,
272
+ hasError: !!errorCode,
273
+ errorCode,
274
+ errorMessage
275
+ });
276
+
188
277
  if (status === "APPROVED") {
189
278
  handlePaymentSuccess("Preauthorization completed successfully");
279
+ // Return success result for Apple Pay callback
280
+ =======
281
+ if (status === "APPROVED") {
282
+ handlePaymentSuccess("Preauthorization completed successfully");
283
+ >>>>>>> feature/apple-pay
190
284
  return { success: true, data: responseData };
191
285
  } else {
192
286
  const errorMsg = errorMessage || `Unexpected status: ${status}`;
@@ -194,11 +288,19 @@ const usePaymentActions = () => {
194
288
  { message: errorMsg },
195
289
  `Preauthorization completed with status: ${status}`
196
290
  );
291
+ <<<<<<< HEAD
292
+ // Return error result for Apple Pay callback
293
+ =======
294
+ >>>>>>> feature/apple-pay
197
295
  throw new Error(errorMsg);
198
296
  }
199
297
  } catch (error) {
200
298
  console.error("[Payment] Preauthorization error:", error);
201
299
  handlePaymentError(error, "Preauthorization failed");
300
+ <<<<<<< HEAD
301
+ // Re-throw error so Apple Pay callback knows it failed
302
+ =======
303
+ >>>>>>> feature/apple-pay
202
304
  throw error;
203
305
  } finally {
204
306
  setIsProcessingPayment(false);
@@ -211,11 +313,20 @@ const usePaymentActions = () => {
211
313
  setPaymentResult(null);
212
314
 
213
315
  try {
316
+ <<<<<<< HEAD
317
+ // Auto-generate reference if empty
318
+ =======
319
+ >>>>>>> feature/apple-pay
214
320
  const finalAuthReference = authReference.trim() || generateOrderReference();
215
321
  if (!authReference.trim()) {
216
322
  setAuthReference(finalAuthReference);
217
323
  }
218
324
 
325
+ <<<<<<< HEAD
326
+ // Determine currency based on card type
327
+ // American Express typically requires USD, other cards use EUR
328
+ =======
329
+ >>>>>>> feature/apple-pay
219
330
  const currency = (paymentMethod === "cc" && cardtype === "A") ? "USD" : "EUR";
220
331
 
221
332
  const baseParams = {
@@ -226,6 +337,10 @@ const usePaymentActions = () => {
226
337
  ...DEFAULT_PAYMENT_DATA
227
338
  };
228
339
 
340
+ <<<<<<< HEAD
341
+ // Add card details if credit card payment and 3DS enabled
342
+ =======
343
+ >>>>>>> feature/apple-pay
229
344
  if (paymentMethod === "cc" && settings.enable3DSecure !== false) {
230
345
  if (cardtype) baseParams.cardtype = cardtype;
231
346
  if (cardpan) baseParams.cardpan = cardpan;
@@ -239,6 +354,10 @@ const usePaymentActions = () => {
239
354
 
240
355
  if (needsRedirectUrls) {
241
356
  const baseUrl = window.location.origin;
357
+ <<<<<<< HEAD
358
+ // Detect current context (admin or content-ui) from pathname
359
+ =======
360
+ >>>>>>> feature/apple-pay
242
361
  const currentPath = window.location.pathname;
243
362
  const isContentUI = currentPath.includes('/content-ui') || currentPath.includes('/content-manager');
244
363
  const basePath = isContentUI ? '/content-ui' : '/admin';
@@ -262,13 +381,39 @@ const usePaymentActions = () => {
262
381
 
263
382
  const result = await payoneRequests.authorization(params);
264
383
  const responseData = result?.data || result;
384
+ <<<<<<< HEAD
385
+
386
+ // Log full response
387
+ console.log("Authorization Response:", responseData);
388
+ console.log("Response Status:", responseData.status || responseData.Status);
389
+ console.log("Response Error Code:", responseData.errorcode || responseData.errorCode || responseData.ErrorCode);
390
+ console.log("Response Error Message:", responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage);
391
+ console.log("All redirect URL fields:", {
392
+ redirectUrl: responseData.redirectUrl,
393
+ redirecturl: responseData.redirecturl,
394
+ RedirectUrl: responseData.RedirectUrl,
395
+ redirect_url: responseData.redirect_url,
396
+ url: responseData.url,
397
+ Url: responseData.Url
398
+ });
399
+
400
+ =======
401
+ >>>>>>> feature/apple-pay
265
402
  const status = (responseData.status || responseData.Status || "").toUpperCase();
266
403
  const errorCode = responseData.errorcode || responseData.errorCode || responseData.ErrorCode;
267
404
  const errorMessage = responseData.errormessage || responseData.errorMessage || responseData.ErrorMessage;
268
405
 
406
+ <<<<<<< HEAD
407
+ // Check for 3DS required error (4219)
269
408
  const requires3DSErrorCodes = ["4219", 4219];
270
409
  const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
271
410
 
411
+ // Check all possible redirect URL fields
412
+ =======
413
+ const requires3DSErrorCodes = ["4219", 4219];
414
+ const is3DSRequiredError = requires3DSErrorCodes.includes(errorCode);
415
+
416
+ >>>>>>> feature/apple-pay
272
417
  const redirectUrl =
273
418
  responseData.redirectUrl ||
274
419
  responseData.redirecturl ||
@@ -278,6 +423,10 @@ const usePaymentActions = () => {
278
423
  responseData.Url ||
279
424
  null;
280
425
 
426
+ <<<<<<< HEAD
427
+ // If 3DS required but no redirect URL, show helpful message
428
+ =======
429
+ >>>>>>> feature/apple-pay
281
430
  if (is3DSRequiredError && !redirectUrl) {
282
431
  console.warn("3DS authentication required (Error 4219) but no redirect URL found in response");
283
432
  console.log("Full response:", JSON.stringify(responseData, null, 2));
@@ -289,6 +438,10 @@ const usePaymentActions = () => {
289
438
  return;
290
439
  }
291
440
 
441
+ <<<<<<< HEAD
442
+ // Check for other errors (but not 3DS required)
443
+ =======
444
+ >>>>>>> feature/apple-pay
292
445
  if ((status === "ERROR" || status === "INVALID" || errorCode) && !is3DSRequiredError) {
293
446
  setPaymentError(
294
447
  errorMessage ||
@@ -311,6 +464,16 @@ const usePaymentActions = () => {
311
464
 
312
465
  setPaymentResult(responseData);
313
466
 
467
+ <<<<<<< HEAD
468
+ console.log("[Payment] Authorization result:", {
469
+ status,
470
+ hasError: !!errorCode,
471
+ errorCode,
472
+ errorMessage
473
+ });
474
+
475
+ =======
476
+ >>>>>>> feature/apple-pay
314
477
  if (status === "APPROVED") {
315
478
  handlePaymentSuccess("Authorization completed successfully");
316
479
  // Return success result for Apple Pay callback
@@ -321,11 +484,19 @@ const usePaymentActions = () => {
321
484
  { message: errorMsg },
322
485
  `Authorization completed with status: ${status}`
323
486
  );
487
+ <<<<<<< HEAD
488
+ // Return error result for Apple Pay callback
489
+ =======
490
+ >>>>>>> feature/apple-pay
324
491
  throw new Error(errorMsg);
325
492
  }
326
493
  } catch (error) {
327
494
  console.error("[Payment] Authorization error:", error);
328
495
  handlePaymentError(error, "Authorization failed");
496
+ <<<<<<< HEAD
497
+ // Re-throw error so Apple Pay callback knows it failed
498
+ =======
499
+ >>>>>>> feature/apple-pay
329
500
  throw error;
330
501
  } finally {
331
502
  setIsProcessingPayment(false);
package/package.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "name": "strapi-plugin-payone-provider",
3
- "version": "1.6.0",
4
- "description": "Strapi plugin for Payone payment gateway integration",
5
- "license": "MIT",
6
- "maintainers": [
7
- {
8
- "name": "NewProWeb Community",
9
- "email": "abror.abdullaev@newproweb.com"
10
- }
11
- ],
12
- "dependencies": {
13
- "axios": "^1.6.3",
14
- "prop-types": "^15.7.2"
15
- },
16
- "devDependencies": {
17
- "react": "^18.2.0",
18
- "react-dom": "^18.2.0",
19
- "react-router-dom": "^5.3.4",
20
- "styled-components": "^5.3.6"
21
- },
22
- "peerDependencies": {
23
- "@strapi/strapi": "^4.0",
24
- "react": "^17.0.0 || ^18.0.0",
25
- "react-dom": "^17.0.0 || ^18.0.0",
26
- "react-router-dom": "^5.2.0",
27
- "styled-components": "^5.2.1"
28
- },
29
- "engines": {
30
- "node": ">=18.0.0",
31
- "npm": ">=6.0.0"
32
- },
33
- "authors": [
34
- {
35
- "name": "NewProWeb <Aliev Davlatbek>",
36
- "email": "mamurjonov.davlatbek@newproweb.com"
37
- },
38
- {
39
- "name": "Akromjon Rahimjonov",
40
- "email": "akromjon.rahimjonov@newproweb.com"
41
- }
42
- ],
43
- "strapi": {
44
- "name": "strapi-plugin-payone-provider",
45
- "description": "Integrates Strapi Payone payment gateway with Strapi",
46
- "kind": "plugin",
47
- "displayName": "Strapi Payone Provider"
48
- }
49
- }
1
+ {
2
+ "name": "strapi-plugin-payone-provider",
3
+ "version": "1.6.1",
4
+ "description": "Strapi plugin for Payone payment gateway integration",
5
+ "license": "MIT",
6
+ "maintainers": [
7
+ {
8
+ "name": "NewProWeb Community",
9
+ "email": "abror.abdullaev@newproweb.com"
10
+ }
11
+ ],
12
+ "dependencies": {
13
+ "axios": "^1.6.3",
14
+ "prop-types": "^15.7.2"
15
+ },
16
+ "devDependencies": {
17
+ "react": "^18.2.0",
18
+ "react-dom": "^18.2.0",
19
+ "react-router-dom": "^5.3.4",
20
+ "styled-components": "^5.3.6"
21
+ },
22
+ "peerDependencies": {
23
+ "@strapi/strapi": "^4.0",
24
+ "react": "^17.0.0 || ^18.0.0",
25
+ "react-dom": "^17.0.0 || ^18.0.0",
26
+ "react-router-dom": "^5.2.0",
27
+ "styled-components": "^5.2.1"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0",
31
+ "npm": ">=6.0.0"
32
+ },
33
+ "authors": [
34
+ {
35
+ "name": "NewProWeb <Aliev Davlatbek>",
36
+ "email": "mamurjonov.davlatbek@newproweb.com"
37
+ },
38
+ {
39
+ "name": "Akromjon Rahimjonov",
40
+ "email": "akromjon.rahimjonov@newproweb.com"
41
+ }
42
+ ],
43
+ "strapi": {
44
+ "name": "strapi-plugin-payone-provider",
45
+ "description": "Integrates Strapi Payone payment gateway with Strapi",
46
+ "kind": "plugin",
47
+ "displayName": "Strapi Payone Provider"
48
+ }
49
+ }
@@ -53,8 +53,11 @@ module.exports = async ({ strapi }) => {
53
53
  try {
54
54
  const Router = require('@koa/router');
55
55
  const router = new Router();
56
+ <<<<<<< HEAD
57
+ =======
56
58
  const fs = require('fs');
57
59
  const path = require('path');
60
+ >>>>>>> feature/apple-pay
58
61
 
59
62
  routes.forEach(route => {
60
63
  router.get(route, async (ctx) => {
@@ -63,6 +66,9 @@ module.exports = async ({ strapi }) => {
63
66
  });
64
67
  });
65
68
 
69
+ <<<<<<< HEAD
70
+ // Add router to the server app
71
+ =======
66
72
  // Register route for Apple Pay .well-known file
67
73
  router.get('/.well-known/apple-developer-merchantid-domain-association', async (ctx) => {
68
74
  try {
@@ -120,6 +126,7 @@ module.exports = async ({ strapi }) => {
120
126
  }
121
127
  });
122
128
 
129
+ >>>>>>> feature/apple-pay
123
130
  if (strapi.server.app && typeof strapi.server.app.use === 'function') {
124
131
  strapi.server.app.use(router.routes());
125
132
  strapi.server.app.use(router.allowedMethods());
@@ -6,13 +6,11 @@ const getPayoneService = (strapi) => {
6
6
  return strapi.plugin(PLUGIN_NAME).service("payone");
7
7
  };
8
8
 
9
-
10
9
  const handleError = (ctx, error) => {
11
10
  ctx.strapi.log.error("Payone controller error:", error);
12
11
  ctx.throw(500, error);
13
12
  };
14
13
 
15
-
16
14
  const hideKey = (settings) => {
17
15
  if (settings && settings.key) {
18
16
  settings.key = "***HIDDEN***";
@@ -1,7 +1,18 @@
1
1
  "use strict";
2
2
 
3
+ <<<<<<< HEAD
4
+ const { getPluginStore, PLUGIN_NAME } = require("./settingsService");
5
+
6
+ /**
7
+ * Log transaction to history
8
+ * @param {Object} strapi - Strapi instance
9
+ * @param {Object} transactionData - Transaction data
10
+ * @returns {Promise<void>}
11
+ */
12
+ =======
3
13
  const { getPluginStore } = require("./settingsService");
4
14
 
15
+ >>>>>>> feature/apple-pay
5
16
  const logTransaction = async (strapi, transactionData) => {
6
17
  const pluginStore = getPluginStore(strapi);
7
18
  let transactionHistory =
@@ -35,6 +46,10 @@ const logTransaction = async (strapi, transactionData) => {
35
46
 
36
47
  transactionHistory.unshift(logEntry);
37
48
 
49
+ <<<<<<< HEAD
50
+ // Keep only last 1000 transactions
51
+ =======
52
+ >>>>>>> feature/apple-pay
38
53
  if (transactionHistory.length > 1000) {
39
54
  transactionHistory = transactionHistory.slice(0, 1000);
40
55
  }
@@ -47,11 +62,24 @@ const logTransaction = async (strapi, transactionData) => {
47
62
  strapi.log.info("Transaction logged:", logEntry);
48
63
  };
49
64
 
65
+ <<<<<<< HEAD
66
+ /**
67
+ * Get transaction history with filters
68
+ * @param {Object} strapi - Strapi instance
69
+ * @param {Object} filters - Filter options
70
+ * @returns {Promise<Array>} Filtered transaction history
71
+ */
72
+ =======
73
+ >>>>>>> feature/apple-pay
50
74
  const getTransactionHistory = async (strapi, filters = {}) => {
51
75
  const pluginStore = getPluginStore(strapi);
52
76
  let transactionHistory =
53
77
  (await pluginStore.get({ key: "transactionHistory" })) || [];
54
78
 
79
+ <<<<<<< HEAD
80
+ // Apply filters
81
+ =======
82
+ >>>>>>> feature/apple-pay
55
83
  if (filters.status) {
56
84
  transactionHistory = transactionHistory.filter(
57
85
  (transaction) => transaction.status === filters.status
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
 
3
- /**
4
- * Add payment method specific parameters
5
- * @param {Object} params - Request parameters
6
- * @param {Object} logger - Logger instance
7
- * @returns {Object} Updated parameters with payment method defaults
8
- */
3
+
9
4
  const addPaymentMethodParams = (params, logger) => {
10
5
  const updated = { ...params };
11
6
  const clearingtype = updated.clearingtype || "cc";
@@ -152,7 +147,6 @@ const addPaymentMethodParams = (params, logger) => {
152
147
  updated.wallettype = "PPE";
153
148
  }
154
149
  }
155
-
156
150
  if (updated.clearingtype === "wlt" && updated.cardtype) {
157
151
  delete updated.cardtype;
158
152
  }