@opengis/pay 1.1.10 → 1.1.12
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": "@opengis/pay",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "pay plugins for billing",
|
|
6
6
|
"main": "plugin.js",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@opengis/admin": "^0.2.14",
|
|
24
|
-
"@opengis/fastify-auth": "^1.0.53",
|
|
25
24
|
"@opengis/fastify-table": "^1.1.96",
|
|
26
25
|
"cross-env": "^7.0.3",
|
|
27
26
|
"fastify": "^4.26.1",
|
|
@@ -29,6 +28,8 @@
|
|
|
29
28
|
"request-promise": "^4.2.6"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
31
|
+
"@opengis/fastify-auth": "^1.0.57",
|
|
32
|
+
"@panzoom/panzoom": "^4.5.1",
|
|
32
33
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
33
34
|
"@vue/eslint-config-typescript": "^12.0.0",
|
|
34
35
|
"eslint": "^8.49.0",
|
|
@@ -43,9 +44,8 @@
|
|
|
43
44
|
"vitepress-plugin-mermaid": "^2.0.16",
|
|
44
45
|
"vitepress-plugin-tabs": "^0.5.0",
|
|
45
46
|
"vitepress-sidebar": "^1.22.0",
|
|
46
|
-
"vue": "^3.4.21"
|
|
47
|
-
"@panzoom/panzoom": "^4.5.1"
|
|
47
|
+
"vue": "^3.4.21"
|
|
48
48
|
},
|
|
49
49
|
"author": "Softpro",
|
|
50
50
|
"license": "ISC"
|
|
51
|
-
}
|
|
51
|
+
}
|
package/plugin.js
CHANGED
|
@@ -26,7 +26,7 @@ export default async function PortmoneRedirect(req, reply) {
|
|
|
26
26
|
} = req;
|
|
27
27
|
|
|
28
28
|
const { host, payeeId } = config.integrations?.pay || {};
|
|
29
|
-
const domain =
|
|
29
|
+
const domain = req.hostname.split(':').shift();
|
|
30
30
|
|
|
31
31
|
if (!host) {
|
|
32
32
|
return { message: 'empty integration host', status: 400 };
|
|
@@ -56,11 +56,11 @@ export default async function PortmoneRedirect(req, reply) {
|
|
|
56
56
|
return { message: 'account_id is required', status: 400 };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if ((!headers?.referer || !headers.referer.includes(domain))
|
|
59
|
+
if ((!headers?.referer || !headers.referer.includes(domain))) {
|
|
60
60
|
logger.file('payments/warn', {
|
|
61
61
|
message: 'invalid referer', domain, referer: headers?.referer, uid: user?.uid,
|
|
62
62
|
});
|
|
63
|
-
return { message: 'access restricted', status: 403 };
|
|
63
|
+
if (!config.auth?.disableRestricted) return { message: 'access restricted: referer', status: 403 };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const { payment_id: paymentId } = data.payment_id
|
|
@@ -88,13 +88,15 @@ export default async function PortmoneRedirect(req, reply) {
|
|
|
88
88
|
return { message: 'payment not found', status: 404 };
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const protocol = headers?.referer.split('://').shift();
|
|
92
|
+
|
|
91
93
|
const formData = {
|
|
92
94
|
payee_id: payeeId,
|
|
93
95
|
description: `Послуга - поповнення рахунку на суму ${paymentAmount} грн`,
|
|
94
96
|
shop_order_number: paymentId,
|
|
95
97
|
bill_amount: paymentAmount,
|
|
96
|
-
success_url: `${domain}${config?.prefix || '/api'}/portmone/${paymentId}/success`,
|
|
97
|
-
failure_url: `${domain}${config?.prefix || '/api'}/portmone/${paymentId}/error`,
|
|
98
|
+
success_url: `${protocol || 'https'}://${domain}${config?.prefix || '/api'}/portmone/${paymentId}/success`,
|
|
99
|
+
failure_url: `${protocol || 'https'}://${domain}${config?.prefix || '/api'}/portmone/${paymentId}/error`,
|
|
98
100
|
lang: 'ua',
|
|
99
101
|
};
|
|
100
102
|
|
|
@@ -65,7 +65,7 @@ export default async function portmoneStatus(req, reply) {
|
|
|
65
65
|
const refill = body?.billAmount || refillSum || 0;
|
|
66
66
|
|
|
67
67
|
// request portmone trx info to recheck request data is valid?
|
|
68
|
-
if (!
|
|
68
|
+
if (!origin?.startsWith(host)) {
|
|
69
69
|
logger.file('payments/warn', {
|
|
70
70
|
type: 'status',
|
|
71
71
|
paymentId,
|
|
@@ -74,7 +74,7 @@ export default async function portmoneStatus(req, reply) {
|
|
|
74
74
|
refill,
|
|
75
75
|
message: 'invalid referer',
|
|
76
76
|
});
|
|
77
|
-
return { message: 'access restricted', status: 403 };
|
|
77
|
+
if (!config.auth?.disableRestricted) return { message: 'access restricted: host', status: 403 };
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
logger.file('payments', {
|