@infrab4a/connect 4.20.0-beta.5 → 4.20.0-beta.7
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 +407 -404
- package/index.esm.js +404 -401
- package/package.json +1 -1
- package/src/domain/shopping/enums/index.d.ts +1 -0
- package/src/domain/shopping/enums/order-blocked.enum.d.ts +5 -0
- package/src/domain/shopping/models/order-blocked.d.ts +4 -6
- package/src/domain/shopping/services/index.d.ts +0 -4
- package/src/domain/shopping/types/pagarme-card-manual-hash.type.d.ts +6 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/types/index.d.ts +1 -0
- package/src/errors/types/pagarme-erros.type.d.ts +9 -0
- package/src/{domain/shopping/services/adyen-card-payment.service.d.ts → infra/adyen/adapters/adyen-card-payment-axios.adapter.d.ts} +5 -5
- package/src/infra/adyen/adapters/index.d.ts +1 -0
- package/src/infra/adyen/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +2 -2
- package/src/infra/index.d.ts +2 -0
- package/src/infra/pagarme/adapters/index.d.ts +3 -0
- package/src/infra/pagarme/adapters/pagarme-bank-slip-payment-axios.adapter.d.ts +12 -0
- package/src/{domain/shopping/services/pagarme-card-payment.service.d.ts → infra/pagarme/adapters/pagarme-card-payment-axios.adapter.d.ts} +6 -6
- package/src/infra/pagarme/adapters/pagarme-pix-payment-axios.adapter.d.ts +11 -0
- package/src/infra/pagarme/index.d.ts +1 -0
- package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +0 -12
- package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +0 -11
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.ts.d.ts +0 -9
package/index.cjs.js
CHANGED
|
@@ -33,6 +33,13 @@ exports.BusinessUnitEnum = void 0;
|
|
|
33
33
|
BusinessUnitEnum[BusinessUnitEnum["SHOP"] = 2] = "SHOP";
|
|
34
34
|
})(exports.BusinessUnitEnum || (exports.BusinessUnitEnum = {}));
|
|
35
35
|
|
|
36
|
+
exports.OrderBlockedType = void 0;
|
|
37
|
+
(function (OrderBlockedType) {
|
|
38
|
+
OrderBlockedType["Checkout"] = "Checkout";
|
|
39
|
+
OrderBlockedType["Card"] = "Card";
|
|
40
|
+
OrderBlockedType["Boleto"] = "Boleto";
|
|
41
|
+
})(exports.OrderBlockedType || (exports.OrderBlockedType = {}));
|
|
42
|
+
|
|
36
43
|
exports.PagarmePaymentStatus = void 0;
|
|
37
44
|
(function (PagarmePaymentStatus) {
|
|
38
45
|
PagarmePaymentStatus["Em processamento"] = "processing";
|
|
@@ -2415,82 +2422,6 @@ class StockOutError extends BusinessError {
|
|
|
2415
2422
|
}
|
|
2416
2423
|
}
|
|
2417
2424
|
|
|
2418
|
-
class AdyenCardService {
|
|
2419
|
-
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
2420
|
-
this.credentials = credentials;
|
|
2421
|
-
this.paymentRepository = paymentRepository;
|
|
2422
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2423
|
-
}
|
|
2424
|
-
async pay(checkout, card) {
|
|
2425
|
-
try {
|
|
2426
|
-
const result = await axios__default["default"]({
|
|
2427
|
-
method: 'POST',
|
|
2428
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2429
|
-
headers: {
|
|
2430
|
-
'x-api-key': this.credentials.API_KEY,
|
|
2431
|
-
'content-type': 'application/json',
|
|
2432
|
-
},
|
|
2433
|
-
data: this.createCardPayment(checkout, card),
|
|
2434
|
-
});
|
|
2435
|
-
if (result.data.resultCode !== 'Authorised') {
|
|
2436
|
-
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2437
|
-
return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
|
|
2438
|
-
checkoutId: checkout.id,
|
|
2439
|
-
userEmail: checkout.user.email,
|
|
2440
|
-
info: result.data,
|
|
2441
|
-
}));
|
|
2442
|
-
}
|
|
2443
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2444
|
-
createdAt: new Date(),
|
|
2445
|
-
updatedAt: new Date(),
|
|
2446
|
-
userId: checkout.user.id,
|
|
2447
|
-
checkoutId: checkout.id,
|
|
2448
|
-
totalPrice: checkout.totalPrice,
|
|
2449
|
-
paymentProvider: 'adyen',
|
|
2450
|
-
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2451
|
-
}));
|
|
2452
|
-
return payment;
|
|
2453
|
-
}
|
|
2454
|
-
catch (error) {
|
|
2455
|
-
throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
|
|
2456
|
-
checkoutId: checkout.id,
|
|
2457
|
-
userEmail: checkout.user.email,
|
|
2458
|
-
info: error.message,
|
|
2459
|
-
});
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
createCardPayment(checkout, card) {
|
|
2463
|
-
return {
|
|
2464
|
-
amount: {
|
|
2465
|
-
currency: 'BRL',
|
|
2466
|
-
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2467
|
-
},
|
|
2468
|
-
paymentMethod: {
|
|
2469
|
-
type: 'scheme',
|
|
2470
|
-
storedPaymentMethodId: card.cardId,
|
|
2471
|
-
},
|
|
2472
|
-
reference: checkout.id,
|
|
2473
|
-
shopperInteraction: 'Ecommerce',
|
|
2474
|
-
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2475
|
-
shopperReference: checkout.user.id,
|
|
2476
|
-
recurringProcessingModel: 'CardOnFile',
|
|
2477
|
-
returnUrl: this.credentials.URL_POSTBACK,
|
|
2478
|
-
installments: {
|
|
2479
|
-
value: card.installments,
|
|
2480
|
-
},
|
|
2481
|
-
};
|
|
2482
|
-
}
|
|
2483
|
-
addCard() {
|
|
2484
|
-
throw new Error('Method not implemented.');
|
|
2485
|
-
}
|
|
2486
|
-
getCardByToken(token) {
|
|
2487
|
-
throw new Error('Method not implemented.');
|
|
2488
|
-
}
|
|
2489
|
-
createTransaction(info) {
|
|
2490
|
-
throw new Error('Method not implemented.');
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
|
|
2494
2425
|
class AntifraudBankSlipService {
|
|
2495
2426
|
constructor(orderBlockedRepository) {
|
|
2496
2427
|
this.orderBlockedRepository = orderBlockedRepository;
|
|
@@ -2548,8 +2479,8 @@ class AntifraudCardService {
|
|
|
2548
2479
|
}
|
|
2549
2480
|
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2550
2481
|
var _a, _b, _c, _d;
|
|
2551
|
-
const day = `${dateFns.format(new Date(), '
|
|
2552
|
-
const endOfDay = `${dateFns.format(new Date(), '
|
|
2482
|
+
const day = `${dateFns.format(new Date(), 'yyyy-MM-DD')}T00:00:00`;
|
|
2483
|
+
const endOfDay = `${dateFns.format(new Date(), 'yyyy-MM-DD')}T23:59:59`;
|
|
2553
2484
|
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2554
2485
|
.find({
|
|
2555
2486
|
filters: {
|
|
@@ -2729,329 +2660,29 @@ class GlampointsPaymentService {
|
|
|
2729
2660
|
}
|
|
2730
2661
|
}
|
|
2731
2662
|
|
|
2732
|
-
class
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
try {
|
|
2739
|
-
const result = await axios__default["default"]({
|
|
2740
|
-
method: 'POST',
|
|
2741
|
-
url: `${this.credentials.URL}/transactions`,
|
|
2742
|
-
data: this.createBoletoPayment(checkout),
|
|
2743
|
-
});
|
|
2744
|
-
if (result.data.status !== exports.PagarmePaymentStatus['Em processamento']) {
|
|
2745
|
-
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
2746
|
-
checkoutId: checkout.id,
|
|
2747
|
-
userEmail: checkout.user.email,
|
|
2748
|
-
info: result.data,
|
|
2749
|
-
}));
|
|
2750
|
-
}
|
|
2751
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2752
|
-
createdAt: new Date(),
|
|
2753
|
-
updatedAt: new Date(),
|
|
2754
|
-
userId: checkout.user.id,
|
|
2755
|
-
checkoutId: checkout.id,
|
|
2756
|
-
totalPrice: checkout.totalPrice,
|
|
2757
|
-
paymentProvider: 'pagarMe',
|
|
2758
|
-
transaction: result.data,
|
|
2759
|
-
}));
|
|
2760
|
-
return payment;
|
|
2761
|
-
}
|
|
2762
|
-
catch (error) {
|
|
2763
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
2764
|
-
checkoutId: checkout.id,
|
|
2765
|
-
userEmail: checkout.user.email,
|
|
2766
|
-
info: error.response.data,
|
|
2767
|
-
});
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
async getBoletoTransaction(paymentId) {
|
|
2771
|
-
try {
|
|
2772
|
-
const { data } = await axios__default["default"]({
|
|
2773
|
-
method: 'GET',
|
|
2774
|
-
url: `${this.credentials.URL}/transactions/${paymentId}`,
|
|
2775
|
-
data: {
|
|
2776
|
-
api_key: this.credentials.API_KEY,
|
|
2777
|
-
},
|
|
2778
|
-
});
|
|
2779
|
-
return data;
|
|
2663
|
+
class RoundProductPricesHelper {
|
|
2664
|
+
static roundProductPrices(product) {
|
|
2665
|
+
product.price.price = Number(product.price.price.toFixed(2));
|
|
2666
|
+
product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
|
|
2667
|
+
if (product.price.subscriberPrice) {
|
|
2668
|
+
product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
|
|
2780
2669
|
}
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
paymentId,
|
|
2784
|
-
info: error.response.data,
|
|
2785
|
-
});
|
|
2670
|
+
if (product instanceof LineItem && product.pricePaid) {
|
|
2671
|
+
product.pricePaid = Number(product.pricePaid.toFixed(2));
|
|
2786
2672
|
}
|
|
2787
|
-
|
|
2788
|
-
createBoletoPayment(checkout) {
|
|
2789
|
-
return {
|
|
2790
|
-
api_key: this.credentials.API_KEY,
|
|
2791
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2792
|
-
boleto_rules: ['strict_expiration_date'],
|
|
2793
|
-
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
2794
|
-
boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
2795
|
-
payment_method: 'boleto',
|
|
2796
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
2797
|
-
customer: {
|
|
2798
|
-
external_id: checkout.user.id,
|
|
2799
|
-
type: 'individual',
|
|
2800
|
-
country: 'br',
|
|
2801
|
-
name: checkout.user.displayName,
|
|
2802
|
-
documents: [
|
|
2803
|
-
{
|
|
2804
|
-
type: 'cpf',
|
|
2805
|
-
number: checkout.user.cpf,
|
|
2806
|
-
},
|
|
2807
|
-
],
|
|
2808
|
-
},
|
|
2809
|
-
};
|
|
2673
|
+
return product;
|
|
2810
2674
|
}
|
|
2811
2675
|
}
|
|
2812
2676
|
|
|
2813
|
-
class
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
this.paymentRepository = paymentRepository;
|
|
2817
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2818
|
-
}
|
|
2819
|
-
async pay(checkout, card) {
|
|
2820
|
-
var _a;
|
|
2821
|
-
try {
|
|
2822
|
-
const result = await axios__default["default"]({
|
|
2823
|
-
method: 'POST',
|
|
2824
|
-
url: `${this.credentials.URL}/transactions`,
|
|
2825
|
-
data: this.createCardPayment(checkout, card),
|
|
2826
|
-
});
|
|
2827
|
-
if (result.data.status !== exports.PagarmePaymentStatus.Pago) {
|
|
2828
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2829
|
-
return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
|
|
2830
|
-
checkoutId: checkout.id,
|
|
2831
|
-
userEmail: checkout.user.email,
|
|
2832
|
-
info: result.data,
|
|
2833
|
-
}));
|
|
2834
|
-
}
|
|
2835
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2836
|
-
createdAt: new Date(),
|
|
2837
|
-
updatedAt: new Date(),
|
|
2838
|
-
userId: checkout.user.id,
|
|
2839
|
-
checkoutId: checkout.id,
|
|
2840
|
-
totalPrice: checkout.totalPrice,
|
|
2841
|
-
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
2842
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
2843
|
-
}));
|
|
2844
|
-
return payment;
|
|
2845
|
-
}
|
|
2846
|
-
catch (error) {
|
|
2847
|
-
throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
|
|
2848
|
-
checkoutId: checkout.id,
|
|
2849
|
-
userEmail: checkout.user.email,
|
|
2850
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
2851
|
-
});
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
async addCard(card) {
|
|
2855
|
-
try {
|
|
2856
|
-
const { data } = await axios__default["default"]({
|
|
2857
|
-
method: 'POST',
|
|
2858
|
-
url: `${this.credentials.URL}/cards`,
|
|
2859
|
-
data: {
|
|
2860
|
-
api_key: this.credentials.API_KEY,
|
|
2861
|
-
card_number: card.number,
|
|
2862
|
-
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
2863
|
-
card_holder_name: card.name,
|
|
2864
|
-
card_cvv: card.cvv,
|
|
2865
|
-
},
|
|
2866
|
-
});
|
|
2867
|
-
return data;
|
|
2868
|
-
}
|
|
2869
|
-
catch (error) {
|
|
2870
|
-
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
2871
|
-
info: error.response.data,
|
|
2872
|
-
});
|
|
2873
|
-
}
|
|
2677
|
+
class LogDocument extends BaseModel {
|
|
2678
|
+
static get identifiersFields() {
|
|
2679
|
+
return ['id'];
|
|
2874
2680
|
}
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
url: `${this.credentials.URL}/transactions/card_hash_key`,
|
|
2881
|
-
data: {
|
|
2882
|
-
api_key: key,
|
|
2883
|
-
},
|
|
2884
|
-
});
|
|
2885
|
-
return data;
|
|
2886
|
-
}
|
|
2887
|
-
catch (error) {
|
|
2888
|
-
throw new BusinessError('Houve uma falha gerar o hash', {
|
|
2889
|
-
info: error.response.data,
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
|
-
}
|
|
2893
|
-
async getCardByToken(id) {
|
|
2894
|
-
try {
|
|
2895
|
-
const { data } = await axios__default["default"]({
|
|
2896
|
-
method: 'POST',
|
|
2897
|
-
url: `${this.credentials.URL}/cards/${id}`,
|
|
2898
|
-
data: {
|
|
2899
|
-
api_key: this.credentials.API_KEY,
|
|
2900
|
-
},
|
|
2901
|
-
});
|
|
2902
|
-
return data;
|
|
2903
|
-
}
|
|
2904
|
-
catch (error) {
|
|
2905
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
|
|
2906
|
-
info: error.response.data,
|
|
2907
|
-
});
|
|
2908
|
-
}
|
|
2909
|
-
}
|
|
2910
|
-
async createTransaction(info) {
|
|
2911
|
-
try {
|
|
2912
|
-
const { data } = await axios__default["default"]({
|
|
2913
|
-
method: 'POST',
|
|
2914
|
-
url: `${this.credentials.URL}/transactions`,
|
|
2915
|
-
data: Object.assign(Object.assign({}, info), { api_key: this.credentials.API_KEY }),
|
|
2916
|
-
});
|
|
2917
|
-
return data;
|
|
2918
|
-
}
|
|
2919
|
-
catch (error) {
|
|
2920
|
-
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
2921
|
-
info: error.response.data,
|
|
2922
|
-
});
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
createCardPayment(checkout, card) {
|
|
2926
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2927
|
-
return {
|
|
2928
|
-
api_key: this.credentials.API_KEY,
|
|
2929
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2930
|
-
card_id: card.cardId,
|
|
2931
|
-
payment_method: 'credit_card',
|
|
2932
|
-
installments: card.installments,
|
|
2933
|
-
soft_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : "Men's Market",
|
|
2934
|
-
customer: {
|
|
2935
|
-
external_id: checkout.user.id,
|
|
2936
|
-
name: checkout.user.displayName,
|
|
2937
|
-
type: 'individual',
|
|
2938
|
-
country: 'br',
|
|
2939
|
-
email: checkout.user.email,
|
|
2940
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2941
|
-
documents: [
|
|
2942
|
-
{
|
|
2943
|
-
type: 'cpf',
|
|
2944
|
-
number: checkout.user.cpf,
|
|
2945
|
-
},
|
|
2946
|
-
],
|
|
2947
|
-
},
|
|
2948
|
-
billing: {
|
|
2949
|
-
name: checkout.user.displayName,
|
|
2950
|
-
address: {
|
|
2951
|
-
country: 'br',
|
|
2952
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
2953
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
2954
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
2955
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
2956
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
2957
|
-
zipcode: checkout.billingAddress
|
|
2958
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
2959
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
2960
|
-
},
|
|
2961
|
-
},
|
|
2962
|
-
items: checkout.lineItems.map((item) => {
|
|
2963
|
-
return {
|
|
2964
|
-
id: item.id,
|
|
2965
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
2966
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
2967
|
-
quantity: item.quantity,
|
|
2968
|
-
tangible: true,
|
|
2969
|
-
};
|
|
2970
|
-
}),
|
|
2971
|
-
};
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
class PagarmePixService {
|
|
2976
|
-
constructor(credentials, paymentRepository) {
|
|
2977
|
-
this.credentials = credentials;
|
|
2978
|
-
this.paymentRepository = paymentRepository;
|
|
2979
|
-
}
|
|
2980
|
-
async pay(checkout) {
|
|
2981
|
-
var _a;
|
|
2982
|
-
try {
|
|
2983
|
-
const result = await axios__default["default"]({
|
|
2984
|
-
method: 'POST',
|
|
2985
|
-
url: `${this.credentials.URL}/transactions`,
|
|
2986
|
-
data: this.createPixPayment(checkout),
|
|
2987
|
-
});
|
|
2988
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2989
|
-
createdAt: new Date(),
|
|
2990
|
-
updatedAt: new Date(),
|
|
2991
|
-
userId: checkout.user.id,
|
|
2992
|
-
checkoutId: checkout.id,
|
|
2993
|
-
totalPrice: checkout.totalPrice,
|
|
2994
|
-
paymentProvider: 'pagarMe',
|
|
2995
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
2996
|
-
}));
|
|
2997
|
-
return payment;
|
|
2998
|
-
}
|
|
2999
|
-
catch (error) {
|
|
3000
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
3001
|
-
checkoutId: checkout.id,
|
|
3002
|
-
userEmail: checkout.user.email,
|
|
3003
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
|
-
}
|
|
3007
|
-
createPixPayment(checkout) {
|
|
3008
|
-
return {
|
|
3009
|
-
payment_method: 'pix',
|
|
3010
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
3011
|
-
api_key: this.credentials.API_KEY,
|
|
3012
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
3013
|
-
pix_expiration_date: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
3014
|
-
customer: {
|
|
3015
|
-
external_id: checkout.user.id,
|
|
3016
|
-
type: 'individual',
|
|
3017
|
-
country: 'br',
|
|
3018
|
-
name: checkout.user.displayName,
|
|
3019
|
-
email: checkout.user.email.trim(),
|
|
3020
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
3021
|
-
documents: [
|
|
3022
|
-
{
|
|
3023
|
-
type: 'cpf',
|
|
3024
|
-
number: checkout.user.cpf,
|
|
3025
|
-
},
|
|
3026
|
-
],
|
|
3027
|
-
},
|
|
3028
|
-
};
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
|
|
3032
|
-
class RoundProductPricesHelper {
|
|
3033
|
-
static roundProductPrices(product) {
|
|
3034
|
-
product.price.price = Number(product.price.price.toFixed(2));
|
|
3035
|
-
product.price.fullPrice = Number(product.price.fullPrice.toFixed(2));
|
|
3036
|
-
if (product.price.subscriberPrice) {
|
|
3037
|
-
product.price.subscriberPrice = Number(product.price.subscriberPrice.toFixed(2));
|
|
3038
|
-
}
|
|
3039
|
-
if (product instanceof LineItem && product.pricePaid) {
|
|
3040
|
-
product.pricePaid = Number(product.pricePaid.toFixed(2));
|
|
3041
|
-
}
|
|
3042
|
-
return product;
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
|
|
3046
|
-
class LogDocument extends BaseModel {
|
|
3047
|
-
static get identifiersFields() {
|
|
3048
|
-
return ['id'];
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
|
|
3052
|
-
class Sequence extends BaseModel {
|
|
3053
|
-
static get identifiersFields() {
|
|
3054
|
-
return ['id'];
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
class Sequence extends BaseModel {
|
|
2684
|
+
static get identifiersFields() {
|
|
2685
|
+
return ['id'];
|
|
3055
2686
|
}
|
|
3056
2687
|
}
|
|
3057
2688
|
|
|
@@ -3193,6 +2824,82 @@ class ShopSettings extends BaseModel {
|
|
|
3193
2824
|
}
|
|
3194
2825
|
}
|
|
3195
2826
|
|
|
2827
|
+
class AdyenCardAxiosAdapter {
|
|
2828
|
+
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
2829
|
+
this.credentials = credentials;
|
|
2830
|
+
this.paymentRepository = paymentRepository;
|
|
2831
|
+
this.orderBlockedRepository = orderBlockedRepository;
|
|
2832
|
+
}
|
|
2833
|
+
async pay(checkout, card) {
|
|
2834
|
+
try {
|
|
2835
|
+
const result = await axios__default["default"]({
|
|
2836
|
+
method: 'POST',
|
|
2837
|
+
url: this.credentials.URL_TRANSACTION,
|
|
2838
|
+
headers: {
|
|
2839
|
+
'x-api-key': this.credentials.API_KEY,
|
|
2840
|
+
'content-type': 'application/json',
|
|
2841
|
+
},
|
|
2842
|
+
data: this.createCardPayment(checkout, card),
|
|
2843
|
+
});
|
|
2844
|
+
if (result.data.resultCode !== 'Authorised') {
|
|
2845
|
+
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2846
|
+
return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
|
|
2847
|
+
checkoutId: checkout.id,
|
|
2848
|
+
userEmail: checkout.user.email,
|
|
2849
|
+
info: result.data,
|
|
2850
|
+
}));
|
|
2851
|
+
}
|
|
2852
|
+
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2853
|
+
createdAt: new Date(),
|
|
2854
|
+
updatedAt: new Date(),
|
|
2855
|
+
userId: checkout.user.id,
|
|
2856
|
+
checkoutId: checkout.id,
|
|
2857
|
+
totalPrice: checkout.totalPrice,
|
|
2858
|
+
paymentProvider: 'adyen',
|
|
2859
|
+
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2860
|
+
}));
|
|
2861
|
+
return payment;
|
|
2862
|
+
}
|
|
2863
|
+
catch (error) {
|
|
2864
|
+
throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
|
|
2865
|
+
checkoutId: checkout.id,
|
|
2866
|
+
userEmail: checkout.user.email,
|
|
2867
|
+
info: error.message,
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
createCardPayment(checkout, card) {
|
|
2872
|
+
return {
|
|
2873
|
+
amount: {
|
|
2874
|
+
currency: 'BRL',
|
|
2875
|
+
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2876
|
+
},
|
|
2877
|
+
paymentMethod: {
|
|
2878
|
+
type: 'scheme',
|
|
2879
|
+
storedPaymentMethodId: card.cardId,
|
|
2880
|
+
},
|
|
2881
|
+
reference: checkout.id,
|
|
2882
|
+
shopperInteraction: 'Ecommerce',
|
|
2883
|
+
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2884
|
+
shopperReference: checkout.user.id,
|
|
2885
|
+
recurringProcessingModel: 'CardOnFile',
|
|
2886
|
+
returnUrl: this.credentials.URL_POSTBACK,
|
|
2887
|
+
installments: {
|
|
2888
|
+
value: card.installments,
|
|
2889
|
+
},
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2892
|
+
addCard() {
|
|
2893
|
+
throw new Error('Method not implemented.');
|
|
2894
|
+
}
|
|
2895
|
+
getCardByToken(token) {
|
|
2896
|
+
throw new Error('Method not implemented.');
|
|
2897
|
+
}
|
|
2898
|
+
createTransaction(info) {
|
|
2899
|
+
throw new Error('Method not implemented.');
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
|
|
3196
2903
|
class AxiosAdapter {
|
|
3197
2904
|
constructor(config) {
|
|
3198
2905
|
this.config = config;
|
|
@@ -4342,11 +4049,7 @@ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
4342
4049
|
limiteRange,
|
|
4343
4050
|
type,
|
|
4344
4051
|
card,
|
|
4345
|
-
checkout
|
|
4346
|
-
id: checkout.id,
|
|
4347
|
-
shop: checkout.shop,
|
|
4348
|
-
total: checkout.totalPrice,
|
|
4349
|
-
},
|
|
4052
|
+
checkout,
|
|
4350
4053
|
date: new Date(),
|
|
4351
4054
|
}));
|
|
4352
4055
|
}
|
|
@@ -7245,6 +6948,306 @@ tslib.__decorate([
|
|
|
7245
6948
|
tslib.__metadata("design:returntype", Promise)
|
|
7246
6949
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
7247
6950
|
|
|
6951
|
+
class PagarmeBankSlipAxiosAdapter {
|
|
6952
|
+
constructor(credentials, paymentRepository) {
|
|
6953
|
+
this.credentials = credentials;
|
|
6954
|
+
this.paymentRepository = paymentRepository;
|
|
6955
|
+
}
|
|
6956
|
+
async pay(checkout) {
|
|
6957
|
+
try {
|
|
6958
|
+
const result = await axios__default["default"]({
|
|
6959
|
+
method: 'POST',
|
|
6960
|
+
url: `${this.credentials.URL}/transactions`,
|
|
6961
|
+
data: this.createBoletoPayment(checkout),
|
|
6962
|
+
});
|
|
6963
|
+
if (result.data.status !== exports.PagarmePaymentStatus['Em processamento']) {
|
|
6964
|
+
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
6965
|
+
checkoutId: checkout.id,
|
|
6966
|
+
userEmail: checkout.user.email,
|
|
6967
|
+
info: result.data,
|
|
6968
|
+
}));
|
|
6969
|
+
}
|
|
6970
|
+
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
6971
|
+
createdAt: new Date(),
|
|
6972
|
+
updatedAt: new Date(),
|
|
6973
|
+
userId: checkout.user.id,
|
|
6974
|
+
checkoutId: checkout.id,
|
|
6975
|
+
totalPrice: checkout.totalPrice,
|
|
6976
|
+
paymentProvider: 'pagarMe',
|
|
6977
|
+
transaction: result.data,
|
|
6978
|
+
}));
|
|
6979
|
+
return payment;
|
|
6980
|
+
}
|
|
6981
|
+
catch (error) {
|
|
6982
|
+
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
6983
|
+
checkoutId: checkout.id,
|
|
6984
|
+
userEmail: checkout.user.email,
|
|
6985
|
+
info: error.response.data,
|
|
6986
|
+
});
|
|
6987
|
+
}
|
|
6988
|
+
}
|
|
6989
|
+
async getBoletoTransaction(paymentId) {
|
|
6990
|
+
try {
|
|
6991
|
+
const { data } = await axios__default["default"]({
|
|
6992
|
+
method: 'GET',
|
|
6993
|
+
url: `${this.credentials.URL}/transactions/${paymentId}`,
|
|
6994
|
+
data: {
|
|
6995
|
+
api_key: this.credentials.API_KEY,
|
|
6996
|
+
},
|
|
6997
|
+
});
|
|
6998
|
+
return data;
|
|
6999
|
+
}
|
|
7000
|
+
catch (error) {
|
|
7001
|
+
throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
|
|
7002
|
+
paymentId,
|
|
7003
|
+
info: error.response.data,
|
|
7004
|
+
});
|
|
7005
|
+
}
|
|
7006
|
+
}
|
|
7007
|
+
createBoletoPayment(checkout) {
|
|
7008
|
+
return {
|
|
7009
|
+
api_key: this.credentials.API_KEY,
|
|
7010
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
7011
|
+
boleto_rules: ['strict_expiration_date'],
|
|
7012
|
+
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
7013
|
+
boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
7014
|
+
payment_method: 'boleto',
|
|
7015
|
+
postback_url: this.credentials.URL_POSTBACK,
|
|
7016
|
+
customer: {
|
|
7017
|
+
external_id: checkout.user.id,
|
|
7018
|
+
type: 'individual',
|
|
7019
|
+
country: 'br',
|
|
7020
|
+
name: checkout.user.displayName,
|
|
7021
|
+
documents: [
|
|
7022
|
+
{
|
|
7023
|
+
type: 'cpf',
|
|
7024
|
+
number: checkout.user.cpf,
|
|
7025
|
+
},
|
|
7026
|
+
],
|
|
7027
|
+
},
|
|
7028
|
+
};
|
|
7029
|
+
}
|
|
7030
|
+
}
|
|
7031
|
+
|
|
7032
|
+
class PagarmeCardAxiosAdapter {
|
|
7033
|
+
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
7034
|
+
this.credentials = credentials;
|
|
7035
|
+
this.paymentRepository = paymentRepository;
|
|
7036
|
+
this.orderBlockedRepository = orderBlockedRepository;
|
|
7037
|
+
}
|
|
7038
|
+
async pay(checkout, card) {
|
|
7039
|
+
var _a;
|
|
7040
|
+
try {
|
|
7041
|
+
const result = await axios__default["default"]({
|
|
7042
|
+
method: 'POST',
|
|
7043
|
+
url: `${this.credentials.URL}/transactions`,
|
|
7044
|
+
data: this.createCardPayment(checkout, card),
|
|
7045
|
+
});
|
|
7046
|
+
if (result.data.status !== exports.PagarmePaymentStatus.Pago) {
|
|
7047
|
+
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
7048
|
+
return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
|
|
7049
|
+
checkoutId: checkout.id,
|
|
7050
|
+
userEmail: checkout.user.email,
|
|
7051
|
+
info: result.data,
|
|
7052
|
+
}));
|
|
7053
|
+
}
|
|
7054
|
+
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7055
|
+
createdAt: new Date(),
|
|
7056
|
+
updatedAt: new Date(),
|
|
7057
|
+
userId: checkout.user.id,
|
|
7058
|
+
checkoutId: checkout.id,
|
|
7059
|
+
totalPrice: checkout.totalPrice,
|
|
7060
|
+
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
7061
|
+
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7062
|
+
}));
|
|
7063
|
+
return payment;
|
|
7064
|
+
}
|
|
7065
|
+
catch (error) {
|
|
7066
|
+
throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
|
|
7067
|
+
checkoutId: checkout.id,
|
|
7068
|
+
userEmail: checkout.user.email,
|
|
7069
|
+
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7070
|
+
});
|
|
7071
|
+
}
|
|
7072
|
+
}
|
|
7073
|
+
async addCard(card) {
|
|
7074
|
+
try {
|
|
7075
|
+
const { data } = await axios__default["default"]({
|
|
7076
|
+
method: 'POST',
|
|
7077
|
+
url: `${this.credentials.URL}/cards`,
|
|
7078
|
+
data: {
|
|
7079
|
+
api_key: this.credentials.API_KEY,
|
|
7080
|
+
card_number: card.number,
|
|
7081
|
+
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
7082
|
+
card_holder_name: card.name,
|
|
7083
|
+
card_cvv: card.cvv,
|
|
7084
|
+
},
|
|
7085
|
+
});
|
|
7086
|
+
return data;
|
|
7087
|
+
}
|
|
7088
|
+
catch (error) {
|
|
7089
|
+
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
7090
|
+
info: error.response.data,
|
|
7091
|
+
});
|
|
7092
|
+
}
|
|
7093
|
+
}
|
|
7094
|
+
async createCardHash(bu) {
|
|
7095
|
+
const key = bu === exports.BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
|
|
7096
|
+
try {
|
|
7097
|
+
const { data } = await axios__default["default"]({
|
|
7098
|
+
method: 'GET',
|
|
7099
|
+
url: `${this.credentials.URL}/transactions/card_hash_key`,
|
|
7100
|
+
data: {
|
|
7101
|
+
api_key: key,
|
|
7102
|
+
},
|
|
7103
|
+
});
|
|
7104
|
+
return data;
|
|
7105
|
+
}
|
|
7106
|
+
catch (error) {
|
|
7107
|
+
throw new BusinessError('Houve uma falha gerar o hash', {
|
|
7108
|
+
info: error.response.data,
|
|
7109
|
+
});
|
|
7110
|
+
}
|
|
7111
|
+
}
|
|
7112
|
+
async getCardByToken(id) {
|
|
7113
|
+
try {
|
|
7114
|
+
const { data } = await axios__default["default"]({
|
|
7115
|
+
method: 'POST',
|
|
7116
|
+
url: `${this.credentials.URL}/cards/${id}`,
|
|
7117
|
+
data: {
|
|
7118
|
+
api_key: this.credentials.API_KEY,
|
|
7119
|
+
},
|
|
7120
|
+
});
|
|
7121
|
+
return data;
|
|
7122
|
+
}
|
|
7123
|
+
catch (error) {
|
|
7124
|
+
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
|
|
7125
|
+
info: error.response.data,
|
|
7126
|
+
});
|
|
7127
|
+
}
|
|
7128
|
+
}
|
|
7129
|
+
async createTransaction(info) {
|
|
7130
|
+
try {
|
|
7131
|
+
const { data } = await axios__default["default"]({
|
|
7132
|
+
method: 'POST',
|
|
7133
|
+
url: `${this.credentials.URL}/transactions`,
|
|
7134
|
+
data: Object.assign(Object.assign({}, info), { api_key: this.credentials.API_KEY }),
|
|
7135
|
+
});
|
|
7136
|
+
return data;
|
|
7137
|
+
}
|
|
7138
|
+
catch (error) {
|
|
7139
|
+
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
7140
|
+
info: error.response.data,
|
|
7141
|
+
});
|
|
7142
|
+
}
|
|
7143
|
+
}
|
|
7144
|
+
createCardPayment(checkout, card) {
|
|
7145
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7146
|
+
return {
|
|
7147
|
+
api_key: this.credentials.API_KEY,
|
|
7148
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
7149
|
+
card_id: card.cardId,
|
|
7150
|
+
payment_method: 'credit_card',
|
|
7151
|
+
installments: card.installments,
|
|
7152
|
+
soft_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : "Men's Market",
|
|
7153
|
+
customer: {
|
|
7154
|
+
external_id: checkout.user.id,
|
|
7155
|
+
name: checkout.user.displayName,
|
|
7156
|
+
type: 'individual',
|
|
7157
|
+
country: 'br',
|
|
7158
|
+
email: checkout.user.email,
|
|
7159
|
+
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7160
|
+
documents: [
|
|
7161
|
+
{
|
|
7162
|
+
type: 'cpf',
|
|
7163
|
+
number: checkout.user.cpf,
|
|
7164
|
+
},
|
|
7165
|
+
],
|
|
7166
|
+
},
|
|
7167
|
+
billing: {
|
|
7168
|
+
name: checkout.user.displayName,
|
|
7169
|
+
address: {
|
|
7170
|
+
country: 'br',
|
|
7171
|
+
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
7172
|
+
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
7173
|
+
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
7174
|
+
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
7175
|
+
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
7176
|
+
zipcode: checkout.billingAddress
|
|
7177
|
+
? checkout.billingAddress.zip.replace('-', '')
|
|
7178
|
+
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
7179
|
+
},
|
|
7180
|
+
},
|
|
7181
|
+
items: checkout.lineItems.map((item) => {
|
|
7182
|
+
return {
|
|
7183
|
+
id: item.id,
|
|
7184
|
+
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
7185
|
+
unit_price: Math.floor(item.pricePaid * 100),
|
|
7186
|
+
quantity: item.quantity,
|
|
7187
|
+
tangible: true,
|
|
7188
|
+
};
|
|
7189
|
+
}),
|
|
7190
|
+
};
|
|
7191
|
+
}
|
|
7192
|
+
}
|
|
7193
|
+
|
|
7194
|
+
class PagarmePixAxiosAdapter {
|
|
7195
|
+
constructor(credentials, paymentRepository) {
|
|
7196
|
+
this.credentials = credentials;
|
|
7197
|
+
this.paymentRepository = paymentRepository;
|
|
7198
|
+
}
|
|
7199
|
+
async pay(checkout) {
|
|
7200
|
+
var _a;
|
|
7201
|
+
try {
|
|
7202
|
+
const result = await axios__default["default"]({
|
|
7203
|
+
method: 'POST',
|
|
7204
|
+
url: `${this.credentials.URL}/transactions`,
|
|
7205
|
+
data: this.createPixPayment(checkout),
|
|
7206
|
+
});
|
|
7207
|
+
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7208
|
+
createdAt: new Date(),
|
|
7209
|
+
updatedAt: new Date(),
|
|
7210
|
+
userId: checkout.user.id,
|
|
7211
|
+
checkoutId: checkout.id,
|
|
7212
|
+
totalPrice: checkout.totalPrice,
|
|
7213
|
+
paymentProvider: 'pagarMe',
|
|
7214
|
+
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7215
|
+
}));
|
|
7216
|
+
return payment;
|
|
7217
|
+
}
|
|
7218
|
+
catch (error) {
|
|
7219
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
7220
|
+
checkoutId: checkout.id,
|
|
7221
|
+
userEmail: checkout.user.email,
|
|
7222
|
+
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7223
|
+
});
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
createPixPayment(checkout) {
|
|
7227
|
+
return {
|
|
7228
|
+
payment_method: 'pix',
|
|
7229
|
+
amount: Math.floor(checkout.totalPrice * 100),
|
|
7230
|
+
api_key: this.credentials.API_KEY,
|
|
7231
|
+
postback_url: this.credentials.URL_POSTBACK,
|
|
7232
|
+
pix_expiration_date: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
7233
|
+
customer: {
|
|
7234
|
+
external_id: checkout.user.id,
|
|
7235
|
+
type: 'individual',
|
|
7236
|
+
country: 'br',
|
|
7237
|
+
name: checkout.user.displayName,
|
|
7238
|
+
email: checkout.user.email.trim(),
|
|
7239
|
+
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7240
|
+
documents: [
|
|
7241
|
+
{
|
|
7242
|
+
type: 'cpf',
|
|
7243
|
+
number: checkout.user.cpf,
|
|
7244
|
+
},
|
|
7245
|
+
],
|
|
7246
|
+
},
|
|
7247
|
+
};
|
|
7248
|
+
}
|
|
7249
|
+
}
|
|
7250
|
+
|
|
7248
7251
|
class VertexAxiosAdapter {
|
|
7249
7252
|
constructor(config) {
|
|
7250
7253
|
this.config = config;
|
|
@@ -7519,7 +7522,7 @@ Object.defineProperty(exports, 'unset', {
|
|
|
7519
7522
|
get: function () { return lodash.unset; }
|
|
7520
7523
|
});
|
|
7521
7524
|
exports.Address = Address;
|
|
7522
|
-
exports.
|
|
7525
|
+
exports.AdyenCardAxiosAdapter = AdyenCardAxiosAdapter;
|
|
7523
7526
|
exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
|
|
7524
7527
|
exports.AntifraudBankSlipService = AntifraudBankSlipService;
|
|
7525
7528
|
exports.AntifraudCardService = AntifraudCardService;
|
|
@@ -7592,10 +7595,10 @@ exports.Order = Order;
|
|
|
7592
7595
|
exports.OrderBlocked = OrderBlocked;
|
|
7593
7596
|
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
7594
7597
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
7595
|
-
exports.
|
|
7596
|
-
exports.
|
|
7598
|
+
exports.PagarmeBankSlipAxiosAdapter = PagarmeBankSlipAxiosAdapter;
|
|
7599
|
+
exports.PagarmeCardAxiosAdapter = PagarmeCardAxiosAdapter;
|
|
7597
7600
|
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
7598
|
-
exports.
|
|
7601
|
+
exports.PagarmePixAxiosAdapter = PagarmePixAxiosAdapter;
|
|
7599
7602
|
exports.Payment = Payment;
|
|
7600
7603
|
exports.PaymentError = PaymentError;
|
|
7601
7604
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|