@opengis/pay 2.0.8 → 2.0.9
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 +1 -1
- package/server/plugins/payment/createTransaction.js +5 -0
- package/server/plugins/payment/liqpay.createTransaction.js +13 -0
- package/server/routes/core/index.mjs +11 -9
- package/server/routes/liqpay/index.mjs +33 -26
- package/server/routes/monopay/index.mjs +20 -15
- package/server/routes/portmone/index.mjs +33 -25
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ const controller = {
|
|
|
14
14
|
|
|
15
15
|
export default async function createTransaction({
|
|
16
16
|
orderId, amount, referer, uid, debug, service, expiredDate, description, action, language, paytypes, currency, deliveryEmails, optionalParams,
|
|
17
|
+
splitRules, splitTicketsDynamicRequisites, splitTicketsOnly,
|
|
17
18
|
}, pg = pgClients.client) {
|
|
18
19
|
if (!service) throw new Error('not enough params: service');
|
|
19
20
|
if (!controller[service]) { throw new Error('invalid params: service'); }
|
|
@@ -38,8 +39,12 @@ export default async function createTransaction({
|
|
|
38
39
|
description,
|
|
39
40
|
language,
|
|
40
41
|
paytypes,
|
|
42
|
+
currency,
|
|
41
43
|
deliveryEmails,
|
|
42
44
|
optionalParams,
|
|
45
|
+
splitRules,
|
|
46
|
+
splitTicketsDynamicRequisites,
|
|
47
|
+
splitTicketsOnly,
|
|
43
48
|
}, pg);
|
|
44
49
|
return result;
|
|
45
50
|
}
|
|
@@ -19,6 +19,7 @@ const liqpay = new LiqPay(publicKey, privateKey);
|
|
|
19
19
|
|
|
20
20
|
export default async function liqpayCreateTransaction({
|
|
21
21
|
id, orderId, amount, referer, uid, debug, expiredDate, description, paytypes, action = 'pay', currency = 'uah', language = 'uk', deliveryEmails, optionalParams,
|
|
22
|
+
splitRules, splitTicketsDynamicRequisites, splitTicketsOnly,
|
|
22
23
|
}, pg = pgClients.client) {
|
|
23
24
|
if (!referer) {
|
|
24
25
|
throw new Error('not enough params: referer required');
|
|
@@ -102,6 +103,18 @@ export default async function liqpayCreateTransaction({
|
|
|
102
103
|
} : undefined,
|
|
103
104
|
};
|
|
104
105
|
|
|
106
|
+
if (splitTicketsDynamicRequisites) {
|
|
107
|
+
paymentOptions.split_tickets_dynamic_requisites = true;
|
|
108
|
+
}
|
|
109
|
+
if (splitTicketsOnly) {
|
|
110
|
+
paymentOptions.split_tickets_only = true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// regular split rules are optional[], refer to LiqPay documentation
|
|
114
|
+
if (Array.isArray(splitRules) && splitRules.length) {
|
|
115
|
+
paymentOptions.split_rules = splitRules;
|
|
116
|
+
}
|
|
117
|
+
|
|
105
118
|
// html interface for debug via browser only
|
|
106
119
|
if (process.env.NODE_ENV !== 'test' && debug) {
|
|
107
120
|
return liqpay.cnb_form(paymentOptions);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import paymentInfo from './controllers/payment.info.js';
|
|
2
2
|
|
|
3
|
-
export default
|
|
4
|
-
app.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export default function plugin(app, { prefix = '/api' } = {}) {
|
|
4
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/payment-info/:id` })) {
|
|
5
|
+
app.route({
|
|
6
|
+
method: 'GET',
|
|
7
|
+
url: '/payment-info/:id',
|
|
8
|
+
config: {
|
|
9
|
+
policy: 'L1',
|
|
10
|
+
},
|
|
11
|
+
handler: paymentInfo,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
12
14
|
}
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import liqpayRedirect from './controllers/liqpay.redirect.js';
|
|
2
2
|
import liqpayStatus from './controllers/liqpay.status.js';
|
|
3
3
|
|
|
4
|
-
export default
|
|
5
|
-
app.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
export default function plugin(app, { prefix = '/api' } = {}) {
|
|
5
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/liqpay-redirect` })) {
|
|
6
|
+
app.route({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
url: '/liqpay-redirect',
|
|
9
|
+
config: {
|
|
10
|
+
policy: 'L1',
|
|
11
|
+
},
|
|
12
|
+
handler: liqpayRedirect,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!app.hasRoute({ method: 'POST', url: `${prefix}/liqpay/:id/:status` })) {
|
|
17
|
+
app.route({
|
|
18
|
+
method: 'POST',
|
|
19
|
+
url: '/liqpay/:id/:status',
|
|
20
|
+
config: {
|
|
21
|
+
policy: 'L0',
|
|
22
|
+
},
|
|
23
|
+
handler: liqpayStatus,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/liqpay/:id/:status` })) {
|
|
28
|
+
app.route({
|
|
29
|
+
method: 'GET',
|
|
30
|
+
url: '/liqpay/:id/:status',
|
|
31
|
+
config: {
|
|
32
|
+
policy: 'L0',
|
|
33
|
+
},
|
|
34
|
+
handler: liqpayStatus,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
30
37
|
}
|
|
@@ -14,19 +14,24 @@ const schema = {
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export default
|
|
18
|
-
app.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
export default function plugin(app, { prefix = '/api' } = {}) {
|
|
18
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/monopay-redirect` })) {
|
|
19
|
+
app.route({
|
|
20
|
+
method: 'GET',
|
|
21
|
+
url: '/monopay-redirect',
|
|
22
|
+
config: { policy: 'L1' },
|
|
23
|
+
schema,
|
|
24
|
+
handler: monopayRedirect,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/monopay/:id/:status` })) {
|
|
29
|
+
app.route({
|
|
30
|
+
method: 'GET',
|
|
31
|
+
url: '/monopay/:id/:status',
|
|
32
|
+
config: { policy: 'L0' },
|
|
33
|
+
schema,
|
|
34
|
+
handler: monopayStatus,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
32
37
|
}
|
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import portmoneRedirect from './controllers/portmone.redirect.js';
|
|
2
2
|
import portmoneStatus from './controllers/portmone.status.js';
|
|
3
3
|
|
|
4
|
-
export default
|
|
5
|
-
app.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
4
|
+
export default function plugin(app, { prefix = '/api' } = {}) {
|
|
5
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/portmone-redirect` })) {
|
|
6
|
+
app.route({
|
|
7
|
+
method: 'GET',
|
|
8
|
+
url: '/portmone-redirect',
|
|
9
|
+
config: {
|
|
10
|
+
policy: 'L1',
|
|
11
|
+
},
|
|
12
|
+
handler: portmoneRedirect,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!app.hasRoute({ method: 'POST', url: `${prefix}/portmone/:id/:status` })) {
|
|
17
|
+
app.route({
|
|
18
|
+
method: 'POST',
|
|
19
|
+
url: '/portmone/:id/:status',
|
|
20
|
+
config: {
|
|
21
|
+
policy: 'L0',
|
|
22
|
+
},
|
|
23
|
+
handler: portmoneStatus,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!app.hasRoute({ method: 'GET', url: `${prefix}/portmone/:id/:status` })) {
|
|
28
|
+
app.route({
|
|
29
|
+
method: 'GET',
|
|
30
|
+
url: '/portmone/:id/:status',
|
|
31
|
+
config: {
|
|
32
|
+
policy: 'L0',
|
|
33
|
+
},
|
|
34
|
+
handler: portmoneStatus,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
29
37
|
}
|