strapi-plugin-payone-provider 4.6.17 → 4.6.19

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-payone-provider",
3
- "version": "4.6.17",
3
+ "version": "4.6.19",
4
4
  "description": "Strapi plugin for Payone payment gateway integration",
5
5
  "license": "MIT",
6
6
  "maintainers": [
@@ -6,7 +6,7 @@ const { sanitizeSensitive } = require("../utils/sanitize");
6
6
  const TRANSACTION_UID = "plugin::strapi-plugin-payone-provider.transaction";
7
7
 
8
8
  const genreateUpdateData = (notificationData, existing, safeNotification) => {
9
- const amount = String(notificationData.clearing_amount) || String(Math.round(parseFloat(notificationData.price) * 100)) || existing.amount;
9
+ const amount = existing.amount;
10
10
  const raw_request = {
11
11
  ...existing.raw_request,
12
12
  ...notificationData,
@@ -16,13 +16,13 @@ const genreateUpdateData = (notificationData, existing, safeNotification) => {
16
16
  }
17
17
 
18
18
  return {
19
- status: notificationData.transaction_status || existing.status,
19
+ status: notificationData.transaction_status || existing.status || notificationData.txaction,
20
20
  currency: notificationData.currency || existing.currency,
21
21
  reference: notificationData.reference || existing.reference,
22
22
  amount,
23
23
  body: {
24
24
  ...existing.body,
25
- status: notificationData.transaction_status,
25
+ status: notificationData.transaction_status || notificationData.txaction,
26
26
  amount,
27
27
  raw_request: sanitizeSensitive(raw_request),
28
28
  payone_notification_data: safeNotification,
@@ -32,7 +32,7 @@ const genreateUpdateData = (notificationData, existing, safeNotification) => {
32
32
 
33
33
  const validateData = (notificationData, settings) => {
34
34
  const isExist = (settings.portalid && settings.aid && settings.key) && (notificationData.portalid && notificationData.aid && notificationData.key);
35
- const isMatch = notificationData.portalid === settings.portalid && notificationData.aid === settings.aid && notificationData.key === settings.key;
35
+ const isMatch = String(notificationData.portalid) == String(settings.portalid) && String(notificationData.aid) == String(settings.aid) && String(notificationData.key) == String(settings.key);
36
36
 
37
37
  if (!isExist) {
38
38
  console.log("[Payone TransactionStatus] Settings not found or payone data missing");
@@ -60,6 +60,7 @@ const processTransactionStatus = async (strapi, notificationData) => {
60
60
 
61
61
  if (!existing) {
62
62
  console.log(`[Payone TransactionStatus] Transaction ${txid} not found. Notification ignored.`);
63
+ return;
63
64
  }
64
65
 
65
66
  const safeNotification = sanitizeSensitive({ ...notificationData });
@@ -9,7 +9,7 @@ const buildClientRequestParams = (settings, params, logger = null) => {
9
9
  aid: settings.aid,
10
10
  mid: settings.mid,
11
11
  portalid: settings.portalid,
12
- mode: settings.mode || "test",
12
+ mode: params.testOrder ? "test" : settings.mode || "test",
13
13
  encoding: "UTF-8",
14
14
  ...params
15
15
  };