strapi-plugin-payone-provider 4.6.14 → 4.6.16
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.
|
|
3
|
+
"version": "4.6.16",
|
|
4
4
|
"description": "Strapi plugin for Payone payment gateway integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"maintainers": [
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@uiw/react-json-view": "^2.0.0-alpha.40",
|
|
13
14
|
"apple-pay-button": "^1.2.1",
|
|
14
15
|
"axios": "^1.6.3",
|
|
15
|
-
"prop-types": "^15.7.2"
|
|
16
|
-
"@uiw/react-json-view": "^2.0.0-alpha.40"
|
|
16
|
+
"prop-types": "^15.7.2"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"react": "^18.2.0",
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"kind": "plugin",
|
|
49
49
|
"displayName": "Strapi Payone Provider"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|
|
@@ -258,20 +258,17 @@ module.exports = ({ strapi }) => ({
|
|
|
258
258
|
|
|
259
259
|
async handleTransactionStatus(ctx) {
|
|
260
260
|
try {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
261
|
+
const notificationData = ctx.request.body || {};
|
|
262
|
+
await getPayoneService(strapi).processTransactionStatus(notificationData);
|
|
263
|
+
console.warn("[Payone] Notification Status", {
|
|
264
|
+
ip: ctx.request.ip,
|
|
265
|
+
});
|
|
267
266
|
} catch (error) {
|
|
268
|
-
|
|
267
|
+
strapi.log.error("[Payone TransactionStatus] Error:", error);
|
|
269
268
|
}
|
|
270
269
|
|
|
271
270
|
ctx.status = 200;
|
|
272
271
|
ctx.body = "TSOK";
|
|
273
272
|
ctx.type = "text/plain";
|
|
274
273
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
274
|
});
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
module.exports = async (ctx) => {
|
|
2
|
-
const
|
|
2
|
+
const userAgent = ctx.request.headers["user-agent"] || "";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// Forwarded header parsing
|
|
5
|
+
const rawForwarded = ctx.request.headers["x-forwarded-for"];
|
|
6
|
+
const forwardedIp = rawForwarded?.split(",")[0]?.trim();
|
|
7
|
+
const xRealIp = ctx.request.headers["x-real-ip"]?.trim();
|
|
8
|
+
// Custom nginx header
|
|
9
|
+
const payoneHeaderIp = ctx.request.headers["x-payone-client-ip"]?.trim();
|
|
10
|
+
|
|
11
|
+
// Final client IP resolution priority
|
|
5
12
|
const clientIp =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
payoneHeaderIp ||
|
|
14
|
+
forwardedIp ||
|
|
15
|
+
xRealIp ||
|
|
16
|
+
ctx.request.ip ||
|
|
9
17
|
"";
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
// ===== Allowed IPs =====
|
|
20
|
+
const allowedExactIps = [
|
|
21
|
+
"54.246.203.105",
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const allowedIpRanges = [
|
|
25
|
+
/^185\.60\.20\.\d+$/, // 185.60.20.0 - 185.60.20.255
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const isIpAllowed =
|
|
29
|
+
allowedExactIps.includes(clientIp) ||
|
|
30
|
+
allowedIpRanges.some((regex) => regex.test(clientIp));
|
|
31
|
+
|
|
32
|
+
const isUserAgentValid = userAgent === "PAYONE FinanceGate";
|
|
33
|
+
|
|
34
|
+
const isValid = isIpAllowed && isUserAgentValid;
|
|
12
35
|
|
|
13
36
|
ctx.state.payoneAllowed = isValid;
|
|
14
37
|
|
|
15
38
|
if (!isValid) {
|
|
16
|
-
console.
|
|
39
|
+
console.warn("[Payone] Policy failed", {
|
|
40
|
+
userAgent,
|
|
41
|
+
clientIp,
|
|
42
|
+
});
|
|
17
43
|
}
|
|
18
44
|
|
|
19
45
|
return true;
|
|
20
|
-
};
|
|
46
|
+
};
|
package/server/routes/index.js
CHANGED
|
@@ -168,7 +168,7 @@ module.exports = {
|
|
|
168
168
|
path: "/transaction-status",
|
|
169
169
|
handler: "payone.handleTransactionStatus",
|
|
170
170
|
config: {
|
|
171
|
-
policies: ["plugin::strapi-plugin-payone-provider.is-payone-notification"],
|
|
171
|
+
// policies: ["plugin::strapi-plugin-payone-provider.is-payone-notification"],
|
|
172
172
|
auth: false
|
|
173
173
|
}
|
|
174
174
|
},
|