@opengis/pay 1.3.0 → 1.3.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengis/pay",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "pay plugins for billing",
|
|
6
6
|
"main": "plugin.js",
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"fastify": "5.3.3",
|
|
23
|
-
"fastify-plugin": "5.0.1",
|
|
24
22
|
"ioredis": "5.3.2",
|
|
25
23
|
"liqpayjs-sdk": "3.3.1",
|
|
26
24
|
"nodemailer": "6.5.0",
|
|
@@ -28,6 +26,8 @@
|
|
|
28
26
|
"request-promise": "4.2.6"
|
|
29
27
|
},
|
|
30
28
|
"devDependencies": {
|
|
29
|
+
"fastify": "5.3.3",
|
|
30
|
+
"fastify-plugin": "5.0.1",
|
|
31
31
|
"eslint": "8.49.0",
|
|
32
32
|
"eslint-config-airbnb": "19.0.4"
|
|
33
33
|
},
|
package/plugin.js
CHANGED
|
@@ -16,7 +16,7 @@ const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
16
16
|
async function plugin(app, config = {}) {
|
|
17
17
|
config.prefix = config.prefix || '/api';
|
|
18
18
|
|
|
19
|
-
const pg = await getPGAsync(config.pg
|
|
19
|
+
const pg = await getPGAsync(config.pg ? { ...config.pg, name: 'client' } : {});
|
|
20
20
|
|
|
21
21
|
app.register(import('./server/plugins/hook.js'), config);
|
|
22
22
|
app.register(import('./server/routes/portmone/index.mjs'), config);
|
|
@@ -10,7 +10,7 @@ import init from './init.js';
|
|
|
10
10
|
import getDBParams from './getDBParams.js';
|
|
11
11
|
|
|
12
12
|
function getPG(param) {
|
|
13
|
-
if (!config.pg) return null;
|
|
13
|
+
if (!config.pg && !param?.database && !pgClients[param.name || 'client']) return null; // env support?
|
|
14
14
|
const {
|
|
15
15
|
user, password, host, port, db, database, name: origin,
|
|
16
16
|
} = (typeof param === 'string' ? getDBParams(param) : param || {});
|
|
@@ -10,7 +10,7 @@ import init from './init.js';
|
|
|
10
10
|
import getDBParams from './getDBParams.js';
|
|
11
11
|
|
|
12
12
|
async function getPGAsync(param) {
|
|
13
|
-
if (!config.pg) return null;
|
|
13
|
+
if (!config.pg && !param?.database && !pgClients[param.name || 'client']) return null;
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
user, password, host, port, db, database, name: origin,
|
|
@@ -12,7 +12,7 @@ import sendNotification from '../../../utils/sendNotification.js';
|
|
|
12
12
|
import checkStatus from '../utils/check.status.js';
|
|
13
13
|
|
|
14
14
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
-
const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'));
|
|
15
|
+
const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'), { encoding: 'utf8' });
|
|
16
16
|
|
|
17
17
|
const newDate = () => {
|
|
18
18
|
const date = new Date();
|
|
@@ -176,7 +176,7 @@ export default async function liqpayStatus(req, reply) {
|
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
if (to) {
|
|
179
|
-
const pt = ptBody
|
|
179
|
+
const pt = (ptBody || 'empty template')
|
|
180
180
|
.replace(/{{domain}}/g, req.hostname)
|
|
181
181
|
.replace(/{{total_balance}}/g, +(refillSum || 0) + (+totalBalance || 0))
|
|
182
182
|
.replace(/{{username}}/g, to)
|
|
@@ -10,7 +10,7 @@ import dataUpdate from '../../../plugins/crud/dataUpdate.js';
|
|
|
10
10
|
|
|
11
11
|
import sendNotification from '../../../utils/sendNotification.js';
|
|
12
12
|
|
|
13
|
-
const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'));
|
|
13
|
+
const ptBody = readFileSync(path.join(dirname, '../../../../module/pay/pt/marketplace-service-payment-client-template.html'), { encoding: 'utf8' });
|
|
14
14
|
|
|
15
15
|
const newDate = () => {
|
|
16
16
|
const date = new Date();
|
|
@@ -146,7 +146,7 @@ export default async function portmoneStatus(req, reply) {
|
|
|
146
146
|
);
|
|
147
147
|
|
|
148
148
|
if (to) {
|
|
149
|
-
const pt = ptBody
|
|
149
|
+
const pt = (ptBody || 'empty template')
|
|
150
150
|
.replace(/{{domain}}/g, req.hostname)
|
|
151
151
|
.replace(/{{total_balance}}/g, +(refillSum || 0) + (+totalBalance || 0))
|
|
152
152
|
.replace(/{{username}}/g, to)
|