@opengis/pay 2.0.6 → 2.0.7

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": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "type": "module",
5
5
  "description": "pay plugins for billing",
6
6
  "main": "plugin.js",
@@ -5,7 +5,7 @@ import dataInsert from '../crud/dataInsert.js';
5
5
  const { table = 'pay.transactions' } = config.integrations?.pay || {};
6
6
 
7
7
  export default async function createPayment({
8
- orderId, amount, referer, uid, service, expiredDate, description, action = 'pay', currency = 'uah', language = 'uk', paytypes,
8
+ orderId, amount, referer, uid, service, expiredDate, description, action = 'pay', currency = 'uah', language = 'uk', paytypes, optionalParams,
9
9
  }, pg = pgClients.client) {
10
10
  if (!uid) { throw new Error('not enough params: uid'); }
11
11
  if (!service) { throw new Error('not enough params: service'); }
@@ -27,6 +27,7 @@ export default async function createPayment({
27
27
  language,
28
28
  currency,
29
29
  paytypes,
30
+ ...(optionalParams || {}), // allow custom params to be passed
30
31
  },
31
32
  uid,
32
33
  }).then(el => el.rows?.[0]);
@@ -13,7 +13,7 @@ const controller = {
13
13
  };
14
14
 
15
15
  export default async function createTransaction({
16
- orderId, amount, referer, uid, debug, service, expiredDate, description, action, language, paytypes, currency, deliveryEmails,
16
+ orderId, amount, referer, uid, debug, service, expiredDate, description, action, language, paytypes, currency, deliveryEmails, optionalParams,
17
17
  }, pg = pgClients.client) {
18
18
  if (!service) throw new Error('not enough params: service');
19
19
  if (!controller[service]) { throw new Error('invalid params: service'); }
@@ -39,6 +39,7 @@ export default async function createTransaction({
39
39
  language,
40
40
  paytypes,
41
41
  deliveryEmails,
42
+ optionalParams,
42
43
  }, pg);
43
44
  return result;
44
45
  }
@@ -18,7 +18,7 @@ const {
18
18
  const liqpay = new LiqPay(publicKey, privateKey);
19
19
 
20
20
  export default async function liqpayCreateTransaction({
21
- id, orderId, amount, referer, uid, debug, expiredDate, description, paytypes, action = 'pay', currency = 'uah', language = 'uk', deliveryEmails,
21
+ id, orderId, amount, referer, uid, debug, expiredDate, description, paytypes, action = 'pay', currency = 'uah', language = 'uk', deliveryEmails, optionalParams,
22
22
  }, pg = pgClients.client) {
23
23
  if (!referer) {
24
24
  throw new Error('not enough params: referer required');
@@ -60,6 +60,7 @@ export default async function liqpayCreateTransaction({
60
60
  currency,
61
61
  language,
62
62
  paytypes,
63
+ optionalParams,
63
64
  });
64
65
 
65
66
  if (!paymentData?.id) {
@@ -22,7 +22,7 @@ const ccyObj = {
22
22
  };
23
23
 
24
24
  export default async function monopayCreateTransaction({
25
- id, orderId, amount, referer, uid, debug, expiredDate, description, action, currency, language,
25
+ id, orderId, amount, referer, uid, debug, expiredDate, description, action, currency, language, optionalParams,
26
26
  }, pg = pgClients.client) {
27
27
  if (!referer) {
28
28
  throw new Error('not enough params: referer required');
@@ -55,6 +55,7 @@ export default async function monopayCreateTransaction({
55
55
  action,
56
56
  currency,
57
57
  language,
58
+ optionalParams,
58
59
  });
59
60
 
60
61
  if (!paymentData?.id) {
@@ -12,7 +12,7 @@ const { table = 'pay.transactions', backUrl } = config.integrations?.pay || {};
12
12
  const { host = 'https://www.portmone.com.ua', payeeId } = config.integrations?.portmone || {};
13
13
 
14
14
  export default async function portmoneCreateTransaction({
15
- id, orderId, amount, referer, uid, debug, expiredDate, description, action, currency = 'uah', language = 'uk', paytypes,
15
+ id, orderId, amount, referer, uid, debug, expiredDate, description, action, currency = 'uah', language = 'uk', paytypes, optionalParams,
16
16
  }, pg = pgClients.client) {
17
17
  if (!referer) {
18
18
  throw new Error('not enough params: referer required');
@@ -50,6 +50,7 @@ export default async function portmoneCreateTransaction({
50
50
  currency,
51
51
  language,
52
52
  paytypes,
53
+ optionalParams,
53
54
  });
54
55
 
55
56
  if (!paymentData?.id) {
@@ -16,7 +16,7 @@ export default async function liqpayRedirect(req, reply) {
16
16
  const paymentData = query.id ? await paymentInfo(query.id) : {
17
17
  orderId: query.order_id,
18
18
  amount: query.amount, // amount for new transtaction as is, else - preCreated
19
- service: 'portmone',
19
+ service: 'liqpay',
20
20
  referer: headers?.referer, // redirect user after finish of transaction
21
21
  uid: user.uid, // user id
22
22
  };
@@ -18,7 +18,7 @@ export default async function monopayRedirect(req, reply) {
18
18
  const paymentData = query.id ? await paymentInfo(query.id) : {
19
19
  orderId: query.order_id, // order ID, optional
20
20
  amount: query.amount, // amount for new transtaction as is, else - preCreated
21
- service: 'portmone',
21
+ service: 'monopay',
22
22
  referer: headers?.referer, // redirect user after finish of transaction
23
23
  uid: user.uid, // user id
24
24
  };