@infrab4a/connect 5.6.0 → 5.6.2

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
@@ -7310,6 +7310,26 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
7310
7310
  },
7311
7311
  });
7312
7312
  }
7313
+ async removeProductFromAllCategories(productId) {
7314
+ this.logger = DebugHelper.from(this, 'removeProductFromAllCategories');
7315
+ await this.mutation('delete_category_product', ['affected_rows'], {
7316
+ where: {
7317
+ type: 'category_product_bool_exp',
7318
+ required: true,
7319
+ value: { product_id: { _eq: productId } },
7320
+ },
7321
+ });
7322
+ }
7323
+ async removeCategoryFromAllProducts(categoryId) {
7324
+ this.logger = DebugHelper.from(this, 'removeCategoryFromAllProducts');
7325
+ await this.mutation('delete_category_product', ['affected_rows'], {
7326
+ where: {
7327
+ type: 'category_product_bool_exp',
7328
+ required: true,
7329
+ value: { category_id: { _eq: categoryId } },
7330
+ },
7331
+ });
7332
+ }
7313
7333
  }
7314
7334
 
7315
7335
  const fieldsConfiguration$3 = [
@@ -9640,7 +9660,7 @@ class MercadoPagoRequestHelper {
9640
9660
  checkoutId: checkout.id,
9641
9661
  },
9642
9662
  payer: this.buildPayer(checkout, card),
9643
- statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
9663
+ statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'loja glam' : 'mens market',
9644
9664
  additional_info: {
9645
9665
  items: this.buildItems(checkout),
9646
9666
  },
@@ -10200,6 +10220,14 @@ class PagarMeErrorHelper {
10200
10220
  case '1070':
10201
10221
  case '2001':
10202
10222
  case '2004':
10223
+ case '5025':
10224
+ case '9124':
10225
+ return exports.ErrorsCode.invalidCardError;
10226
+ // Dados obrigatórios ausentes
10227
+ case '1044':
10228
+ case '5034':
10229
+ case '5047':
10230
+ case '5061':
10203
10231
  return exports.ErrorsCode.invalidCardError;
10204
10232
  // Suspeita de fraude, prevenção do banco
10205
10233
  case '1002':
@@ -10211,6 +10239,7 @@ class PagarMeErrorHelper {
10211
10239
  case '2008':
10212
10240
  case '2009':
10213
10241
  case '2010':
10242
+ case '9201':
10214
10243
  return exports.ErrorsCode.fraudPreventionExternal;
10215
10244
  // Recusado pelo banco/emissor
10216
10245
  case '1007':
@@ -10228,19 +10257,10 @@ class PagarMeErrorHelper {
10228
10257
  case '5087':
10229
10258
  return exports.ErrorsCode.insufficientFundsError;
10230
10259
  // Valor solicitado inválido
10260
+ case '5094':
10231
10261
  case '5016':
10232
10262
  case '5092':
10233
10263
  return exports.ErrorsCode.paymentError;
10234
- // Código de segurança inválido ou não enviado
10235
- case '5025':
10236
- case '9124':
10237
- return exports.ErrorsCode.paymentError;
10238
- // Dados obrigatórios ausentes
10239
- case '1044':
10240
- case '5034':
10241
- case '5047':
10242
- case '5061':
10243
- return exports.ErrorsCode.paymentError;
10244
10264
  // Erros internos ou genéricos
10245
10265
  case '5000':
10246
10266
  case '5001':
@@ -10330,10 +10350,9 @@ class PagarMeErrorHelper {
10330
10350
  // Transação não suportada para o banco/emissor
10331
10351
  case '1061':
10332
10352
  return exports.ErrorsCode.paymentError;
10333
- case '5094':
10334
10353
  case '1010':
10335
10354
  case '1046':
10336
- return exports.ErrorsCode.businessError;
10355
+ return exports.ErrorsCode.invalidCheckoutError;
10337
10356
  default:
10338
10357
  return exports.ErrorsCode.paymentError;
10339
10358
  }
@@ -10470,7 +10489,7 @@ class PagarMeV5RequestHelper {
10470
10489
  static getCardOrder(checkout, card) {
10471
10490
  return {
10472
10491
  installments: card.installments,
10473
- statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : 'Mens Market',
10492
+ statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'loja glam' : 'mens market',
10474
10493
  card_id: card.cardId,
10475
10494
  card: {
10476
10495
  cvv: card.cardCvv,
@@ -10511,7 +10530,7 @@ class PagarMeV5ResponseHelper {
10511
10530
  const charger = response.charges.at(0);
10512
10531
  const transaction = charger.last_transaction;
10513
10532
  return PaymentTransaction.toInstance({
10514
- acquirer_name: 'pagar_me',
10533
+ acquirer_name: exports.PaymentProviders.PAGARME,
10515
10534
  amount: charger.amount,
10516
10535
  currency: charger.currency,
10517
10536
  gateway_id: charger.gateway_id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.6.0",
3
+ "version": "5.6.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -27,15 +27,5 @@
27
27
  "@types/debug": "^4.1.8",
28
28
  "@types/lodash": "^4.14.191",
29
29
  "@types/node-fetch": "^2.6.2"
30
- },
31
- "exports": {
32
- "./package.json": "./package.json",
33
- ".": {
34
- "module": "./index.esm.js",
35
- "import": "./index.cjs.mjs",
36
- "default": "./index.cjs.js"
37
- }
38
- },
39
- "module": "./index.esm.js",
40
- "main": "./index.cjs.js"
30
+ }
41
31
  }
@@ -8,4 +8,6 @@ export interface CategoryProductRepository extends CrudRepository<CategoryProduc
8
8
  order: number;
9
9
  }[]): Promise<void>;
10
10
  addProductToCategories(productId: string, categoryIds: string[]): Promise<void>;
11
+ removeProductFromAllCategories(productId: string): Promise<void>;
12
+ removeCategoryFromAllProducts(categoryId: string): Promise<void>;
11
13
  }
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
5
5
  export declare const withHelpers: <TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<any, any[]> & TMixinBase) => {
6
6
  new (...args: any[]): {
7
7
  [x: string]: any;
8
- toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
8
+ toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
9
9
  isSubCollection<T_1 extends ModelBaseStructure<T_1, T_1["identifiersFields"][number]>, E extends ModelBaseStructure<E, E["identifiersFields"][number]>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
10
10
  };
11
11
  } & TMixinBase;
@@ -10,5 +10,7 @@ export declare class CategoryProductHasuraGraphQLRepository extends CategoryProd
10
10
  order: number;
11
11
  }[]): Promise<void>;
12
12
  addProductToCategories(productId: string, categoryIds: string[]): Promise<void>;
13
+ removeProductFromAllCategories(productId: string): Promise<void>;
14
+ removeCategoryFromAllProducts(categoryId: string): Promise<void>;
13
15
  }
14
16
  export {};
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;
package/index.cjs.mjs DELETED
@@ -1,2 +0,0 @@
1
- export * from './index.cjs.js';
2
- export { _default as default } from './index.cjs.default.js';