@infrab4a/connect 4.20.0-beta.10 → 4.20.0-beta.12
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
|
@@ -650,171 +650,7 @@ exports.Status = void 0;
|
|
|
650
650
|
})(exports.Status || (exports.Status = {}));
|
|
651
651
|
|
|
652
652
|
class PaymentTransaction extends BaseModel {
|
|
653
|
-
}
|
|
654
|
-
tslib.__decorate([
|
|
655
|
-
classTransformer.Expose({ name: 'refuse_reason' }),
|
|
656
|
-
tslib.__metadata("design:type", String)
|
|
657
|
-
], PaymentTransaction.prototype, "refuseReason", void 0);
|
|
658
|
-
tslib.__decorate([
|
|
659
|
-
classTransformer.Expose({ name: 'status_reason' }),
|
|
660
|
-
tslib.__metadata("design:type", String)
|
|
661
|
-
], PaymentTransaction.prototype, "statusReason", void 0);
|
|
662
|
-
tslib.__decorate([
|
|
663
|
-
classTransformer.Expose({ name: 'acquirer_response_code' }),
|
|
664
|
-
tslib.__metadata("design:type", String)
|
|
665
|
-
], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
|
|
666
|
-
tslib.__decorate([
|
|
667
|
-
classTransformer.Expose({ name: 'acquirer_name' }),
|
|
668
|
-
tslib.__metadata("design:type", String)
|
|
669
|
-
], PaymentTransaction.prototype, "acquirerName", void 0);
|
|
670
|
-
tslib.__decorate([
|
|
671
|
-
classTransformer.Expose({ name: 'acquirer_id' }),
|
|
672
|
-
tslib.__metadata("design:type", String)
|
|
673
|
-
], PaymentTransaction.prototype, "acquirerId", void 0);
|
|
674
|
-
tslib.__decorate([
|
|
675
|
-
classTransformer.Expose({ name: 'authorization_code' }),
|
|
676
|
-
tslib.__metadata("design:type", String)
|
|
677
|
-
], PaymentTransaction.prototype, "authorizationCode", void 0);
|
|
678
|
-
tslib.__decorate([
|
|
679
|
-
classTransformer.Expose({ name: 'soft_descriptor' }),
|
|
680
|
-
tslib.__metadata("design:type", String)
|
|
681
|
-
], PaymentTransaction.prototype, "softDescriptor", void 0);
|
|
682
|
-
tslib.__decorate([
|
|
683
|
-
classTransformer.Expose({ name: 'date_created' }),
|
|
684
|
-
tslib.__metadata("design:type", String)
|
|
685
|
-
], PaymentTransaction.prototype, "dateCreated", void 0);
|
|
686
|
-
tslib.__decorate([
|
|
687
|
-
classTransformer.Expose({ name: 'date_updated' }),
|
|
688
|
-
tslib.__metadata("design:type", String)
|
|
689
|
-
], PaymentTransaction.prototype, "dateUpdated", void 0);
|
|
690
|
-
tslib.__decorate([
|
|
691
|
-
classTransformer.Expose({ name: 'authorized_amount' }),
|
|
692
|
-
tslib.__metadata("design:type", Number)
|
|
693
|
-
], PaymentTransaction.prototype, "authorizedAmount", void 0);
|
|
694
|
-
tslib.__decorate([
|
|
695
|
-
classTransformer.Expose({ name: 'paid_amount' }),
|
|
696
|
-
tslib.__metadata("design:type", Number)
|
|
697
|
-
], PaymentTransaction.prototype, "paidAmount", void 0);
|
|
698
|
-
tslib.__decorate([
|
|
699
|
-
classTransformer.Expose({ name: 'paid_at' }),
|
|
700
|
-
tslib.__metadata("design:type", String)
|
|
701
|
-
], PaymentTransaction.prototype, "paidAt", void 0);
|
|
702
|
-
tslib.__decorate([
|
|
703
|
-
classTransformer.Expose({ name: 'refunded_amount' }),
|
|
704
|
-
tslib.__metadata("design:type", Number)
|
|
705
|
-
], PaymentTransaction.prototype, "refundedAmount", void 0);
|
|
706
|
-
tslib.__decorate([
|
|
707
|
-
classTransformer.Expose({ name: 'card_holder_name' }),
|
|
708
|
-
tslib.__metadata("design:type", String)
|
|
709
|
-
], PaymentTransaction.prototype, "cardHolderName", void 0);
|
|
710
|
-
tslib.__decorate([
|
|
711
|
-
classTransformer.Expose({ name: 'card_last_digits' }),
|
|
712
|
-
tslib.__metadata("design:type", String)
|
|
713
|
-
], PaymentTransaction.prototype, "cardLastDigits", void 0);
|
|
714
|
-
tslib.__decorate([
|
|
715
|
-
classTransformer.Expose({ name: 'card_first_digits' }),
|
|
716
|
-
tslib.__metadata("design:type", String)
|
|
717
|
-
], PaymentTransaction.prototype, "cardFirstDigits", void 0);
|
|
718
|
-
tslib.__decorate([
|
|
719
|
-
classTransformer.Expose({ name: 'card_brand' }),
|
|
720
|
-
tslib.__metadata("design:type", String)
|
|
721
|
-
], PaymentTransaction.prototype, "cardBrand", void 0);
|
|
722
|
-
tslib.__decorate([
|
|
723
|
-
classTransformer.Expose({ name: 'card_pin_mode' }),
|
|
724
|
-
tslib.__metadata("design:type", String)
|
|
725
|
-
], PaymentTransaction.prototype, "cardPinMode", void 0);
|
|
726
|
-
tslib.__decorate([
|
|
727
|
-
classTransformer.Expose({ name: 'card_magstripe_fallback' }),
|
|
728
|
-
tslib.__metadata("design:type", Boolean)
|
|
729
|
-
], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
|
|
730
|
-
tslib.__decorate([
|
|
731
|
-
classTransformer.Expose({ name: 'cvm_pin' }),
|
|
732
|
-
tslib.__metadata("design:type", Boolean)
|
|
733
|
-
], PaymentTransaction.prototype, "cvmPin", void 0);
|
|
734
|
-
tslib.__decorate([
|
|
735
|
-
classTransformer.Expose({ name: 'postback_url' }),
|
|
736
|
-
tslib.__metadata("design:type", String)
|
|
737
|
-
], PaymentTransaction.prototype, "postbackUrl", void 0);
|
|
738
|
-
tslib.__decorate([
|
|
739
|
-
classTransformer.Expose({ name: 'payment_method' }),
|
|
740
|
-
tslib.__metadata("design:type", String)
|
|
741
|
-
], PaymentTransaction.prototype, "paymentMethod", void 0);
|
|
742
|
-
tslib.__decorate([
|
|
743
|
-
classTransformer.Expose({ name: 'capture_method' }),
|
|
744
|
-
tslib.__metadata("design:type", String)
|
|
745
|
-
], PaymentTransaction.prototype, "captureMethod", void 0);
|
|
746
|
-
tslib.__decorate([
|
|
747
|
-
classTransformer.Expose({ name: 'antifraud_score' }),
|
|
748
|
-
tslib.__metadata("design:type", String)
|
|
749
|
-
], PaymentTransaction.prototype, "antifraudScore", void 0);
|
|
750
|
-
tslib.__decorate([
|
|
751
|
-
classTransformer.Expose({ name: 'boleto_url' }),
|
|
752
|
-
tslib.__metadata("design:type", String)
|
|
753
|
-
], PaymentTransaction.prototype, "boletoUrl", void 0);
|
|
754
|
-
tslib.__decorate([
|
|
755
|
-
classTransformer.Expose({ name: 'boleto_barcode' }),
|
|
756
|
-
tslib.__metadata("design:type", String)
|
|
757
|
-
], PaymentTransaction.prototype, "boletoBarcode", void 0);
|
|
758
|
-
tslib.__decorate([
|
|
759
|
-
classTransformer.Expose({ name: 'boleto_expiration_date' }),
|
|
760
|
-
tslib.__metadata("design:type", String)
|
|
761
|
-
], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
|
|
762
|
-
tslib.__decorate([
|
|
763
|
-
classTransformer.Expose({ name: 'subscription_id' }),
|
|
764
|
-
tslib.__metadata("design:type", String)
|
|
765
|
-
], PaymentTransaction.prototype, "subscriptionId", void 0);
|
|
766
|
-
tslib.__decorate([
|
|
767
|
-
classTransformer.Expose({ name: 'split_rules' }),
|
|
768
|
-
tslib.__metadata("design:type", String)
|
|
769
|
-
], PaymentTransaction.prototype, "splitRules", void 0);
|
|
770
|
-
tslib.__decorate([
|
|
771
|
-
classTransformer.Expose({ name: 'antifraud_metadata' }),
|
|
772
|
-
tslib.__metadata("design:type", Object)
|
|
773
|
-
], PaymentTransaction.prototype, "antifraudMetadata", void 0);
|
|
774
|
-
tslib.__decorate([
|
|
775
|
-
classTransformer.Expose({ name: 'reference_key' }),
|
|
776
|
-
tslib.__metadata("design:type", String)
|
|
777
|
-
], PaymentTransaction.prototype, "referenceKey", void 0);
|
|
778
|
-
tslib.__decorate([
|
|
779
|
-
classTransformer.Expose({ name: 'local_transaction_id' }),
|
|
780
|
-
tslib.__metadata("design:type", String)
|
|
781
|
-
], PaymentTransaction.prototype, "localTransactionId", void 0);
|
|
782
|
-
tslib.__decorate([
|
|
783
|
-
classTransformer.Expose({ name: 'local_time' }),
|
|
784
|
-
tslib.__metadata("design:type", String)
|
|
785
|
-
], PaymentTransaction.prototype, "localTime", void 0);
|
|
786
|
-
tslib.__decorate([
|
|
787
|
-
classTransformer.Expose({ name: 'fraud_covered' }),
|
|
788
|
-
tslib.__metadata("design:type", Boolean)
|
|
789
|
-
], PaymentTransaction.prototype, "fraudCovered", void 0);
|
|
790
|
-
tslib.__decorate([
|
|
791
|
-
classTransformer.Expose({ name: 'fraud_reimbursed' }),
|
|
792
|
-
tslib.__metadata("design:type", String)
|
|
793
|
-
], PaymentTransaction.prototype, "fraudReimbursed", void 0);
|
|
794
|
-
tslib.__decorate([
|
|
795
|
-
classTransformer.Expose({ name: 'order_id' }),
|
|
796
|
-
tslib.__metadata("design:type", String)
|
|
797
|
-
], PaymentTransaction.prototype, "orderId", void 0);
|
|
798
|
-
tslib.__decorate([
|
|
799
|
-
classTransformer.Expose({ name: 'risk_level' }),
|
|
800
|
-
tslib.__metadata("design:type", String)
|
|
801
|
-
], PaymentTransaction.prototype, "riskLevel", void 0);
|
|
802
|
-
tslib.__decorate([
|
|
803
|
-
classTransformer.Expose({ name: 'receipt_url' }),
|
|
804
|
-
tslib.__metadata("design:type", String)
|
|
805
|
-
], PaymentTransaction.prototype, "receiptUrl", void 0);
|
|
806
|
-
tslib.__decorate([
|
|
807
|
-
classTransformer.Expose({ name: 'private_label' }),
|
|
808
|
-
tslib.__metadata("design:type", String)
|
|
809
|
-
], PaymentTransaction.prototype, "privateLabel", void 0);
|
|
810
|
-
tslib.__decorate([
|
|
811
|
-
classTransformer.Expose({ name: 'pix_qr_code' }),
|
|
812
|
-
tslib.__metadata("design:type", String)
|
|
813
|
-
], PaymentTransaction.prototype, "pixQrCode", void 0);
|
|
814
|
-
tslib.__decorate([
|
|
815
|
-
classTransformer.Expose({ name: 'pix_expiration_date' }),
|
|
816
|
-
tslib.__metadata("design:type", String)
|
|
817
|
-
], PaymentTransaction.prototype, "pixExpirationDate", void 0);
|
|
653
|
+
}
|
|
818
654
|
|
|
819
655
|
class Payment extends BaseModel {
|
|
820
656
|
static get identifiersFields() {
|
|
@@ -2479,8 +2315,8 @@ class AntifraudCardService {
|
|
|
2479
2315
|
}
|
|
2480
2316
|
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2481
2317
|
var _a, _b, _c, _d;
|
|
2482
|
-
const day = `${dateFns.format(new Date(), 'yyyy-MM-
|
|
2483
|
-
const endOfDay = `${dateFns.format(new Date(), 'yyyy-MM-
|
|
2318
|
+
const day = `${dateFns.format(new Date(), 'yyyy-MM-dd')}T00:00:00`;
|
|
2319
|
+
const endOfDay = `${dateFns.format(new Date(), 'yyyy-MM-dd')}T23:59:59`;
|
|
2484
2320
|
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2485
2321
|
.find({
|
|
2486
2322
|
filters: {
|
|
@@ -2641,19 +2477,20 @@ class GlampointsPaymentService {
|
|
|
2641
2477
|
paymentProvider: 'glampoints',
|
|
2642
2478
|
transaction: {
|
|
2643
2479
|
amount: 0,
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2480
|
+
acquirer_response_code: '0000',
|
|
2481
|
+
acquirer_name: 'glampoints',
|
|
2482
|
+
authorized_amount: 0,
|
|
2483
|
+
capture_method: 'ecommerce',
|
|
2648
2484
|
installments: 1,
|
|
2649
2485
|
cost: 0,
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2486
|
+
paid_amount: 0,
|
|
2487
|
+
paid_at: new Date().toISOString(),
|
|
2488
|
+
payment_method: 'glampoints',
|
|
2653
2489
|
referer: 'api_key',
|
|
2654
|
-
|
|
2490
|
+
refunded_amount: 0,
|
|
2655
2491
|
status: 'paid',
|
|
2656
|
-
|
|
2492
|
+
status_reason: 'acquirer',
|
|
2493
|
+
date_created: new Date().toISOString(),
|
|
2657
2494
|
},
|
|
2658
2495
|
}));
|
|
2659
2496
|
return payment;
|
|
@@ -6958,11 +6795,13 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6958
6795
|
}
|
|
6959
6796
|
async pay(checkout) {
|
|
6960
6797
|
try {
|
|
6798
|
+
const payload = this.createBoletoPayment(checkout);
|
|
6961
6799
|
const result = await axios__default["default"]({
|
|
6962
6800
|
method: 'POST',
|
|
6963
6801
|
url: `${this.credentials.URL}/transactions`,
|
|
6964
6802
|
data: this.createBoletoPayment(checkout),
|
|
6965
6803
|
});
|
|
6804
|
+
console.log('[PAGARME BOLETO DATA TO SEND]', payload);
|
|
6966
6805
|
if (result.data.status !== exports.PagarmePaymentStatus['Em processamento']) {
|
|
6967
6806
|
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
6968
6807
|
checkoutId: checkout.id,
|
|
@@ -6970,7 +6809,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6970
6809
|
info: result.data,
|
|
6971
6810
|
}));
|
|
6972
6811
|
}
|
|
6973
|
-
const payment = await this.paymentRepository.create(
|
|
6812
|
+
const payment = await this.paymentRepository.create({
|
|
6974
6813
|
createdAt: new Date(),
|
|
6975
6814
|
updatedAt: new Date(),
|
|
6976
6815
|
userId: checkout.user.id,
|
|
@@ -6978,7 +6817,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6978
6817
|
totalPrice: checkout.totalPrice,
|
|
6979
6818
|
paymentProvider: 'pagarMe',
|
|
6980
6819
|
transaction: result.data,
|
|
6981
|
-
})
|
|
6820
|
+
});
|
|
6982
6821
|
return payment;
|
|
6983
6822
|
}
|
|
6984
6823
|
catch (error) {
|
|
@@ -7041,11 +6880,13 @@ class PagarmeCardAxiosAdapter {
|
|
|
7041
6880
|
async pay(checkout, card) {
|
|
7042
6881
|
var _a;
|
|
7043
6882
|
try {
|
|
6883
|
+
const payload = this.createCardPayment(checkout, card);
|
|
7044
6884
|
const result = await axios__default["default"]({
|
|
7045
6885
|
method: 'POST',
|
|
7046
6886
|
url: `${this.credentials.URL}/transactions`,
|
|
7047
|
-
data:
|
|
6887
|
+
data: payload,
|
|
7048
6888
|
});
|
|
6889
|
+
console.log('[PAGARME CARD DATA TO SEND]', payload);
|
|
7049
6890
|
if (result.data.status !== exports.PagarmePaymentStatus.Pago) {
|
|
7050
6891
|
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
7051
6892
|
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`, {
|
|
@@ -7054,7 +6895,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
7054
6895
|
info: result.data,
|
|
7055
6896
|
}));
|
|
7056
6897
|
}
|
|
7057
|
-
const payment = await this.paymentRepository.create(
|
|
6898
|
+
const payment = await this.paymentRepository.create({
|
|
7058
6899
|
createdAt: new Date(),
|
|
7059
6900
|
updatedAt: new Date(),
|
|
7060
6901
|
userId: checkout.user.id,
|
|
@@ -7062,7 +6903,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
7062
6903
|
totalPrice: checkout.totalPrice,
|
|
7063
6904
|
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
7064
6905
|
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7065
|
-
})
|
|
6906
|
+
});
|
|
7066
6907
|
return payment;
|
|
7067
6908
|
}
|
|
7068
6909
|
catch (error) {
|
|
@@ -7205,20 +7046,22 @@ class PagarmePixAxiosAdapter {
|
|
|
7205
7046
|
async pay(checkout) {
|
|
7206
7047
|
var _a;
|
|
7207
7048
|
try {
|
|
7049
|
+
const payload = this.createPixPayment(checkout);
|
|
7208
7050
|
const result = await axios__default["default"]({
|
|
7209
7051
|
method: 'POST',
|
|
7210
7052
|
url: `${this.credentials.URL}/transactions`,
|
|
7211
|
-
data:
|
|
7053
|
+
data: payload,
|
|
7212
7054
|
});
|
|
7213
|
-
|
|
7055
|
+
console.log('[PAGARME PIX DATA TO SEND]', payload);
|
|
7056
|
+
const payment = await this.paymentRepository.create({
|
|
7214
7057
|
createdAt: new Date(),
|
|
7215
7058
|
updatedAt: new Date(),
|
|
7216
7059
|
userId: checkout.user.id,
|
|
7217
7060
|
checkoutId: checkout.id,
|
|
7218
7061
|
totalPrice: checkout.totalPrice,
|
|
7219
7062
|
paymentProvider: 'pagarMe',
|
|
7220
|
-
transaction:
|
|
7221
|
-
})
|
|
7063
|
+
transaction: result.data,
|
|
7064
|
+
});
|
|
7222
7065
|
return payment;
|
|
7223
7066
|
}
|
|
7224
7067
|
catch (error) {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
|
|
3
|
-
import { plainToInstance, instanceToPlain, Type
|
|
3
|
+
import { plainToInstance, instanceToPlain, Type } from 'class-transformer';
|
|
4
4
|
import { parseISO, format, startOfDay, endOfDay, subDays, addDays } from 'date-fns';
|
|
5
5
|
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub, subDays } from 'date-fns';
|
|
6
6
|
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, chunk, isEmpty, isDate, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
|
|
@@ -644,171 +644,7 @@ var Status;
|
|
|
644
644
|
})(Status || (Status = {}));
|
|
645
645
|
|
|
646
646
|
class PaymentTransaction extends BaseModel {
|
|
647
|
-
}
|
|
648
|
-
__decorate([
|
|
649
|
-
Expose({ name: 'refuse_reason' }),
|
|
650
|
-
__metadata("design:type", String)
|
|
651
|
-
], PaymentTransaction.prototype, "refuseReason", void 0);
|
|
652
|
-
__decorate([
|
|
653
|
-
Expose({ name: 'status_reason' }),
|
|
654
|
-
__metadata("design:type", String)
|
|
655
|
-
], PaymentTransaction.prototype, "statusReason", void 0);
|
|
656
|
-
__decorate([
|
|
657
|
-
Expose({ name: 'acquirer_response_code' }),
|
|
658
|
-
__metadata("design:type", String)
|
|
659
|
-
], PaymentTransaction.prototype, "acquirerResponseCode", void 0);
|
|
660
|
-
__decorate([
|
|
661
|
-
Expose({ name: 'acquirer_name' }),
|
|
662
|
-
__metadata("design:type", String)
|
|
663
|
-
], PaymentTransaction.prototype, "acquirerName", void 0);
|
|
664
|
-
__decorate([
|
|
665
|
-
Expose({ name: 'acquirer_id' }),
|
|
666
|
-
__metadata("design:type", String)
|
|
667
|
-
], PaymentTransaction.prototype, "acquirerId", void 0);
|
|
668
|
-
__decorate([
|
|
669
|
-
Expose({ name: 'authorization_code' }),
|
|
670
|
-
__metadata("design:type", String)
|
|
671
|
-
], PaymentTransaction.prototype, "authorizationCode", void 0);
|
|
672
|
-
__decorate([
|
|
673
|
-
Expose({ name: 'soft_descriptor' }),
|
|
674
|
-
__metadata("design:type", String)
|
|
675
|
-
], PaymentTransaction.prototype, "softDescriptor", void 0);
|
|
676
|
-
__decorate([
|
|
677
|
-
Expose({ name: 'date_created' }),
|
|
678
|
-
__metadata("design:type", String)
|
|
679
|
-
], PaymentTransaction.prototype, "dateCreated", void 0);
|
|
680
|
-
__decorate([
|
|
681
|
-
Expose({ name: 'date_updated' }),
|
|
682
|
-
__metadata("design:type", String)
|
|
683
|
-
], PaymentTransaction.prototype, "dateUpdated", void 0);
|
|
684
|
-
__decorate([
|
|
685
|
-
Expose({ name: 'authorized_amount' }),
|
|
686
|
-
__metadata("design:type", Number)
|
|
687
|
-
], PaymentTransaction.prototype, "authorizedAmount", void 0);
|
|
688
|
-
__decorate([
|
|
689
|
-
Expose({ name: 'paid_amount' }),
|
|
690
|
-
__metadata("design:type", Number)
|
|
691
|
-
], PaymentTransaction.prototype, "paidAmount", void 0);
|
|
692
|
-
__decorate([
|
|
693
|
-
Expose({ name: 'paid_at' }),
|
|
694
|
-
__metadata("design:type", String)
|
|
695
|
-
], PaymentTransaction.prototype, "paidAt", void 0);
|
|
696
|
-
__decorate([
|
|
697
|
-
Expose({ name: 'refunded_amount' }),
|
|
698
|
-
__metadata("design:type", Number)
|
|
699
|
-
], PaymentTransaction.prototype, "refundedAmount", void 0);
|
|
700
|
-
__decorate([
|
|
701
|
-
Expose({ name: 'card_holder_name' }),
|
|
702
|
-
__metadata("design:type", String)
|
|
703
|
-
], PaymentTransaction.prototype, "cardHolderName", void 0);
|
|
704
|
-
__decorate([
|
|
705
|
-
Expose({ name: 'card_last_digits' }),
|
|
706
|
-
__metadata("design:type", String)
|
|
707
|
-
], PaymentTransaction.prototype, "cardLastDigits", void 0);
|
|
708
|
-
__decorate([
|
|
709
|
-
Expose({ name: 'card_first_digits' }),
|
|
710
|
-
__metadata("design:type", String)
|
|
711
|
-
], PaymentTransaction.prototype, "cardFirstDigits", void 0);
|
|
712
|
-
__decorate([
|
|
713
|
-
Expose({ name: 'card_brand' }),
|
|
714
|
-
__metadata("design:type", String)
|
|
715
|
-
], PaymentTransaction.prototype, "cardBrand", void 0);
|
|
716
|
-
__decorate([
|
|
717
|
-
Expose({ name: 'card_pin_mode' }),
|
|
718
|
-
__metadata("design:type", String)
|
|
719
|
-
], PaymentTransaction.prototype, "cardPinMode", void 0);
|
|
720
|
-
__decorate([
|
|
721
|
-
Expose({ name: 'card_magstripe_fallback' }),
|
|
722
|
-
__metadata("design:type", Boolean)
|
|
723
|
-
], PaymentTransaction.prototype, "cardMagstripeFallback", void 0);
|
|
724
|
-
__decorate([
|
|
725
|
-
Expose({ name: 'cvm_pin' }),
|
|
726
|
-
__metadata("design:type", Boolean)
|
|
727
|
-
], PaymentTransaction.prototype, "cvmPin", void 0);
|
|
728
|
-
__decorate([
|
|
729
|
-
Expose({ name: 'postback_url' }),
|
|
730
|
-
__metadata("design:type", String)
|
|
731
|
-
], PaymentTransaction.prototype, "postbackUrl", void 0);
|
|
732
|
-
__decorate([
|
|
733
|
-
Expose({ name: 'payment_method' }),
|
|
734
|
-
__metadata("design:type", String)
|
|
735
|
-
], PaymentTransaction.prototype, "paymentMethod", void 0);
|
|
736
|
-
__decorate([
|
|
737
|
-
Expose({ name: 'capture_method' }),
|
|
738
|
-
__metadata("design:type", String)
|
|
739
|
-
], PaymentTransaction.prototype, "captureMethod", void 0);
|
|
740
|
-
__decorate([
|
|
741
|
-
Expose({ name: 'antifraud_score' }),
|
|
742
|
-
__metadata("design:type", String)
|
|
743
|
-
], PaymentTransaction.prototype, "antifraudScore", void 0);
|
|
744
|
-
__decorate([
|
|
745
|
-
Expose({ name: 'boleto_url' }),
|
|
746
|
-
__metadata("design:type", String)
|
|
747
|
-
], PaymentTransaction.prototype, "boletoUrl", void 0);
|
|
748
|
-
__decorate([
|
|
749
|
-
Expose({ name: 'boleto_barcode' }),
|
|
750
|
-
__metadata("design:type", String)
|
|
751
|
-
], PaymentTransaction.prototype, "boletoBarcode", void 0);
|
|
752
|
-
__decorate([
|
|
753
|
-
Expose({ name: 'boleto_expiration_date' }),
|
|
754
|
-
__metadata("design:type", String)
|
|
755
|
-
], PaymentTransaction.prototype, "boletoExpirationDate", void 0);
|
|
756
|
-
__decorate([
|
|
757
|
-
Expose({ name: 'subscription_id' }),
|
|
758
|
-
__metadata("design:type", String)
|
|
759
|
-
], PaymentTransaction.prototype, "subscriptionId", void 0);
|
|
760
|
-
__decorate([
|
|
761
|
-
Expose({ name: 'split_rules' }),
|
|
762
|
-
__metadata("design:type", String)
|
|
763
|
-
], PaymentTransaction.prototype, "splitRules", void 0);
|
|
764
|
-
__decorate([
|
|
765
|
-
Expose({ name: 'antifraud_metadata' }),
|
|
766
|
-
__metadata("design:type", Object)
|
|
767
|
-
], PaymentTransaction.prototype, "antifraudMetadata", void 0);
|
|
768
|
-
__decorate([
|
|
769
|
-
Expose({ name: 'reference_key' }),
|
|
770
|
-
__metadata("design:type", String)
|
|
771
|
-
], PaymentTransaction.prototype, "referenceKey", void 0);
|
|
772
|
-
__decorate([
|
|
773
|
-
Expose({ name: 'local_transaction_id' }),
|
|
774
|
-
__metadata("design:type", String)
|
|
775
|
-
], PaymentTransaction.prototype, "localTransactionId", void 0);
|
|
776
|
-
__decorate([
|
|
777
|
-
Expose({ name: 'local_time' }),
|
|
778
|
-
__metadata("design:type", String)
|
|
779
|
-
], PaymentTransaction.prototype, "localTime", void 0);
|
|
780
|
-
__decorate([
|
|
781
|
-
Expose({ name: 'fraud_covered' }),
|
|
782
|
-
__metadata("design:type", Boolean)
|
|
783
|
-
], PaymentTransaction.prototype, "fraudCovered", void 0);
|
|
784
|
-
__decorate([
|
|
785
|
-
Expose({ name: 'fraud_reimbursed' }),
|
|
786
|
-
__metadata("design:type", String)
|
|
787
|
-
], PaymentTransaction.prototype, "fraudReimbursed", void 0);
|
|
788
|
-
__decorate([
|
|
789
|
-
Expose({ name: 'order_id' }),
|
|
790
|
-
__metadata("design:type", String)
|
|
791
|
-
], PaymentTransaction.prototype, "orderId", void 0);
|
|
792
|
-
__decorate([
|
|
793
|
-
Expose({ name: 'risk_level' }),
|
|
794
|
-
__metadata("design:type", String)
|
|
795
|
-
], PaymentTransaction.prototype, "riskLevel", void 0);
|
|
796
|
-
__decorate([
|
|
797
|
-
Expose({ name: 'receipt_url' }),
|
|
798
|
-
__metadata("design:type", String)
|
|
799
|
-
], PaymentTransaction.prototype, "receiptUrl", void 0);
|
|
800
|
-
__decorate([
|
|
801
|
-
Expose({ name: 'private_label' }),
|
|
802
|
-
__metadata("design:type", String)
|
|
803
|
-
], PaymentTransaction.prototype, "privateLabel", void 0);
|
|
804
|
-
__decorate([
|
|
805
|
-
Expose({ name: 'pix_qr_code' }),
|
|
806
|
-
__metadata("design:type", String)
|
|
807
|
-
], PaymentTransaction.prototype, "pixQrCode", void 0);
|
|
808
|
-
__decorate([
|
|
809
|
-
Expose({ name: 'pix_expiration_date' }),
|
|
810
|
-
__metadata("design:type", String)
|
|
811
|
-
], PaymentTransaction.prototype, "pixExpirationDate", void 0);
|
|
647
|
+
}
|
|
812
648
|
|
|
813
649
|
class Payment extends BaseModel {
|
|
814
650
|
static get identifiersFields() {
|
|
@@ -2473,8 +2309,8 @@ class AntifraudCardService {
|
|
|
2473
2309
|
}
|
|
2474
2310
|
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2475
2311
|
var _a, _b, _c, _d;
|
|
2476
|
-
const day = `${format(new Date(), 'yyyy-MM-
|
|
2477
|
-
const endOfDay = `${format(new Date(), 'yyyy-MM-
|
|
2312
|
+
const day = `${format(new Date(), 'yyyy-MM-dd')}T00:00:00`;
|
|
2313
|
+
const endOfDay = `${format(new Date(), 'yyyy-MM-dd')}T23:59:59`;
|
|
2478
2314
|
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2479
2315
|
.find({
|
|
2480
2316
|
filters: {
|
|
@@ -2635,19 +2471,20 @@ class GlampointsPaymentService {
|
|
|
2635
2471
|
paymentProvider: 'glampoints',
|
|
2636
2472
|
transaction: {
|
|
2637
2473
|
amount: 0,
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2474
|
+
acquirer_response_code: '0000',
|
|
2475
|
+
acquirer_name: 'glampoints',
|
|
2476
|
+
authorized_amount: 0,
|
|
2477
|
+
capture_method: 'ecommerce',
|
|
2642
2478
|
installments: 1,
|
|
2643
2479
|
cost: 0,
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2480
|
+
paid_amount: 0,
|
|
2481
|
+
paid_at: new Date().toISOString(),
|
|
2482
|
+
payment_method: 'glampoints',
|
|
2647
2483
|
referer: 'api_key',
|
|
2648
|
-
|
|
2484
|
+
refunded_amount: 0,
|
|
2649
2485
|
status: 'paid',
|
|
2650
|
-
|
|
2486
|
+
status_reason: 'acquirer',
|
|
2487
|
+
date_created: new Date().toISOString(),
|
|
2651
2488
|
},
|
|
2652
2489
|
}));
|
|
2653
2490
|
return payment;
|
|
@@ -6952,11 +6789,13 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6952
6789
|
}
|
|
6953
6790
|
async pay(checkout) {
|
|
6954
6791
|
try {
|
|
6792
|
+
const payload = this.createBoletoPayment(checkout);
|
|
6955
6793
|
const result = await axios({
|
|
6956
6794
|
method: 'POST',
|
|
6957
6795
|
url: `${this.credentials.URL}/transactions`,
|
|
6958
6796
|
data: this.createBoletoPayment(checkout),
|
|
6959
6797
|
});
|
|
6798
|
+
console.log('[PAGARME BOLETO DATA TO SEND]', payload);
|
|
6960
6799
|
if (result.data.status !== PagarmePaymentStatus['Em processamento']) {
|
|
6961
6800
|
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
6962
6801
|
checkoutId: checkout.id,
|
|
@@ -6964,7 +6803,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6964
6803
|
info: result.data,
|
|
6965
6804
|
}));
|
|
6966
6805
|
}
|
|
6967
|
-
const payment = await this.paymentRepository.create(
|
|
6806
|
+
const payment = await this.paymentRepository.create({
|
|
6968
6807
|
createdAt: new Date(),
|
|
6969
6808
|
updatedAt: new Date(),
|
|
6970
6809
|
userId: checkout.user.id,
|
|
@@ -6972,7 +6811,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
6972
6811
|
totalPrice: checkout.totalPrice,
|
|
6973
6812
|
paymentProvider: 'pagarMe',
|
|
6974
6813
|
transaction: result.data,
|
|
6975
|
-
})
|
|
6814
|
+
});
|
|
6976
6815
|
return payment;
|
|
6977
6816
|
}
|
|
6978
6817
|
catch (error) {
|
|
@@ -7035,11 +6874,13 @@ class PagarmeCardAxiosAdapter {
|
|
|
7035
6874
|
async pay(checkout, card) {
|
|
7036
6875
|
var _a;
|
|
7037
6876
|
try {
|
|
6877
|
+
const payload = this.createCardPayment(checkout, card);
|
|
7038
6878
|
const result = await axios({
|
|
7039
6879
|
method: 'POST',
|
|
7040
6880
|
url: `${this.credentials.URL}/transactions`,
|
|
7041
|
-
data:
|
|
6881
|
+
data: payload,
|
|
7042
6882
|
});
|
|
6883
|
+
console.log('[PAGARME CARD DATA TO SEND]', payload);
|
|
7043
6884
|
if (result.data.status !== PagarmePaymentStatus.Pago) {
|
|
7044
6885
|
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
7045
6886
|
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`, {
|
|
@@ -7048,7 +6889,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
7048
6889
|
info: result.data,
|
|
7049
6890
|
}));
|
|
7050
6891
|
}
|
|
7051
|
-
const payment = await this.paymentRepository.create(
|
|
6892
|
+
const payment = await this.paymentRepository.create({
|
|
7052
6893
|
createdAt: new Date(),
|
|
7053
6894
|
updatedAt: new Date(),
|
|
7054
6895
|
userId: checkout.user.id,
|
|
@@ -7056,7 +6897,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
7056
6897
|
totalPrice: checkout.totalPrice,
|
|
7057
6898
|
paymentProvider: PaymentProviders.PAGARME,
|
|
7058
6899
|
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7059
|
-
})
|
|
6900
|
+
});
|
|
7060
6901
|
return payment;
|
|
7061
6902
|
}
|
|
7062
6903
|
catch (error) {
|
|
@@ -7199,20 +7040,22 @@ class PagarmePixAxiosAdapter {
|
|
|
7199
7040
|
async pay(checkout) {
|
|
7200
7041
|
var _a;
|
|
7201
7042
|
try {
|
|
7043
|
+
const payload = this.createPixPayment(checkout);
|
|
7202
7044
|
const result = await axios({
|
|
7203
7045
|
method: 'POST',
|
|
7204
7046
|
url: `${this.credentials.URL}/transactions`,
|
|
7205
|
-
data:
|
|
7047
|
+
data: payload,
|
|
7206
7048
|
});
|
|
7207
|
-
|
|
7049
|
+
console.log('[PAGARME PIX DATA TO SEND]', payload);
|
|
7050
|
+
const payment = await this.paymentRepository.create({
|
|
7208
7051
|
createdAt: new Date(),
|
|
7209
7052
|
updatedAt: new Date(),
|
|
7210
7053
|
userId: checkout.user.id,
|
|
7211
7054
|
checkoutId: checkout.id,
|
|
7212
7055
|
totalPrice: checkout.totalPrice,
|
|
7213
7056
|
paymentProvider: 'pagarMe',
|
|
7214
|
-
transaction:
|
|
7215
|
-
})
|
|
7057
|
+
transaction: result.data,
|
|
7058
|
+
});
|
|
7216
7059
|
return payment;
|
|
7217
7060
|
}
|
|
7218
7061
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
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
|
|
5
|
-
object
|
|
6
|
-
status
|
|
7
|
-
tid
|
|
8
|
-
nsu
|
|
4
|
+
id?: number;
|
|
5
|
+
object?: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
tid?: number;
|
|
8
|
+
nsu?: number;
|
|
9
9
|
amount: number;
|
|
10
10
|
cost: number;
|
|
11
|
-
installments
|
|
11
|
+
installments?: number;
|
|
12
12
|
referer: string;
|
|
13
|
-
ip
|
|
14
|
-
phone
|
|
15
|
-
address
|
|
16
|
-
metadata
|
|
17
|
-
device
|
|
18
|
-
payment
|
|
19
|
-
addition
|
|
20
|
-
discount
|
|
21
|
-
customer
|
|
22
|
-
billing
|
|
23
|
-
shipping
|
|
24
|
-
items
|
|
25
|
-
card
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
fraudCovered
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
13
|
+
ip?: string;
|
|
14
|
+
phone?: string;
|
|
15
|
+
address?: string;
|
|
16
|
+
metadata?: any;
|
|
17
|
+
device?: string;
|
|
18
|
+
payment?: string;
|
|
19
|
+
addition?: string;
|
|
20
|
+
discount?: string;
|
|
21
|
+
customer?: PaymentCustomer;
|
|
22
|
+
billing?: PaymentBilling;
|
|
23
|
+
shipping?: PaymentShipping;
|
|
24
|
+
items?: PaymentItem[];
|
|
25
|
+
card?: PaymentCard;
|
|
26
|
+
refuse_reason?: string;
|
|
27
|
+
status_reason?: string;
|
|
28
|
+
acquirer_response_code?: string;
|
|
29
|
+
acquirer_name?: string;
|
|
30
|
+
acquirer_id?: string;
|
|
31
|
+
authorization_code?: string;
|
|
32
|
+
soft_descriptor?: string;
|
|
33
|
+
date_created?: string;
|
|
34
|
+
date_updated?: string;
|
|
35
|
+
authorized_amount?: number;
|
|
36
|
+
paid_amount?: number;
|
|
37
|
+
paid_at?: string;
|
|
38
|
+
refunded_amount?: number;
|
|
39
|
+
card_holder_name?: string;
|
|
40
|
+
card_last_digits?: string;
|
|
41
|
+
card_first_digits?: string;
|
|
42
|
+
card_brand?: string;
|
|
43
|
+
card_pin_mode?: string;
|
|
44
|
+
card_magstripe_fallback?: boolean;
|
|
45
|
+
cvm_pin?: boolean;
|
|
46
|
+
postback_url?: string;
|
|
47
|
+
payment_method?: string;
|
|
48
|
+
capture_method?: string;
|
|
49
|
+
antifraud_score?: string;
|
|
50
|
+
boleto_url?: string;
|
|
51
|
+
boleto_barcode?: string;
|
|
52
|
+
boleto_expiration_date?: string;
|
|
53
|
+
subscription_id?: string;
|
|
54
|
+
split_rules?: string;
|
|
55
|
+
antifraud_metadata?: any;
|
|
56
|
+
reference_key?: string;
|
|
57
|
+
local_transaction_id?: string;
|
|
58
|
+
local_time?: string;
|
|
59
|
+
fraudCovered?: boolean;
|
|
60
|
+
fraud_reimbursed?: string;
|
|
61
|
+
order_id?: string;
|
|
62
|
+
risk_level?: string;
|
|
63
|
+
receipt_url?: string;
|
|
64
|
+
private_label?: string;
|
|
65
|
+
pix_qr_code?: string;
|
|
66
|
+
pix_expiration_date?: string;
|
|
67
67
|
}
|