@cloudcommerce/app-pagarme-v5 2.41.6 → 2.41.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.
@@ -19,7 +19,7 @@ const updateTransaction = (orderId, body, transactionId) => {
19
19
 
20
20
  const getOrderIntermediatorTransactionId = async (invoiceId) => {
21
21
  let queryString = `transactions.intermediator.transaction_id=${invoiceId}`;
22
- queryString += '&fields=transactions,financial_status.current,status';
22
+ queryString += '&fields=transactions,financial_status,status';
23
23
  const { data } = await api.get(`orders?${queryString}`);
24
24
  return data.result[0] || null;
25
25
  };
@@ -156,7 +156,7 @@ const handleWehook = async (req, res) => {
156
156
  const { invoice, status } = charge;
157
157
  const order = await getOrderIntermediatorTransactionId(invoice.id);
158
158
  if (order) {
159
- if (order.financial_status.current !== parserChangeStatusToEcom(status)) {
159
+ if (order.financial_status?.current !== parserChangeStatusToEcom(status)) {
160
160
  // updadte status
161
161
  const transaction = order.transactions
162
162
  .find(
@@ -247,7 +247,7 @@ const handleWehook = async (req, res) => {
247
247
  const { order: orderPagarme, status } = charge;
248
248
  const order = await getOrderIntermediatorTransactionId(orderPagarme.id);
249
249
  if (order) {
250
- if (order.financial_status.current !== parserChangeStatusToEcom(status)) {
250
+ if (order.financial_status?.current !== parserChangeStatusToEcom(status)) {
251
251
  // updadte status
252
252
  let isUpdateTransaction = false;
253
253
  let transactionBody;
@@ -286,12 +286,12 @@ const handleWehook = async (req, res) => {
286
286
  .catch(logger.error);
287
287
  }
288
288
  logger.log(`>> Status update to ${parserChangeStatusToEcom(status)}`);
289
- return res.sendStatus(200);
289
+ return res.sendStatus(201);
290
290
  }
291
+ return res.sendStatus(200);
291
292
  }
292
293
  return res.sendStatus(404);
293
294
  }
294
-
295
295
  return res.sendStatus(405);
296
296
  }
297
297
  return res.sendStatus(405);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme-v5",
3
3
  "type": "module",
4
- "version": "2.41.6",
4
+ "version": "2.41.7",
5
5
  "description": "e-com.plus Cloud Commerce app to integrate Pagar.me API v5 with recurring payments",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -31,12 +31,12 @@
31
31
  "axios": "^1.8.4",
32
32
  "firebase-admin": "^13.2.0",
33
33
  "firebase-functions": "^6.3.2",
34
- "@cloudcommerce/api": "2.41.6",
35
- "@cloudcommerce/firebase": "2.41.6"
34
+ "@cloudcommerce/api": "2.41.7",
35
+ "@cloudcommerce/firebase": "2.41.7"
36
36
  },
37
37
  "devDependencies": {
38
- "@cloudcommerce/test-base": "2.41.6",
39
- "@cloudcommerce/types": "2.41.6"
38
+ "@cloudcommerce/types": "2.41.7",
39
+ "@cloudcommerce/test-base": "2.41.7"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "bash scripts/build.sh",