@cloudcommerce/app-pagarme-v5 0.32.0

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.
Files changed (36) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/CHANGELOG.md +1 -0
  3. package/LICENSE.md +230 -0
  4. package/README.md +1 -0
  5. package/assets/onload-expression.js +38 -0
  6. package/assets/onload-expression.min.js +1 -0
  7. package/events.js +1 -0
  8. package/lib/index.d.ts +1 -0
  9. package/lib/index.js +2 -0
  10. package/lib/index.js.map +1 -0
  11. package/lib/pagarme-v5-events.d.ts +6 -0
  12. package/lib/pagarme-v5-events.js +21 -0
  13. package/lib/pagarme-v5-events.js.map +1 -0
  14. package/lib/pagarme-v5.d.ts +4 -0
  15. package/lib/pagarme-v5.js +12 -0
  16. package/lib/pagarme-v5.js.map +1 -0
  17. package/lib-mjs/create-pagarme5-transaction.mjs +208 -0
  18. package/lib-mjs/events-to-pagarme5.mjs +209 -0
  19. package/lib-mjs/functions-lib/api-utils.mjs +220 -0
  20. package/lib-mjs/functions-lib/firestore-utils.mjs +24 -0
  21. package/lib-mjs/functions-lib/pagarme/create-axios.mjs +12 -0
  22. package/lib-mjs/functions-lib/pagarme/handle-plans.mjs +69 -0
  23. package/lib-mjs/functions-lib/pagarme/parses-utils.mjs +61 -0
  24. package/lib-mjs/functions-lib/pagarme/payment-subscription.mjs +244 -0
  25. package/lib-mjs/functions-lib/payments/add-installments.mjs +45 -0
  26. package/lib-mjs/list-pagarme5-payments.mjs +218 -0
  27. package/lib-mjs/pagarme5-webhooks.mjs +343 -0
  28. package/package.json +38 -0
  29. package/scripts/build.sh +4 -0
  30. package/scripts/tests.sh +9 -0
  31. package/src/index.ts +1 -0
  32. package/src/pagarme-v5-events.ts +27 -0
  33. package/src/pagarme-v5.ts +12 -0
  34. package/tests/1-list-payments.test.mjs +37 -0
  35. package/tests/2-create-transaction.test.mjs +56 -0
  36. package/tsconfig.json +6 -0
@@ -0,0 +1,343 @@
1
+ import { getFirestore } from 'firebase-admin/firestore';
2
+ import config from '@cloudcommerce/firebase/lib/config';
3
+ import api from '@cloudcommerce/api';
4
+ import logger from 'firebase-functions/logger';
5
+ import axios from './functions-lib/pagarme/create-axios.mjs';
6
+ import {
7
+ getOrderById,
8
+ addPaymentHistory,
9
+ updateTransaction,
10
+ getOrderIntermediatorTransactionId,
11
+ createNewOrderBasedOld,
12
+ // updateOrder,
13
+ checkItemCategory,
14
+ } from './functions-lib/api-utils.mjs';
15
+ import { parserChangeStatusToEcom } from './functions-lib/pagarme/parses-utils.mjs';
16
+
17
+ const getAppData = async () => {
18
+ return new Promise((resolve, reject) => {
19
+ api.get(
20
+ `applications?app_id=${config.get().apps.pagarMeV5.appId}&fields=hidden_data`,
21
+ )
22
+ .then(({ data: result }) => {
23
+ resolve(result[0]);
24
+ })
25
+ .catch((err) => {
26
+ reject(err);
27
+ });
28
+ });
29
+ };
30
+
31
+ const handleWehook = async (req, res) => {
32
+ const colletionFirebase = getFirestore().collection('pagarmeV5Subscriptions');
33
+ const { body } = req;
34
+
35
+ try {
36
+ const type = body.type;
37
+ const appData = await getAppData();
38
+
39
+ if (!process.env.PAGARMEV5_API_TOKEN) {
40
+ const pagarmeApiToken = appData.pagarme_api_token;
41
+ if (pagarmeApiToken && typeof pagarmeApiToken === 'string') {
42
+ process.env.PAGARMEV5_API_TOKEN = pagarmeApiToken;
43
+ } else {
44
+ logger.warn('Missing PAGARMEV5 API TOKEN');
45
+
46
+ return res.status(401)
47
+ .send({
48
+ error: 'NO_PAGARME_KEYS',
49
+ message: 'The token is not defined in the application\'s environment variables and hidden data',
50
+ });
51
+ }
52
+ }
53
+ const pagarmeAxios = axios(process.env.PAGARMEV5_API_TOKEN);
54
+ logger.log(`>> webhook ${JSON.stringify(body)}, type:${type}`);
55
+ if (type === 'subscription.created' && body.data) {
56
+ const orderOriginalId = body.data?.code;
57
+ const subscriptionPagarmeId = body.data?.id;
58
+ logger.log(`>> Check SubcriptionId: ${orderOriginalId}`);
59
+ const documentSnapshot = await colletionFirebase.doc(orderOriginalId).get();
60
+ const docSubscription = documentSnapshot.exists && documentSnapshot.data();
61
+ if (!docSubscription) {
62
+ logger.log('> Subscription not found');
63
+ return res.status(404)
64
+ .send({ message: `Subscription code: #${orderOriginalId} not found` });
65
+ }
66
+ const requestPagarme = [];
67
+ // Check if the product belongs to categories that can be subscribed
68
+ const categoryIds = appData.recurrency_category_ids;
69
+ const { items: itemsApi } = await getOrderById(orderOriginalId);
70
+
71
+ if (categoryIds && Array.isArray(categoryIds) && categoryIds.length) {
72
+ const { data: { items: itemsPagarme } } = await pagarmeAxios.get(`/subscriptions/${subscriptionPagarmeId}`);
73
+ const itemsIdPagarmeDelete = await checkItemCategory(categoryIds, itemsPagarme, itemsApi);
74
+
75
+ const urlRemoveItem = `/subscriptions/${subscriptionPagarmeId}/items/`;
76
+ if (itemsIdPagarmeDelete?.length) {
77
+ itemsIdPagarmeDelete.forEach((itemId) => {
78
+ requestPagarme.push(pagarmeAxios.delete(`${urlRemoveItem}${itemId}`));
79
+ });
80
+ }
81
+ }
82
+
83
+ const { plan } = docSubscription;
84
+ const { discount } = plan;
85
+ const urlDiscount = `/subscriptions/${subscriptionPagarmeId}/discounts`;
86
+ const bodyDiscountPagarme = { value: discount.value };
87
+
88
+ // Add plan discount on each product
89
+ if (discount.type === 'percentage') {
90
+ itemsApi?.forEach((item) => {
91
+ requestPagarme.push(pagarmeAxios.post(
92
+ urlDiscount,
93
+ {
94
+ ...bodyDiscountPagarme,
95
+ discount_type: 'percentage',
96
+ item_id: `pi_${item.sku}`,
97
+ },
98
+ ));
99
+ });
100
+
101
+ // Apply shipping discount if app configuration allows
102
+ if (discount.apply_at !== 'subtotal') {
103
+ requestPagarme.push(pagarmeAxios.post(
104
+ urlDiscount,
105
+ {
106
+ ...bodyDiscountPagarme,
107
+ discount_type: 'percentage',
108
+ item_id: `pi_freight_${orderOriginalId}`,
109
+ },
110
+ ));
111
+ }
112
+ } else {
113
+ requestPagarme.push(pagarmeAxios.post(
114
+ urlDiscount,
115
+ {
116
+ ...bodyDiscountPagarme,
117
+ discount_type: 'flat',
118
+ },
119
+ ));
120
+ }
121
+
122
+ try {
123
+ await Promise.all(requestPagarme);
124
+ logger.log('>> Updated signature');
125
+ res.status(201)
126
+ .send({ message: 'Updated signature' });
127
+ } catch (error) {
128
+ logger.error(error);
129
+ const errCode = 'WEBHOOK_PAGARME_INVOICE_CREATED';
130
+ let status = 409;
131
+ let message = error.message;
132
+ if (error.response) {
133
+ status = error.response.status || status;
134
+ const { data } = error.response;
135
+ if (status !== 401 && status !== 403) {
136
+ message = error.response.message || message;
137
+ } else if (
138
+ data && Array.isArray(data.errors)
139
+ && data.errors[0] && data.errors[0].message
140
+ ) {
141
+ message = data.errors[0].message;
142
+ }
143
+ }
144
+ return res.status(status || 400)
145
+ .send({
146
+ error: errCode,
147
+ message,
148
+ });
149
+ }
150
+ } else if (type === 'subscription.canceled' && body.data) {
151
+ const { data: subscription } = await pagarmeAxios.get(`/subscriptions/${body.data.id}`);
152
+ if (subscription && subscription.status === 'canceled') {
153
+ const orderOriginalId = subscription.code;
154
+ const orderOriginal = await getOrderById(orderOriginalId);
155
+ if (!orderOriginal) {
156
+ logger.log('>> Order status canceled');
157
+ return res.sendStatus(404);
158
+ } if (orderOriginal.status !== 'cancelled') {
159
+ await api.patch(`orders/${orderOriginalId}`, { status: 'cancelled' });
160
+ logger.log('>> Status update Cancelled');
161
+ return res.sendStatus(200);
162
+ }
163
+ logger.log('>> Order status canceled');
164
+ return res.sendStatus(200);
165
+ }
166
+ return res.status(!subscription ? 404 : 400)
167
+ .send({ message: !subscription ? 'Not found subscription' : 'Subscription not canceled' });
168
+ } else if (type.startsWith('charge.')) {
169
+ // const statusChange = type.replace('charge.', '')
170
+ const { data: charge } = await pagarmeAxios.get(`/charges/${body.data.id}`);
171
+ logger.log('>> Charge ', JSON.stringify(charge));
172
+ if (charge.invoice) {
173
+ const { invoice, status } = charge;
174
+ logger.log('>>Parse status: ', parserChangeStatusToEcom(status));
175
+ const order = await getOrderIntermediatorTransactionId(invoice.id);
176
+ if (order) {
177
+ if (order.financial_status.current !== parserChangeStatusToEcom(status)) {
178
+ // updadte status
179
+ const transaction = order.transactions
180
+ .find(
181
+ (transactionFind) => transactionFind.intermediator.transaction_id === invoice.id,
182
+ );
183
+ logger.log('>> Try add payment history');
184
+ const transactionPagarme = charge.last_transaction;
185
+ let notificationCode = `${type};${body.id};`;
186
+ if (transactionPagarme.transaction_type === 'credit_card') {
187
+ notificationCode += `${transactionPagarme.gateway_id || ''};`;
188
+ notificationCode += `${transactionPagarme.acquirer_tid || ''};`;
189
+ notificationCode += `${transactionPagarme.acquirer_nsu || ''};`;
190
+ notificationCode += `${transactionPagarme.acquirer_auth_code || ''};`;
191
+ } else if (transactionPagarme.transaction_type === 'boleto') {
192
+ notificationCode += `${transactionPagarme.gateway_id || ''};`;
193
+ }
194
+ const bodyPaymentHistory = {
195
+ date_time: transactionPagarme.updated_at || new Date().toISOString(),
196
+ status: parserChangeStatusToEcom(status),
197
+ notification_code: notificationCode,
198
+ flags: ['PagarMe'],
199
+ };
200
+ if (transaction && transaction._id) {
201
+ bodyPaymentHistory.transaction_id = transaction._id;
202
+ }
203
+ await addPaymentHistory(order._id, bodyPaymentHistory);
204
+ logger.log('>> Status update to paid');
205
+ return res.sendStatus(200);
206
+ }
207
+ logger.log(`Status is ${parserChangeStatusToEcom(status)}`);
208
+ return res.sendStatus(200);
209
+ }
210
+
211
+ if (status === 'paid') {
212
+ logger.log('>> Try create new order for recurrence');
213
+ const { data: subscription } = await pagarmeAxios.get(`/subscriptions/${invoice.subscriptionId}`);
214
+ const orderOriginal = await getOrderById(subscription.code);
215
+ const documentSnapshot = await colletionFirebase.doc(subscription.code).get();
216
+ const docSubscription = documentSnapshot.exists && documentSnapshot.data();
217
+ if (orderOriginal && docSubscription) {
218
+ const { plan } = docSubscription;
219
+
220
+ await createNewOrderBasedOld(orderOriginal, plan, 'paid', charge, subscription);
221
+
222
+ // Check if the product belongs to categories that can be subscribed,
223
+ // for next recurrence
224
+ const categoryIds = appData.recurrency_category_ids;
225
+ if (categoryIds && Array.isArray(categoryIds) && categoryIds.length) {
226
+ const requestPagarme = [];
227
+ const itemsPagarme = subscription.items;
228
+ const itemsApi = orderOriginal.items;
229
+ const itemsIdPagarmeDelete = await checkItemCategory(
230
+ categoryIds,
231
+ itemsPagarme,
232
+ itemsApi,
233
+ );
234
+
235
+ const urlRemoveItem = `/subscriptions/${invoice.subscriptionId}/items/`;
236
+ if (itemsIdPagarmeDelete?.length) {
237
+ itemsIdPagarmeDelete.forEach((itemId) => {
238
+ requestPagarme.push(pagarmeAxios.delete(`${urlRemoveItem}${itemId}`));
239
+ });
240
+ }
241
+
242
+ try {
243
+ logger.log('>> Updated signature, for next recurrence');
244
+ await Promise.all(requestPagarme);
245
+ } catch (err) {
246
+ logger.warn(err);
247
+ }
248
+ }
249
+
250
+ logger.log('>> Create new Order');
251
+ return res.sendStatus(201);
252
+ }
253
+ logger.log('>> Subscription not found');
254
+ return res.status(404)
255
+ .send({ message: `Subscription code: #${subscription.code} not found` });
256
+ }
257
+
258
+ logger.log('>> Order not found and transaction status is not paid');
259
+ return res.status(400)
260
+ .send({ message: 'Order not found and status is not paid' });
261
+ }
262
+
263
+ if (charge.order) {
264
+ // TODO:
265
+ // payment update (order in pagarme)
266
+ logger.log('>> Try update status order');
267
+ const { order: orderPagarme, status } = charge;
268
+ const order = await getOrderIntermediatorTransactionId(orderPagarme.id);
269
+ if (order) {
270
+ if (order.financial_status.current !== parserChangeStatusToEcom(status)) {
271
+ // updadte status
272
+ let isUpdateTransaction = false;
273
+ let transactionBody;
274
+ const transaction = order.transactions.find(
275
+ (transactionFind) => transactionFind.intermediator.transaction_id === orderPagarme.id,
276
+ );
277
+ // console.log('>> Try add payment history')
278
+ const transactionPagarme = charge.last_transaction;
279
+ // console.log('>>> TransactionPagarme ', JSON.stringify(transactionPagarme))
280
+ let notificationCode = `${type};${body.id};`;
281
+ if (transactionPagarme.transaction_type === 'credit_card') {
282
+ notificationCode += `${transactionPagarme.gateway_id || ''};`;
283
+ notificationCode += `${transactionPagarme.acquirer_tid || ''};`;
284
+ notificationCode += `${transactionPagarme.acquirer_nsu || ''};`;
285
+ notificationCode += `${transactionPagarme.acquirer_auth_code || ''};`;
286
+ } else if (transactionPagarme.transaction_type === 'boleto') {
287
+ notificationCode += `${transactionPagarme.gateway_id || ''};`;
288
+ } else if (transactionPagarme.transaction_type === 'pix') {
289
+ let notes = transaction.notes;
290
+ // pix_provider_tid"
291
+ notes = notes.replaceAll('display:block', 'display:none'); // disable QR Code
292
+ notes = `${notes} # PIX Aprovado`;
293
+ transactionBody = { notes };
294
+ isUpdateTransaction = true;
295
+ }
296
+ const bodyPaymentHistory = {
297
+ date_time: transactionPagarme.updated_at || new Date().toISOString(),
298
+ status: parserChangeStatusToEcom(status),
299
+ notification_code: notificationCode,
300
+ flags: ['PagarMe'],
301
+ };
302
+ if (transaction && transaction._id) {
303
+ bodyPaymentHistory.transaction_id = transaction._id;
304
+ }
305
+ await addPaymentHistory(order._id, bodyPaymentHistory);
306
+ if (isUpdateTransaction && transaction._id) {
307
+ // console.log('>> Try Update transaction ')
308
+ await updateTransaction(order._id, transactionBody, transaction._id)
309
+ .catch(logger.error);
310
+ }
311
+ logger.log(`>> Status update to ${parserChangeStatusToEcom(status)}`);
312
+ return res.sendStatus(200);
313
+ }
314
+ }
315
+ return res.sendStatus(404);
316
+ }
317
+
318
+ return res.sendStatus(405);
319
+ }
320
+ return res.sendStatus(405);
321
+ } catch (error) {
322
+ logger.error(error);
323
+ const errCode = 'WEBHOOK_PAGARME_INTERNAL_ERR';
324
+ let status = 409;
325
+ let message = error.message;
326
+ if (error.response) {
327
+ status = error.response.status || status;
328
+ const { data } = error.response;
329
+ if (status !== 401 && status !== 403) {
330
+ message = error.response.message || message;
331
+ } else if (data && Array.isArray(data.errors) && data.errors[0] && data.errors[0].message) {
332
+ message = data.errors[0].message;
333
+ }
334
+ }
335
+ return res.status(status || 500)
336
+ .send({
337
+ error: errCode,
338
+ message,
339
+ });
340
+ }
341
+ };
342
+
343
+ export default handleWehook;
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@cloudcommerce/app-pagarme-v5",
3
+ "type": "module",
4
+ "version": "0.32.0",
5
+ "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me API v5 with recurring payments",
6
+ "main": "lib/index.js",
7
+ "exports": {
8
+ ".": "./lib/index.js",
9
+ "./events": "./lib/pagarme-v5-events.js"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/ecomplus/cloud-commerce.git",
14
+ "directory": "packages/apps/pagarme-v5"
15
+ },
16
+ "author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
17
+ "license": "Apache 2.0 with Commons Clause",
18
+ "bugs": {
19
+ "url": "https://github.com/ecomplus/cloud-commerce/issues"
20
+ },
21
+ "homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/pagarme-v5#readme",
22
+ "dependencies": {
23
+ "@ecomplus/utils": "1.5.0-rc.5",
24
+ "axios": "^1.5.1",
25
+ "firebase-admin": "^11.11.0",
26
+ "firebase-functions": "^4.4.1",
27
+ "@cloudcommerce/api": "0.32.0",
28
+ "@cloudcommerce/firebase": "0.32.0"
29
+ },
30
+ "devDependencies": {
31
+ "@cloudcommerce/test-base": "0.32.0",
32
+ "@cloudcommerce/types": "0.32.0"
33
+ },
34
+ "scripts": {
35
+ "build": "bash scripts/build.sh",
36
+ "test": "bash scripts/tests.sh"
37
+ }
38
+ }
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ node ../../../scripts/assets-minification.mjs
4
+ bash ../../../scripts/build-lib.sh
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+
3
+ if [ -z "$PAGARMEV5_API_TOKEN" ]; then
4
+ echo -e "PAGARMEV5_API_TOKEN not set\n"
5
+ elif [ -z "$PAGARMEV5_PUBLIC_KEY" ]; then
6
+ echo -e "PAGARMEV5_PUBLIC_KEY not set\n"
7
+ else
8
+ node --test tests/
9
+ fi
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './pagarme-v5';
@@ -0,0 +1,27 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+
3
+ import '@cloudcommerce/firebase/lib/init';
4
+ import * as functions from 'firebase-functions/v1';
5
+ import config from '@cloudcommerce/firebase/lib/config';
6
+ import {
7
+ createAppEventsFunction,
8
+ ApiEventHandler,
9
+ } from '@cloudcommerce/firebase/lib/helpers/pubsub';
10
+ import handleApiEvent from '../lib-mjs/events-to-pagarme5.mjs';
11
+ import handlePagarmeV5Webhook from '../lib-mjs/pagarme5-webhooks.mjs';
12
+
13
+ export const pagarmev5 = {
14
+ onStoreEvent: createAppEventsFunction(
15
+ 'pagarMeV5',
16
+ handleApiEvent as ApiEventHandler,
17
+ ),
18
+ webhooks: functions
19
+ .region(config.get().httpsFunctionOptions.region)
20
+ .https.onRequest((req, res) => {
21
+ if (req.method !== 'POST') {
22
+ res.sendStatus(405);
23
+ } else {
24
+ handlePagarmeV5Webhook(req, res);
25
+ }
26
+ }),
27
+ };
@@ -0,0 +1,12 @@
1
+ import '@cloudcommerce/firebase/lib/init';
2
+ import type { AppModuleBody } from '@cloudcommerce/types';
3
+ import handleListPayments from '../lib-mjs/list-pagarme5-payments.mjs';
4
+ import handleCreateTransaction from '../lib-mjs/create-pagarme5-transaction.mjs';
5
+
6
+ export const listPayments = async (modBody: AppModuleBody) => {
7
+ return handleListPayments(modBody);
8
+ };
9
+
10
+ export const createTransaction = async (modBody: AppModuleBody) => {
11
+ return handleCreateTransaction(modBody);
12
+ };
@@ -0,0 +1,37 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import assert from 'node:assert';
3
+ import test, { before, describe } from 'node:test';
4
+ import {
5
+ modulesUrl,
6
+ bodyListPayments,
7
+ } from '@cloudcommerce/test-base';
8
+
9
+ describe('Test payment list of Pagar.me V5 App', async () => {
10
+ let req;
11
+ let data;
12
+ const appId = 112381;
13
+
14
+ before(async () => {
15
+ req = await fetch(`${modulesUrl}/list_payments?app_id=${appId}`, {
16
+ method: 'POST',
17
+ body: JSON.stringify(bodyListPayments),
18
+ headers: {
19
+ 'Content-Type': 'application/json',
20
+ },
21
+ });
22
+
23
+ data = (await req.json()).result;
24
+ });
25
+
26
+ test('Check Status 200', async () => {
27
+ assert.strictEqual(req?.status, 200);
28
+ });
29
+
30
+ test('Check validated is true', async () => {
31
+ assert.equal(data[0].validated, true);
32
+ });
33
+
34
+ test('Have payment gateways', async () => {
35
+ assert.equal(data[0].response.payment_gateways.length > 0, true);
36
+ });
37
+ });
@@ -0,0 +1,56 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import assert from 'node:assert';
3
+ import test, { before, describe } from 'node:test';
4
+ import {
5
+ modulesUrl,
6
+ bodyCreateTransaction,
7
+ } from '@cloudcommerce/test-base';
8
+
9
+ describe('Test to create a transaction in the Pagar.me V5 with banking billet', async () => {
10
+ let req;
11
+ let data;
12
+ const appId = 112381;
13
+ before(async () => {
14
+ const paymentMethod = {
15
+ code: 'account_deposit',
16
+ name: 'Pix - Pagar.me',
17
+ };
18
+ const to = {
19
+ zip: '35701134',
20
+ province_code: 'MG',
21
+ name: 'Wisley Alves',
22
+ city: 'Sete Lagoas',
23
+ borough: 'Progresso',
24
+ street: 'Rua Santo André',
25
+ number: 81,
26
+ };
27
+
28
+ Object.assign(bodyCreateTransaction, {
29
+ payment_method: paymentMethod,
30
+ to,
31
+ domain: 'www.lojatest.com.br',
32
+ });
33
+
34
+ req = await fetch(`${modulesUrl}/create_transaction?app_id=${appId}`, {
35
+ method: 'POST',
36
+ body: JSON.stringify(bodyCreateTransaction),
37
+ headers: {
38
+ 'Content-Type': 'application/json',
39
+ },
40
+ });
41
+
42
+ data = (await req.json()).result;
43
+ });
44
+
45
+ test('Check Status 200', async () => {
46
+ assert.strictEqual(req?.status, 200);
47
+ });
48
+
49
+ test('Check validated is true', async () => {
50
+ assert.equal(data[0].validated, true);
51
+ });
52
+
53
+ test('Have transaction', async () => {
54
+ assert.notEqual(data[0].response.transaction, undefined);
55
+ });
56
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true
5
+ }
6
+ }