@infrab4a/connect 5.1.0-beta.7 → 5.1.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 +8 -7
- package/index.esm.js +8 -7
- package/package.json +1 -1
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +1 -0
- package/src/domain/shopping/models/payment-transaction.d.ts +1 -0
- package/src/domain/shopping/models/payment.d.ts +1 -1
- package/src/infra/pagarme/adapters/v5/pagarmev5-card-payment-axios.adapter.d.ts +2 -1
package/index.cjs.js
CHANGED
|
@@ -8729,8 +8729,9 @@ class PagarMeV5ResponseHelper {
|
|
|
8729
8729
|
paid_amount: charger.paid_amount,
|
|
8730
8730
|
paid_at: charger.paid_at,
|
|
8731
8731
|
order_id: response.id,
|
|
8732
|
-
|
|
8733
|
-
|
|
8732
|
+
charger_id: charger.id,
|
|
8733
|
+
tid: charger.id,
|
|
8734
|
+
id: charger.id,
|
|
8734
8735
|
...(method == exports.TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
|
|
8735
8736
|
...(method == exports.TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
|
|
8736
8737
|
...(method == exports.TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
|
|
@@ -9087,7 +9088,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9087
9088
|
},
|
|
9088
9089
|
});
|
|
9089
9090
|
const payment = await this.paymentRepository.get({
|
|
9090
|
-
id:
|
|
9091
|
+
id: data.id,
|
|
9091
9092
|
});
|
|
9092
9093
|
return payment.transaction;
|
|
9093
9094
|
}
|
|
@@ -9121,7 +9122,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9121
9122
|
});
|
|
9122
9123
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9123
9124
|
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
9124
|
-
data.charges.at(0).
|
|
9125
|
+
data.charges.at(0).status !== exports.PagarMeV5OrderStatus.Pago ||
|
|
9125
9126
|
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Capturada) {
|
|
9126
9127
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9127
9128
|
checkout,
|
|
@@ -9207,11 +9208,11 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9207
9208
|
});
|
|
9208
9209
|
}
|
|
9209
9210
|
}
|
|
9210
|
-
async getCardByToken(
|
|
9211
|
+
async getCardByToken(customerId, token) {
|
|
9211
9212
|
try {
|
|
9212
9213
|
const { data } = await axios__default["default"]({
|
|
9213
9214
|
method: 'GET',
|
|
9214
|
-
url: `${this.credentials.URL}/cards/${
|
|
9215
|
+
url: `${this.credentials.URL}/cards/${token}`,
|
|
9215
9216
|
data: {
|
|
9216
9217
|
api_key: this.credentials.API_KEY,
|
|
9217
9218
|
},
|
|
@@ -9219,7 +9220,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9219
9220
|
return data;
|
|
9220
9221
|
}
|
|
9221
9222
|
catch (error) {
|
|
9222
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' +
|
|
9223
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
|
|
9223
9224
|
info: error.response.data,
|
|
9224
9225
|
});
|
|
9225
9226
|
}
|
package/index.esm.js
CHANGED
|
@@ -8704,8 +8704,9 @@ class PagarMeV5ResponseHelper {
|
|
|
8704
8704
|
paid_amount: charger.paid_amount,
|
|
8705
8705
|
paid_at: charger.paid_at,
|
|
8706
8706
|
order_id: response.id,
|
|
8707
|
-
|
|
8708
|
-
|
|
8707
|
+
charger_id: charger.id,
|
|
8708
|
+
tid: charger.id,
|
|
8709
|
+
id: charger.id,
|
|
8709
8710
|
...(method == TransactionPaymentMethods.BANKSLIP && this.getBoletoReponse(transaction)),
|
|
8710
8711
|
...(method == TransactionPaymentMethods.PIX && this.getPixReponse(transaction)),
|
|
8711
8712
|
...(method == TransactionPaymentMethods.CARD && this.getCardReponse(transaction)),
|
|
@@ -9062,7 +9063,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
9062
9063
|
},
|
|
9063
9064
|
});
|
|
9064
9065
|
const payment = await this.paymentRepository.get({
|
|
9065
|
-
id:
|
|
9066
|
+
id: data.id,
|
|
9066
9067
|
});
|
|
9067
9068
|
return payment.transaction;
|
|
9068
9069
|
}
|
|
@@ -9096,7 +9097,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9096
9097
|
});
|
|
9097
9098
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
9098
9099
|
if (data.status == PagarMeV5OrderStatus.Falha ||
|
|
9099
|
-
data.charges.at(0).
|
|
9100
|
+
data.charges.at(0).status !== PagarMeV5OrderStatus.Pago ||
|
|
9100
9101
|
data.charges.at(0).last_transaction.status !== PagarMeV5PaymentStatus.Capturada) {
|
|
9101
9102
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
9102
9103
|
checkout,
|
|
@@ -9182,11 +9183,11 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9182
9183
|
});
|
|
9183
9184
|
}
|
|
9184
9185
|
}
|
|
9185
|
-
async getCardByToken(
|
|
9186
|
+
async getCardByToken(customerId, token) {
|
|
9186
9187
|
try {
|
|
9187
9188
|
const { data } = await axios({
|
|
9188
9189
|
method: 'GET',
|
|
9189
|
-
url: `${this.credentials.URL}/cards/${
|
|
9190
|
+
url: `${this.credentials.URL}/cards/${token}`,
|
|
9190
9191
|
data: {
|
|
9191
9192
|
api_key: this.credentials.API_KEY,
|
|
9192
9193
|
},
|
|
@@ -9194,7 +9195,7 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
9194
9195
|
return data;
|
|
9195
9196
|
}
|
|
9196
9197
|
catch (error) {
|
|
9197
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' +
|
|
9198
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + token, {
|
|
9198
9199
|
info: error.response.data,
|
|
9199
9200
|
});
|
|
9200
9201
|
}
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ export interface PaymentProviderCard<Card extends BaseCard = BaseCard> {
|
|
|
9
9
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
10
10
|
addCard(card: CardInfo): Promise<Card>;
|
|
11
11
|
getCardByToken(token: string): Promise<Card>;
|
|
12
|
+
getCardByToken(customerId: string, token: string): Promise<Card>;
|
|
12
13
|
createCardHash<T>(bu: BusinessUnitEnum, shop: Shops, card?: CardInfo): Promise<string | T>;
|
|
13
14
|
createTransaction(info: any): Promise<PaymentTransaction>;
|
|
14
15
|
}
|
|
@@ -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 | number;
|
|
6
6
|
checkoutId: string;
|
|
7
7
|
orderId?: string;
|
|
8
8
|
pagarMeOrderId?: string;
|
|
@@ -12,6 +12,7 @@ export declare class PagarmeV5CardAxiosAdapter implements PaymentProviderCard<Pa
|
|
|
12
12
|
pay(checkout: Checkout, card: PaymentCardInfo): Promise<Payment>;
|
|
13
13
|
addCard(card: CardInfo): Promise<PagarMeCard>;
|
|
14
14
|
createCardHash<PagarMeCardManualHash>(bu: BusinessUnitEnum, shop?: Shops): Promise<PagarMeCardManualHash>;
|
|
15
|
-
getCardByToken(
|
|
15
|
+
getCardByToken(token: string): Promise<PagarMeCard>;
|
|
16
|
+
getCardByToken(customerId: string, token: string): Promise<PagarMeCard>;
|
|
16
17
|
createTransaction(info: any): Promise<PaymentTransaction>;
|
|
17
18
|
}
|