@opengis/pay 1.1.0 → 1.1.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.
@@ -1,6 +1,5 @@
1
1
  import {
2
- config, logger, pgClients, getSelectVal,
3
- dataUpdate,
2
+ config, logger, pgClients, getSelectVal, dataUpdate, getTemplate,
4
3
  } from '@opengis/fastify-table/utils.js';
5
4
 
6
5
  import { sendNotification } from '@opengis/admin/utils.js';
@@ -68,14 +67,23 @@ export default async function portmoneStatus(req, reply) {
68
67
 
69
68
  // request portmone trx info to recheck request data is valid?
70
69
  if (!config.debug && !origin?.startsWith(host)) {
71
- logger.file('integrations/portmone/status/warn', {
72
- origin, uid: user.uid, refill, message: 'invalid referer',
70
+ logger.file('payments/warn', {
71
+ type: 'status',
72
+ origin,
73
+ uid: user.uid,
74
+ refill,
75
+ message: 'invalid referer',
73
76
  });
74
77
  return { message: 'access restricted', status: 403 };
75
78
  }
76
79
 
77
- logger.file('integrations/portmone/status/debug', {
78
- origin, uid: user.uid, refill, body, params,
80
+ logger.file('payments', {
81
+ type: 'status',
82
+ origin,
83
+ uid: user.uid,
84
+ refill,
85
+ body,
86
+ params,
79
87
  });
80
88
 
81
89
  // last trx contains total balance
@@ -111,16 +119,18 @@ export default async function portmoneStatus(req, reply) {
111
119
 
112
120
  Object.assign(data, {
113
121
  domain: req.hostname,
122
+ total_balance: +(refill || 0) + (+totalBalance || 0),
114
123
  account_id_text: accountId ? cls2?.[accountId] || accountId : 'Інформація відсутня',
115
124
  payment_status_text: trxStatus ? cls3?.[trxStatus] || trxStatus : 'Інформація відсутня',
116
125
  });
117
126
 
118
127
  if (to) {
128
+ const pt = await getTemplate('pt', 'marketplace-service-payment-client-template');
119
129
  const options = {
120
130
  pg,
121
131
  to,
122
132
  title: `Поповнення рахунку на порталі ${req.hostname}`,
123
- template: 'marketplace-service-payment-client-template',
133
+ template: pt?.html || pt,
124
134
  data,
125
135
  nocache: config?.local,
126
136
  };