@infrab4a/connect 4.20.0-beta.7 → 4.20.0-beta.9

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
@@ -2830,6 +2830,9 @@ class AdyenCardAxiosAdapter {
2830
2830
  this.paymentRepository = paymentRepository;
2831
2831
  this.orderBlockedRepository = orderBlockedRepository;
2832
2832
  }
2833
+ createCardHash(bu) {
2834
+ throw new Error('Method not implemented.');
2835
+ }
2833
2836
  async pay(checkout, card) {
2834
2837
  try {
2835
2838
  const result = await axios__default["default"]({
@@ -7092,18 +7095,25 @@ class PagarmeCardAxiosAdapter {
7092
7095
  }
7093
7096
  }
7094
7097
  async createCardHash(bu) {
7098
+ console.log('input createCardHash', bu);
7099
+ console.log('input this.credentials', this.credentials);
7095
7100
  const key = bu === exports.BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
7101
+ console.log('key', key);
7096
7102
  try {
7097
7103
  const { data } = await axios__default["default"]({
7098
7104
  method: 'GET',
7105
+ headers: {
7106
+ 'content-type': 'application/json',
7107
+ },
7099
7108
  url: `${this.credentials.URL}/transactions/card_hash_key`,
7100
- data: {
7109
+ data: JSON.stringify({
7101
7110
  api_key: key,
7102
- },
7111
+ }),
7103
7112
  });
7104
7113
  return data;
7105
7114
  }
7106
7115
  catch (error) {
7116
+ console.log('createCardHash axios error', error);
7107
7117
  throw new BusinessError('Houve uma falha gerar o hash', {
7108
7118
  info: error.response.data,
7109
7119
  });
package/index.esm.js CHANGED
@@ -2824,6 +2824,9 @@ class AdyenCardAxiosAdapter {
2824
2824
  this.paymentRepository = paymentRepository;
2825
2825
  this.orderBlockedRepository = orderBlockedRepository;
2826
2826
  }
2827
+ createCardHash(bu) {
2828
+ throw new Error('Method not implemented.');
2829
+ }
2827
2830
  async pay(checkout, card) {
2828
2831
  try {
2829
2832
  const result = await axios({
@@ -7086,18 +7089,25 @@ class PagarmeCardAxiosAdapter {
7086
7089
  }
7087
7090
  }
7088
7091
  async createCardHash(bu) {
7092
+ console.log('input createCardHash', bu);
7093
+ console.log('input this.credentials', this.credentials);
7089
7094
  const key = bu === BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
7095
+ console.log('key', key);
7090
7096
  try {
7091
7097
  const { data } = await axios({
7092
7098
  method: 'GET',
7099
+ headers: {
7100
+ 'content-type': 'application/json',
7101
+ },
7093
7102
  url: `${this.credentials.URL}/transactions/card_hash_key`,
7094
- data: {
7103
+ data: JSON.stringify({
7095
7104
  api_key: key,
7096
- },
7105
+ }),
7097
7106
  });
7098
7107
  return data;
7099
7108
  }
7100
7109
  catch (error) {
7110
+ console.log('createCardHash axios error', error);
7101
7111
  throw new BusinessError('Houve uma falha gerar o hash', {
7102
7112
  info: error.response.data,
7103
7113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "4.20.0-beta.7",
3
+ "version": "4.20.0-beta.9",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -1,3 +1,4 @@
1
+ import { BusinessUnitEnum } from '../enums';
1
2
  import { PaymentTransaction } from '../models';
2
3
  import { Checkout } from '../models/checkout';
3
4
  import { Payment } from '../models/payment';
@@ -7,5 +8,6 @@ export interface PaymentProviderCard<Card extends BaseCard = BaseCard> {
7
8
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
8
9
  addCard(card: CardInfo): Promise<Card>;
9
10
  getCardByToken(token: string): Promise<Card>;
11
+ createCardHash<T>(bu: BusinessUnitEnum, card?: CardInfo): Promise<string | T>;
10
12
  createTransaction(info: any): Promise<PaymentTransaction>;
11
13
  }
@@ -1,3 +1,4 @@
1
+ import { BusinessUnitEnum } from '../../../domain';
1
2
  import { PaymentProviderCard } from '../../../domain/shopping/interfaces';
2
3
  import { Checkout, Payment, PaymentTransaction } from '../../../domain/shopping/models';
3
4
  import { OrderBlockedRepository, PaymentRepository } from '../../../domain/shopping/repositories';
@@ -7,6 +8,7 @@ export declare class AdyenCardAxiosAdapter implements PaymentProviderCard<AdyenC
7
8
  private paymentRepository;
8
9
  private orderBlockedRepository;
9
10
  constructor(credentials: AdyenCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
11
+ createCardHash(bu: BusinessUnitEnum): Promise<string>;
10
12
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
11
13
  private createCardPayment;
12
14
  addCard(): Promise<AdyenCard>;
@@ -10,7 +10,7 @@ export declare class PagarmeCardAxiosAdapter implements PaymentProviderCard<Paga
10
10
  constructor(credentials: PagarmeCredentials, paymentRepository: PaymentRepository, orderBlockedRepository: OrderBlockedRepository);
11
11
  pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
12
12
  addCard(card: CardInfo): Promise<PagarMeCard>;
13
- createCardHash(bu: BusinessUnitEnum): Promise<string>;
13
+ createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum): Promise<PagarMeCardManualHash>;
14
14
  getCardByToken(id: string): Promise<PagarMeCard>;
15
15
  createTransaction(info: any): Promise<PaymentTransaction>;
16
16
  private createCardPayment;