@infrab4a/connect 4.20.0-beta.14 → 4.20.0-beta.15

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/index.cjs.js CHANGED
@@ -2499,7 +2499,6 @@ class GlampointsPaymentService {
2499
2499
  async rewardByOrder(orderId, user, lineItens) {
2500
2500
  try {
2501
2501
  const points = lineItens.filter((item) => !item.isGift).reduce((acc, li) => acc + li.quantity, 0);
2502
- console.log('GlampointsPaymentService glamCredentials', this.glamCredentials);
2503
2502
  const result = await axios__default["default"]({
2504
2503
  method: 'POST',
2505
2504
  url: `${this.glamCredentials.baseUrl}/integration/win/reward`,
@@ -2509,7 +2508,7 @@ class GlampointsPaymentService {
2509
2508
  Origin: 'https://cloudfunctions.b4a.com.br',
2510
2509
  },
2511
2510
  timeout: 60000,
2512
- data: {
2511
+ data: JSON.stringify({
2513
2512
  personId: user.id,
2514
2513
  rewardType: 50,
2515
2514
  referenceId: 0,
@@ -2518,14 +2517,15 @@ class GlampointsPaymentService {
2518
2517
  productId: '',
2519
2518
  token: this.glamCredentials.integrationToken,
2520
2519
  orderId,
2521
- },
2520
+ glambeauty: lineItens === null || lineItens === void 0 ? void 0 : lineItens.some((doc) => doc.brand && doc.brand.toUpperCase() === 'GLAM BEAUTY'),
2521
+ }),
2522
2522
  });
2523
2523
  console.info('[rewards - rewardByOrder] reward success:', JSON.stringify(result));
2524
2524
  return result.data;
2525
2525
  }
2526
2526
  catch (err) {
2527
+ console.log(err);
2527
2528
  console.error('[rewards - rewardByOrder] reward request error', JSON.stringify(err));
2528
- return err;
2529
2529
  }
2530
2530
  }
2531
2531
  async negativateRewardByOrderId(orderId, orderNumber) {
@@ -2539,13 +2539,13 @@ class GlampointsPaymentService {
2539
2539
  Origin: 'https://cloudfunctions.b4a.com.br',
2540
2540
  },
2541
2541
  timeout: 60000,
2542
- data: {
2542
+ data: JSON.stringify({
2543
2543
  rewardType: 51,
2544
2544
  referenceName: `Pedido #${orderId} cancelado`,
2545
2545
  token: '$2a$12$2DAPE64UUWAo4TT/1eQ9TOJO40b5z2jdomOJG3X7LeexwOHYtPydW',
2546
2546
  orderId,
2547
2547
  orderNumber: parseInt(orderNumber.replace(/\D/g, ''), 10),
2548
- },
2548
+ }),
2549
2549
  });
2550
2550
  return result;
2551
2551
  }
package/index.esm.js CHANGED
@@ -2493,7 +2493,6 @@ class GlampointsPaymentService {
2493
2493
  async rewardByOrder(orderId, user, lineItens) {
2494
2494
  try {
2495
2495
  const points = lineItens.filter((item) => !item.isGift).reduce((acc, li) => acc + li.quantity, 0);
2496
- console.log('GlampointsPaymentService glamCredentials', this.glamCredentials);
2497
2496
  const result = await axios({
2498
2497
  method: 'POST',
2499
2498
  url: `${this.glamCredentials.baseUrl}/integration/win/reward`,
@@ -2503,7 +2502,7 @@ class GlampointsPaymentService {
2503
2502
  Origin: 'https://cloudfunctions.b4a.com.br',
2504
2503
  },
2505
2504
  timeout: 60000,
2506
- data: {
2505
+ data: JSON.stringify({
2507
2506
  personId: user.id,
2508
2507
  rewardType: 50,
2509
2508
  referenceId: 0,
@@ -2512,14 +2511,15 @@ class GlampointsPaymentService {
2512
2511
  productId: '',
2513
2512
  token: this.glamCredentials.integrationToken,
2514
2513
  orderId,
2515
- },
2514
+ glambeauty: lineItens === null || lineItens === void 0 ? void 0 : lineItens.some((doc) => doc.brand && doc.brand.toUpperCase() === 'GLAM BEAUTY'),
2515
+ }),
2516
2516
  });
2517
2517
  console.info('[rewards - rewardByOrder] reward success:', JSON.stringify(result));
2518
2518
  return result.data;
2519
2519
  }
2520
2520
  catch (err) {
2521
+ console.log(err);
2521
2522
  console.error('[rewards - rewardByOrder] reward request error', JSON.stringify(err));
2522
- return err;
2523
2523
  }
2524
2524
  }
2525
2525
  async negativateRewardByOrderId(orderId, orderNumber) {
@@ -2533,13 +2533,13 @@ class GlampointsPaymentService {
2533
2533
  Origin: 'https://cloudfunctions.b4a.com.br',
2534
2534
  },
2535
2535
  timeout: 60000,
2536
- data: {
2536
+ data: JSON.stringify({
2537
2537
  rewardType: 51,
2538
2538
  referenceName: `Pedido #${orderId} cancelado`,
2539
2539
  token: '$2a$12$2DAPE64UUWAo4TT/1eQ9TOJO40b5z2jdomOJG3X7LeexwOHYtPydW',
2540
2540
  orderId,
2541
2541
  orderNumber: parseInt(orderNumber.replace(/\D/g, ''), 10),
2542
- },
2542
+ }),
2543
2543
  });
2544
2544
  return result;
2545
2545
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.20.0-beta.14",
3
+ "version": "4.20.0-beta.15",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },