@infrab4a/connect 5.1.0-beta.6 → 5.1.0-beta.8

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
@@ -115,6 +115,13 @@ exports.PaymentProviders = void 0;
115
115
  PaymentProviders["GLAMPOINTS"] = "glampoints";
116
116
  })(exports.PaymentProviders || (exports.PaymentProviders = {}));
117
117
 
118
+ exports.TransactionPaymentMethods = void 0;
119
+ (function (TransactionPaymentMethods) {
120
+ TransactionPaymentMethods["CARD"] = "credit_card";
121
+ TransactionPaymentMethods["BANKSLIP"] = "boleto";
122
+ TransactionPaymentMethods["PIX"] = "pix";
123
+ })(exports.TransactionPaymentMethods || (exports.TransactionPaymentMethods = {}));
124
+
118
125
  class BasePaymentMethodFactory {
119
126
  constructor(methods) {
120
127
  this.methods = methods;
@@ -8588,12 +8595,12 @@ class PagarmePaymentOperationsHelper {
8588
8595
  }
8589
8596
 
8590
8597
  class PagarMeV5RequestHelper {
8591
- static build(checkout, type, card) {
8598
+ static build(checkout, method, card) {
8592
8599
  return {
8593
8600
  items: this.buildItems(checkout),
8594
8601
  customer: this.buildCustomer(checkout),
8595
8602
  shipping: this.buildShipping(checkout),
8596
- payments: this.buildPayment(checkout, type, card),
8603
+ payments: this.buildPayment(checkout, method, card),
8597
8604
  };
8598
8605
  }
8599
8606
  static buildItems(checkout) {
@@ -8652,18 +8659,18 @@ class PagarMeV5RequestHelper {
8652
8659
  },
8653
8660
  };
8654
8661
  }
8655
- static buildPayment(checkout, type, card) {
8662
+ static buildPayment(checkout, method, card) {
8656
8663
  return [
8657
8664
  {
8658
- payment_method: type,
8665
+ payment_method: method,
8659
8666
  amount: Math.floor(checkout.totalPrice * 100),
8660
- ...(type === 'pix' && {
8667
+ ...(method === 'pix' && {
8661
8668
  pix: this.getPixOrder(),
8662
8669
  }),
8663
- ...(type === 'boleto' && {
8670
+ ...(method === 'boleto' && {
8664
8671
  boleto: this.getBoletoOrder(),
8665
8672
  }),
8666
- ...(type === 'credit_card' && {
8673
+ ...(method === 'credit_card' && {
8667
8674
  credit_card: this.getCardOrder(checkout, card),
8668
8675
  }),
8669
8676
  },
@@ -8695,7 +8702,7 @@ class PagarMeV5RequestHelper {
8695
8702
  }
8696
8703
 
8697
8704
  class PagarMeV5ResponseHelper {
8698
- static build(checkout, response) {
8705
+ static build(method, checkout, response) {
8699
8706
  return Payment.toInstance({
8700
8707
  createdAt: new Date(),
8701
8708
  updatedAt: new Date(),
@@ -8704,10 +8711,10 @@ class PagarMeV5ResponseHelper {
8704
8711
  totalPrice: checkout.totalPrice,
8705
8712
  paymentProvider: exports.PaymentProviders.PAGARME,
8706
8713
  pagarMeOrderId: response.id,
8707
- transaction: this.buildPaymentTransaction(response),
8714
+ transaction: this.buildPaymentTransaction(method, response),
8708
8715
  });
8709
8716
  }
8710
- static buildPaymentTransaction(response) {
8717
+ static buildPaymentTransaction(method, response) {
8711
8718
  const charger = response.charges.at(0);
8712
8719
  const transaction = charger.last_transaction;
8713
8720
  return PaymentTransaction.toInstance({
@@ -8722,11 +8729,11 @@ class PagarMeV5ResponseHelper {
8722
8729
  paid_amount: charger.paid_amount,
8723
8730
  paid_at: charger.paid_at,
8724
8731
  order_id: response.id,
8725
- tid: +transaction.id,
8726
- id: +transaction.id,
8727
- ...this.getBoletoReponse(transaction),
8728
- ...this.getPixReponse(transaction),
8729
- ...this.getCardReponse(transaction),
8732
+ tid: transaction.id,
8733
+ id: transaction.id,
8734
+ ...(method == exports.TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
8735
+ ...(method == exports.TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
8736
+ ...(method == exports.TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
8730
8737
  });
8731
8738
  }
8732
8739
  static getBoletoReponse(transaction) {
@@ -8823,8 +8830,9 @@ class PagarmeCardAxiosAdapter {
8823
8830
  });
8824
8831
  }
8825
8832
  }
8826
- async createCardHash(bu) {
8827
- const key = bu === exports.BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
8833
+ async createCardHash(bu, shop) {
8834
+ const credentials = shop && shop == exports.Shops.MENSMARKET ? this.credentials[exports.Shops.MENSMARKET] : this.credentials[exports.Shops.GLAMSHOP];
8835
+ const key = bu === exports.BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
8828
8836
  try {
8829
8837
  const { data } = await axios__default["default"]({
8830
8838
  method: 'GET',
@@ -9053,7 +9061,7 @@ class PagarmeV5BankSlipAxiosAdapter {
9053
9061
  info: data.charges.at(0).last_transaction?.gateway_response,
9054
9062
  }));
9055
9063
  }
9056
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9064
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.BANKSLIP, checkout, data));
9057
9065
  return payment;
9058
9066
  }
9059
9067
  catch (error) {
@@ -9079,7 +9087,7 @@ class PagarmeV5BankSlipAxiosAdapter {
9079
9087
  },
9080
9088
  });
9081
9089
  const payment = await this.paymentRepository.get({
9082
- id: +data.id,
9090
+ id: data.id,
9083
9091
  });
9084
9092
  return payment.transaction;
9085
9093
  }
@@ -9113,7 +9121,7 @@ class PagarmeV5CardAxiosAdapter {
9113
9121
  });
9114
9122
  console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
9115
9123
  if (data.status == exports.PagarMeV5OrderStatus.Falha ||
9116
- data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Pago ||
9124
+ data.charges.at(0).status !== exports.PagarMeV5OrderStatus.Pago ||
9117
9125
  data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Capturada) {
9118
9126
  await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
9119
9127
  checkout,
@@ -9122,7 +9130,7 @@ class PagarmeV5CardAxiosAdapter {
9122
9130
  });
9123
9131
  throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
9124
9132
  }
9125
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9133
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.CARD, checkout, data));
9126
9134
  return payment;
9127
9135
  }
9128
9136
  catch (error) {
@@ -9177,8 +9185,9 @@ class PagarmeV5CardAxiosAdapter {
9177
9185
  });
9178
9186
  }
9179
9187
  }
9180
- async createCardHash(bu) {
9181
- const key = bu === exports.BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
9188
+ async createCardHash(bu, shop) {
9189
+ const credentials = shop && shop == exports.Shops.MENSMARKET ? this.credentials[exports.Shops.MENSMARKET] : this.credentials[exports.Shops.GLAMSHOP];
9190
+ const key = bu === exports.BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
9182
9191
  try {
9183
9192
  const { data } = await axios__default["default"]({
9184
9193
  method: 'GET',
@@ -9201,7 +9210,7 @@ class PagarmeV5CardAxiosAdapter {
9201
9210
  async getCardByToken(id) {
9202
9211
  try {
9203
9212
  const { data } = await axios__default["default"]({
9204
- method: 'POST',
9213
+ method: 'GET',
9205
9214
  url: `${this.credentials.URL}/cards/${id}`,
9206
9215
  data: {
9207
9216
  api_key: this.credentials.API_KEY,
@@ -9216,26 +9225,7 @@ class PagarmeV5CardAxiosAdapter {
9216
9225
  }
9217
9226
  }
9218
9227
  async createTransaction(info) {
9219
- try {
9220
- const { data } = await axios__default["default"]({
9221
- method: 'POST',
9222
- url: `${this.credentials.URL}/transactions`,
9223
- headers: {
9224
- Authorization: 'Basic ' + Buffer.from(this.credentials.API_KEY).toString('base64'),
9225
- 'Content-Type': 'application/json',
9226
- },
9227
- data: {
9228
- ...info,
9229
- api_key: this.credentials.API_KEY,
9230
- },
9231
- });
9232
- return data;
9233
- }
9234
- catch (error) {
9235
- throw new BusinessError('Houve uma falha ao criar a transação', {
9236
- info: error.response.data,
9237
- });
9238
- }
9228
+ return;
9239
9229
  }
9240
9230
  }
9241
9231
 
@@ -9295,7 +9285,7 @@ class PagarmeV5PixAxiosAdapter {
9295
9285
  info: data.charges.at(0).last_transaction?.gateway_response,
9296
9286
  });
9297
9287
  }
9298
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9288
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.PIX, checkout, data));
9299
9289
  return payment;
9300
9290
  }
9301
9291
  catch (error) {
package/index.esm.js CHANGED
@@ -90,6 +90,13 @@ var PaymentProviders;
90
90
  PaymentProviders["GLAMPOINTS"] = "glampoints";
91
91
  })(PaymentProviders || (PaymentProviders = {}));
92
92
 
93
+ var TransactionPaymentMethods;
94
+ (function (TransactionPaymentMethods) {
95
+ TransactionPaymentMethods["CARD"] = "credit_card";
96
+ TransactionPaymentMethods["BANKSLIP"] = "boleto";
97
+ TransactionPaymentMethods["PIX"] = "pix";
98
+ })(TransactionPaymentMethods || (TransactionPaymentMethods = {}));
99
+
93
100
  class BasePaymentMethodFactory {
94
101
  constructor(methods) {
95
102
  this.methods = methods;
@@ -8563,12 +8570,12 @@ class PagarmePaymentOperationsHelper {
8563
8570
  }
8564
8571
 
8565
8572
  class PagarMeV5RequestHelper {
8566
- static build(checkout, type, card) {
8573
+ static build(checkout, method, card) {
8567
8574
  return {
8568
8575
  items: this.buildItems(checkout),
8569
8576
  customer: this.buildCustomer(checkout),
8570
8577
  shipping: this.buildShipping(checkout),
8571
- payments: this.buildPayment(checkout, type, card),
8578
+ payments: this.buildPayment(checkout, method, card),
8572
8579
  };
8573
8580
  }
8574
8581
  static buildItems(checkout) {
@@ -8627,18 +8634,18 @@ class PagarMeV5RequestHelper {
8627
8634
  },
8628
8635
  };
8629
8636
  }
8630
- static buildPayment(checkout, type, card) {
8637
+ static buildPayment(checkout, method, card) {
8631
8638
  return [
8632
8639
  {
8633
- payment_method: type,
8640
+ payment_method: method,
8634
8641
  amount: Math.floor(checkout.totalPrice * 100),
8635
- ...(type === 'pix' && {
8642
+ ...(method === 'pix' && {
8636
8643
  pix: this.getPixOrder(),
8637
8644
  }),
8638
- ...(type === 'boleto' && {
8645
+ ...(method === 'boleto' && {
8639
8646
  boleto: this.getBoletoOrder(),
8640
8647
  }),
8641
- ...(type === 'credit_card' && {
8648
+ ...(method === 'credit_card' && {
8642
8649
  credit_card: this.getCardOrder(checkout, card),
8643
8650
  }),
8644
8651
  },
@@ -8670,7 +8677,7 @@ class PagarMeV5RequestHelper {
8670
8677
  }
8671
8678
 
8672
8679
  class PagarMeV5ResponseHelper {
8673
- static build(checkout, response) {
8680
+ static build(method, checkout, response) {
8674
8681
  return Payment.toInstance({
8675
8682
  createdAt: new Date(),
8676
8683
  updatedAt: new Date(),
@@ -8679,10 +8686,10 @@ class PagarMeV5ResponseHelper {
8679
8686
  totalPrice: checkout.totalPrice,
8680
8687
  paymentProvider: PaymentProviders.PAGARME,
8681
8688
  pagarMeOrderId: response.id,
8682
- transaction: this.buildPaymentTransaction(response),
8689
+ transaction: this.buildPaymentTransaction(method, response),
8683
8690
  });
8684
8691
  }
8685
- static buildPaymentTransaction(response) {
8692
+ static buildPaymentTransaction(method, response) {
8686
8693
  const charger = response.charges.at(0);
8687
8694
  const transaction = charger.last_transaction;
8688
8695
  return PaymentTransaction.toInstance({
@@ -8697,11 +8704,11 @@ class PagarMeV5ResponseHelper {
8697
8704
  paid_amount: charger.paid_amount,
8698
8705
  paid_at: charger.paid_at,
8699
8706
  order_id: response.id,
8700
- tid: +transaction.id,
8701
- id: +transaction.id,
8702
- ...this.getBoletoReponse(transaction),
8703
- ...this.getPixReponse(transaction),
8704
- ...this.getCardReponse(transaction),
8707
+ tid: transaction.id,
8708
+ id: transaction.id,
8709
+ ...(method == TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
8710
+ ...(method == TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
8711
+ ...(method == TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
8705
8712
  });
8706
8713
  }
8707
8714
  static getBoletoReponse(transaction) {
@@ -8798,8 +8805,9 @@ class PagarmeCardAxiosAdapter {
8798
8805
  });
8799
8806
  }
8800
8807
  }
8801
- async createCardHash(bu) {
8802
- const key = bu === BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
8808
+ async createCardHash(bu, shop) {
8809
+ const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
8810
+ const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
8803
8811
  try {
8804
8812
  const { data } = await axios({
8805
8813
  method: 'GET',
@@ -9028,7 +9036,7 @@ class PagarmeV5BankSlipAxiosAdapter {
9028
9036
  info: data.charges.at(0).last_transaction?.gateway_response,
9029
9037
  }));
9030
9038
  }
9031
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9039
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.BANKSLIP, checkout, data));
9032
9040
  return payment;
9033
9041
  }
9034
9042
  catch (error) {
@@ -9054,7 +9062,7 @@ class PagarmeV5BankSlipAxiosAdapter {
9054
9062
  },
9055
9063
  });
9056
9064
  const payment = await this.paymentRepository.get({
9057
- id: +data.id,
9065
+ id: data.id,
9058
9066
  });
9059
9067
  return payment.transaction;
9060
9068
  }
@@ -9088,7 +9096,7 @@ class PagarmeV5CardAxiosAdapter {
9088
9096
  });
9089
9097
  console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
9090
9098
  if (data.status == PagarMeV5OrderStatus.Falha ||
9091
- data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Pago ||
9099
+ data.charges.at(0).status !== PagarMeV5OrderStatus.Pago ||
9092
9100
  data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
9093
9101
  await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
9094
9102
  checkout,
@@ -9097,7 +9105,7 @@ class PagarmeV5CardAxiosAdapter {
9097
9105
  });
9098
9106
  throw PagarmeBlockedOrderHelper.createPaymentError(checkout, data);
9099
9107
  }
9100
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9108
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.CARD, checkout, data));
9101
9109
  return payment;
9102
9110
  }
9103
9111
  catch (error) {
@@ -9152,8 +9160,9 @@ class PagarmeV5CardAxiosAdapter {
9152
9160
  });
9153
9161
  }
9154
9162
  }
9155
- async createCardHash(bu) {
9156
- const key = bu === BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
9163
+ async createCardHash(bu, shop) {
9164
+ const credentials = shop && shop == Shops.MENSMARKET ? this.credentials[Shops.MENSMARKET] : this.credentials[Shops.GLAMSHOP];
9165
+ const key = bu === BusinessUnitEnum.SHOP ? credentials.SHOP_API_KEY : credentials.SUBSCRIPTION_API_KEY;
9157
9166
  try {
9158
9167
  const { data } = await axios({
9159
9168
  method: 'GET',
@@ -9176,7 +9185,7 @@ class PagarmeV5CardAxiosAdapter {
9176
9185
  async getCardByToken(id) {
9177
9186
  try {
9178
9187
  const { data } = await axios({
9179
- method: 'POST',
9188
+ method: 'GET',
9180
9189
  url: `${this.credentials.URL}/cards/${id}`,
9181
9190
  data: {
9182
9191
  api_key: this.credentials.API_KEY,
@@ -9191,26 +9200,7 @@ class PagarmeV5CardAxiosAdapter {
9191
9200
  }
9192
9201
  }
9193
9202
  async createTransaction(info) {
9194
- try {
9195
- const { data } = await axios({
9196
- method: 'POST',
9197
- url: `${this.credentials.URL}/transactions`,
9198
- headers: {
9199
- Authorization: 'Basic ' + Buffer.from(this.credentials.API_KEY).toString('base64'),
9200
- 'Content-Type': 'application/json',
9201
- },
9202
- data: {
9203
- ...info,
9204
- api_key: this.credentials.API_KEY,
9205
- },
9206
- });
9207
- return data;
9208
- }
9209
- catch (error) {
9210
- throw new BusinessError('Houve uma falha ao criar a transação', {
9211
- info: error.response.data,
9212
- });
9213
- }
9203
+ return;
9214
9204
  }
9215
9205
  }
9216
9206
 
@@ -9270,7 +9260,7 @@ class PagarmeV5PixAxiosAdapter {
9270
9260
  info: data.charges.at(0).last_transaction?.gateway_response,
9271
9261
  });
9272
9262
  }
9273
- const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(checkout, data));
9263
+ const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(TransactionPaymentMethods.PIX, checkout, data));
9274
9264
  return payment;
9275
9265
  }
9276
9266
  catch (error) {
@@ -9441,4 +9431,4 @@ class ProductsVertexSearch {
9441
9431
  }
9442
9432
  }
9443
9433
 
9444
- export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
9434
+ export { AccessoryImportances, Address, AdyenCardAxiosAdapter, AdyenPaymentMethodFactory, AntifraudBankSlipService, AntifraudCardService, AntifraudGlampointsService, AntifraudPixService, AntifraudProviderFactory, AntifraudProviders, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, BrandEquityOptions, BusinessError, BusinessUnitEnum, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, FraudValidationError, GenderDestination, GlampointsPaymentMethodFactory, GlampointsPaymentService, Group, GroupFirestoreRepository, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, ObsEmitter, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderBlockedType, OrderFirestoreRepository, OrderStatus, PagarMeV5OrderStatus, PagarMeV5PaymentStatus, PagarmeBankSlipAxiosAdapter, PagarmeCardAxiosAdapter, PagarmePaymentMethodFactory, PagarmePaymentStatus, PagarmePixAxiosAdapter, PagarmeV5BankSlipAxiosAdapter, PagarmeV5CardAxiosAdapter, PagarmeV5PixAxiosAdapter, Payment, PaymentError, PaymentFirestoreRepository, PaymentMethods, PaymentProviderFactory, PaymentProviders, PaymentTransaction, PaymentType, PersonTypes, Plans, Product, ProductErrors, ProductErrorsHasuraGraphQL, ProductErrorsHasuraGraphQLRepository, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductLabelEnum, ProductReview, ProductReviewHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RestCacheAdapter, RoundProductPricesHelper, Sequence, SequenceFirestoreRepository, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, StockLimitError, StockOutError, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, TransactionPaymentMethods, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, deserialize, getClass, is, isDebuggable, isUUID, parseDateTime, registerClass, resolveClass, serialize, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.1.0-beta.6",
3
+ "version": "5.1.0-beta.8",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -5,3 +5,4 @@ export * from './pagarme-payment-status.enum';
5
5
  export * from './pagarme-v5-payment-status.enum';
6
6
  export * from './payment-methods.enum';
7
7
  export * from './payment-providers.enum';
8
+ export * from './transaction-payment-methods.enum';
@@ -0,0 +1,5 @@
1
+ export declare enum TransactionPaymentMethods {
2
+ CARD = "credit_card",
3
+ BANKSLIP = "boleto",
4
+ PIX = "pix"
5
+ }
@@ -1,3 +1,4 @@
1
+ import { Shops } from '../../catalog';
1
2
  import { BusinessUnitEnum } from '../enums';
2
3
  import { PaymentTransaction } from '../models';
3
4
  import { Checkout } from '../models/checkout';
@@ -8,6 +9,6 @@ export interface PaymentProviderCard<Card extends BaseCard = BaseCard> {
8
9
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
9
10
  addCard(card: CardInfo): Promise<Card>;
10
11
  getCardByToken(token: string): Promise<Card>;
11
- createCardHash<T>(bu: BusinessUnitEnum, card?: CardInfo): Promise<string | T>;
12
+ createCardHash<T>(bu: BusinessUnitEnum, shop: Shops, card?: CardInfo): Promise<string | T>;
12
13
  createTransaction(info: any): Promise<PaymentTransaction>;
13
14
  }
@@ -1,10 +1,10 @@
1
1
  import { BaseModel } from '../../generic/model/base.model';
2
2
  import { PaymentBilling, PaymentCard, PaymentCustomer, PaymentItem, PaymentShipping } from './types';
3
3
  export declare class PaymentTransaction extends BaseModel<PaymentTransaction> {
4
- id?: number;
4
+ id?: string;
5
5
  object?: string;
6
6
  status?: string;
7
- tid?: number;
7
+ tid?: string;
8
8
  gateway_id?: string;
9
9
  nsu?: number;
10
10
  amount: number;
@@ -2,7 +2,7 @@ import { BaseModel, GenericIdentifier } from '../../generic/model/base.model';
2
2
  import { PaymentProvider } from '../types';
3
3
  import { PaymentTransaction } from './payment-transaction';
4
4
  export declare class Payment extends BaseModel<Payment> {
5
- id: number;
5
+ id: string;
6
6
  checkoutId: string;
7
7
  orderId?: string;
8
8
  pagarMeOrderId?: string;
@@ -1,7 +1,13 @@
1
1
  export type PagarmeCredentials = {
2
2
  URL: string;
3
- URL_POSTBACK: string;
3
+ URL_POSTBACK?: string;
4
4
  API_KEY: string;
5
- SUBSCRIPTION_API_KEY: string;
6
- SHOP_API_KEY: string;
5
+ Glamshop: {
6
+ SUBSCRIPTION_API_KEY: string;
7
+ SHOP_API_KEY: string;
8
+ };
9
+ mensmarket: {
10
+ SUBSCRIPTION_API_KEY: string;
11
+ SHOP_API_KEY: string;
12
+ };
7
13
  };
@@ -1,7 +1,7 @@
1
1
  import { Checkout, PaymentCardInfo } from '../../../../domain';
2
2
  import { PagarMeV5RequestPayload } from '../../types';
3
3
  export declare class PagarMeV5RequestHelper {
4
- static build(checkout: Checkout, type: 'pix' | 'boleto' | 'credit_card', card?: PaymentCardInfo): PagarMeV5RequestPayload;
4
+ static build(checkout: Checkout, method: 'pix' | 'boleto' | 'credit_card', card?: PaymentCardInfo): PagarMeV5RequestPayload;
5
5
  private static buildItems;
6
6
  private static buildCustomer;
7
7
  private static buildShipping;
@@ -1,7 +1,7 @@
1
- import { Checkout, Payment } from '../../../../domain';
1
+ import { Checkout, Payment, TransactionPaymentMethods } from '../../../../domain';
2
2
  import { PagarMeV5Response } from '../../types';
3
3
  export declare class PagarMeV5ResponseHelper {
4
- static build(checkout: Checkout, response: PagarMeV5Response): Payment;
4
+ static build(method: TransactionPaymentMethods, checkout: Checkout, response: PagarMeV5Response): Payment;
5
5
  private static buildPaymentTransaction;
6
6
  private static getBoletoReponse;
7
7
  private static getPixReponse;
@@ -1,3 +1,4 @@
1
+ import { Shops } from '../../../../domain/catalog';
1
2
  import { BusinessUnitEnum } from '../../../../domain/shopping/enums';
2
3
  import { PaymentProviderCard } from '../../../../domain/shopping/interfaces';
3
4
  import { Checkout, Payment, PaymentTransaction } from '../../../../domain/shopping/models';
@@ -10,7 +11,7 @@ export declare class PagarmeCardAxiosAdapter implements PaymentProviderCard<Paga
10
11
  constructor(credentials: PagarmeCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
11
12
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
12
13
  addCard(card: CardInfo): Promise<PagarMeCard>;
13
- createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum): Promise<PagarMeCardManualHash>;
14
+ createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum, shop?: Shops): Promise<PagarMeCardManualHash>;
14
15
  getCardByToken(id: string): Promise<PagarMeCard>;
15
16
  createTransaction(info: any): Promise<PaymentTransaction>;
16
17
  private createCardPayment;
@@ -1,3 +1,4 @@
1
+ import { Shops } from '../../../../domain';
1
2
  import { BusinessUnitEnum } from '../../../../domain/shopping/enums';
2
3
  import { PaymentProviderCard } from '../../../../domain/shopping/interfaces';
3
4
  import { Checkout, Payment, PaymentTransaction } from '../../../../domain/shopping/models';
@@ -10,7 +11,7 @@ export declare class PagarmeV5CardAxiosAdapter implements PaymentProviderCard<Pa
10
11
  constructor(credentials: PagarmeCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
11
12
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
12
13
  addCard(card: CardInfo): Promise<PagarMeCard>;
13
- createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum): Promise<PagarMeCardManualHash>;
14
+ createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum, shop?: Shops): Promise<PagarMeCardManualHash>;
14
15
  getCardByToken(id: string): Promise<PagarMeCard>;
15
16
  createTransaction(info: any): Promise<PaymentTransaction>;
16
17
  }