@infrab4a/connect 5.6.0 → 5.6.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.
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 = [
@@ -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
  }
@@ -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/index.esm.js CHANGED
@@ -7286,6 +7286,26 @@ class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withH
7286
7286
  },
7287
7287
  });
7288
7288
  }
7289
+ async removeProductFromAllCategories(productId) {
7290
+ this.logger = DebugHelper.from(this, 'removeProductFromAllCategories');
7291
+ await this.mutation('delete_category_product', ['affected_rows'], {
7292
+ where: {
7293
+ type: 'category_product_bool_exp',
7294
+ required: true,
7295
+ value: { product_id: { _eq: productId } },
7296
+ },
7297
+ });
7298
+ }
7299
+ async removeCategoryFromAllProducts(categoryId) {
7300
+ this.logger = DebugHelper.from(this, 'removeCategoryFromAllProducts');
7301
+ await this.mutation('delete_category_product', ['affected_rows'], {
7302
+ where: {
7303
+ type: 'category_product_bool_exp',
7304
+ required: true,
7305
+ value: { category_id: { _eq: categoryId } },
7306
+ },
7307
+ });
7308
+ }
7289
7309
  }
7290
7310
 
7291
7311
  const fieldsConfiguration$3 = [
@@ -10176,6 +10196,14 @@ class PagarMeErrorHelper {
10176
10196
  case '1070':
10177
10197
  case '2001':
10178
10198
  case '2004':
10199
+ case '5025':
10200
+ case '9124':
10201
+ return ErrorsCode.invalidCardError;
10202
+ // Dados obrigatórios ausentes
10203
+ case '1044':
10204
+ case '5034':
10205
+ case '5047':
10206
+ case '5061':
10179
10207
  return ErrorsCode.invalidCardError;
10180
10208
  // Suspeita de fraude, prevenção do banco
10181
10209
  case '1002':
@@ -10187,6 +10215,7 @@ class PagarMeErrorHelper {
10187
10215
  case '2008':
10188
10216
  case '2009':
10189
10217
  case '2010':
10218
+ case '9201':
10190
10219
  return ErrorsCode.fraudPreventionExternal;
10191
10220
  // Recusado pelo banco/emissor
10192
10221
  case '1007':
@@ -10204,19 +10233,10 @@ class PagarMeErrorHelper {
10204
10233
  case '5087':
10205
10234
  return ErrorsCode.insufficientFundsError;
10206
10235
  // Valor solicitado inválido
10236
+ case '5094':
10207
10237
  case '5016':
10208
10238
  case '5092':
10209
10239
  return ErrorsCode.paymentError;
10210
- // Código de segurança inválido ou não enviado
10211
- case '5025':
10212
- case '9124':
10213
- return ErrorsCode.paymentError;
10214
- // Dados obrigatórios ausentes
10215
- case '1044':
10216
- case '5034':
10217
- case '5047':
10218
- case '5061':
10219
- return ErrorsCode.paymentError;
10220
10240
  // Erros internos ou genéricos
10221
10241
  case '5000':
10222
10242
  case '5001':
@@ -10306,10 +10326,9 @@ class PagarMeErrorHelper {
10306
10326
  // Transação não suportada para o banco/emissor
10307
10327
  case '1061':
10308
10328
  return ErrorsCode.paymentError;
10309
- case '5094':
10310
10329
  case '1010':
10311
10330
  case '1046':
10312
- return ErrorsCode.businessError;
10331
+ return ErrorsCode.invalidCheckoutError;
10313
10332
  default:
10314
10333
  return ErrorsCode.paymentError;
10315
10334
  }
@@ -10487,7 +10506,7 @@ class PagarMeV5ResponseHelper {
10487
10506
  const charger = response.charges.at(0);
10488
10507
  const transaction = charger.last_transaction;
10489
10508
  return PaymentTransaction.toInstance({
10490
- acquirer_name: 'pagar_me',
10509
+ acquirer_name: PaymentProviders.PAGARME,
10491
10510
  amount: charger.amount,
10492
10511
  currency: charger.currency,
10493
10512
  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.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -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
  }
@@ -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 {};