@infrab4a/connect 4.20.0-beta.9 → 4.21.0-beta.0
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 +120 -865
- package/index.esm.js +121 -842
- package/package.json +1 -1
- package/src/domain/catalog/models/category-product.d.ts +8 -0
- package/src/domain/catalog/models/index.d.ts +1 -0
- package/src/domain/catalog/models/product-base.d.ts +2 -0
- package/src/domain/catalog/models/types/index.d.ts +0 -1
- package/src/domain/catalog/models/variant.d.ts +2 -0
- package/src/domain/catalog/repositories/category-product.repository.d.ts +6 -0
- package/src/domain/catalog/repositories/index.d.ts +1 -0
- package/src/domain/general/models/index.d.ts +0 -1
- package/src/domain/general/repositories/index.d.ts +0 -1
- package/src/domain/shopping/index.d.ts +0 -4
- package/src/domain/shopping/models/index.d.ts +0 -1
- package/src/domain/shopping/models/order-blocked.d.ts +6 -4
- package/src/domain/shopping/models/order.d.ts +2 -2
- package/src/domain/shopping/models/payment.d.ts +63 -10
- package/src/domain/shopping/models/types/index.d.ts +4 -4
- package/src/domain/shopping/types/index.d.ts +0 -8
- package/src/errors/index.d.ts +2 -8
- package/src/infra/elasticsearch/indexes/products-index.d.ts +2 -0
- package/src/infra/firebase/firestore/repositories/general/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shopping/{order-blocked-firestore.repository.d.ts → order-blocked-firestore.repository.ts.d.ts} +2 -2
- package/src/infra/hasura-graphql/repositories/catalog/category-product-hasura-graphql.repository.d.ts +11 -0
- package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +1 -0
- package/src/infra/index.d.ts +0 -2
- package/src/utils/index.d.ts +2 -2
- package/src/domain/general/models/sequences.d.ts +0 -9
- package/src/domain/general/repositories/sequences.repository.d.ts +0 -4
- package/src/domain/shopping/enums/antifraud-providers.enum.d.ts +0 -6
- package/src/domain/shopping/enums/business-unit.enum.d.ts +0 -4
- package/src/domain/shopping/enums/index.d.ts +0 -6
- package/src/domain/shopping/enums/order-blocked.enum.d.ts +0 -5
- package/src/domain/shopping/enums/pagarme-payment-status.enum.d.ts +0 -10
- package/src/domain/shopping/enums/payment-methods.enum.d.ts +0 -6
- package/src/domain/shopping/enums/payment-providers.enum.d.ts +0 -5
- package/src/domain/shopping/factories/adyen-payment-method.factory.d.ts +0 -9
- package/src/domain/shopping/factories/antifraud-provider.factory.d.ts +0 -15
- package/src/domain/shopping/factories/base-payment-method.factory.d.ts +0 -7
- package/src/domain/shopping/factories/glampoints-payment-method.factory.d.ts +0 -8
- package/src/domain/shopping/factories/index.d.ts +0 -5
- package/src/domain/shopping/factories/pagarme-payment-method.factory.d.ts +0 -11
- package/src/domain/shopping/factories/payment-provider.factory.d.ts +0 -15
- package/src/domain/shopping/interfaces/antifraud-method-factory.interface.d.ts +0 -11
- package/src/domain/shopping/interfaces/antifraud-provider.interface.d.ts +0 -5
- package/src/domain/shopping/interfaces/index.d.ts +0 -7
- package/src/domain/shopping/interfaces/payment-method-factory.interface.d.ts +0 -14
- package/src/domain/shopping/interfaces/payment-provider-bank-slip.interface.d.ts +0 -7
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +0 -13
- package/src/domain/shopping/interfaces/payment-provider-glampoints.interface.d.ts +0 -5
- package/src/domain/shopping/interfaces/payment-provider-pix.interface.d.ts +0 -5
- package/src/domain/shopping/models/payment-transaction.d.ts +0 -67
- package/src/domain/shopping/services/antifraud-bankslip.service.d.ts +0 -9
- package/src/domain/shopping/services/antifraud-card.service.d.ts +0 -18
- package/src/domain/shopping/services/antifraud-glampoints.service.d.ts +0 -6
- package/src/domain/shopping/services/antifraud-pix.service.d.ts +0 -6
- package/src/domain/shopping/services/glampoints-payment.service.d.ts +0 -8
- package/src/domain/shopping/services/index.d.ts +0 -5
- package/src/domain/shopping/types/adyen-card.type.d.ts +0 -3
- package/src/domain/shopping/types/adyen-credentials.type.d.ts +0 -6
- package/src/domain/shopping/types/antifraud-provider.type.d.ts +0 -2
- package/src/domain/shopping/types/base-card.type.d.ts +0 -2
- package/src/domain/shopping/types/card-info.type.d.ts +0 -8
- package/src/domain/shopping/types/pagarme-card-manual-hash.type.d.ts +0 -6
- package/src/domain/shopping/types/pagarme-card.type.d.ts +0 -16
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +0 -7
- package/src/domain/shopping/types/payment-method.type.d.ts +0 -2
- package/src/domain/shopping/types/payment-provider.type.d.ts +0 -2
- package/src/errors/business.error.d.ts +0 -7
- package/src/errors/fraud-validation.error.d.ts +0 -7
- package/src/errors/payment.error.d.ts +0 -7
- package/src/errors/stock-limit.error.d.ts +0 -5
- package/src/errors/stock-out.error.d.ts +0 -5
- package/src/errors/types/checkout-additional-data-erro.type.d.ts +0 -6
- package/src/errors/types/index.d.ts +0 -2
- package/src/errors/types/pagarme-erros.type.d.ts +0 -9
- package/src/infra/adyen/adapters/adyen-card-payment-axios.adapter.d.ts +0 -17
- package/src/infra/adyen/adapters/index.d.ts +0 -1
- package/src/infra/adyen/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +0 -7
- package/src/infra/pagarme/adapters/index.d.ts +0 -3
- package/src/infra/pagarme/adapters/pagarme-bank-slip-payment-axios.adapter.d.ts +0 -12
- package/src/infra/pagarme/adapters/pagarme-card-payment-axios.adapter.d.ts +0 -17
- package/src/infra/pagarme/adapters/pagarme-pix-payment-axios.adapter.d.ts +0 -11
- package/src/infra/pagarme/index.d.ts +0 -1
package/index.cjs.js
CHANGED
|
@@ -19,90 +19,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
19
|
|
|
20
20
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
21
21
|
|
|
22
|
-
exports.AntifraudProviders = void 0;
|
|
23
|
-
(function (AntifraudProviders) {
|
|
24
|
-
AntifraudProviders["BANKSLIP"] = "bankSlip";
|
|
25
|
-
AntifraudProviders["CARD"] = "card";
|
|
26
|
-
AntifraudProviders["PIX"] = "pix";
|
|
27
|
-
AntifraudProviders["POINTS"] = "glampoints";
|
|
28
|
-
})(exports.AntifraudProviders || (exports.AntifraudProviders = {}));
|
|
29
|
-
|
|
30
|
-
exports.BusinessUnitEnum = void 0;
|
|
31
|
-
(function (BusinessUnitEnum) {
|
|
32
|
-
BusinessUnitEnum[BusinessUnitEnum["SUBSCRIPTION"] = 1] = "SUBSCRIPTION";
|
|
33
|
-
BusinessUnitEnum[BusinessUnitEnum["SHOP"] = 2] = "SHOP";
|
|
34
|
-
})(exports.BusinessUnitEnum || (exports.BusinessUnitEnum = {}));
|
|
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
|
-
|
|
43
|
-
exports.PagarmePaymentStatus = void 0;
|
|
44
|
-
(function (PagarmePaymentStatus) {
|
|
45
|
-
PagarmePaymentStatus["Em processamento"] = "processing";
|
|
46
|
-
PagarmePaymentStatus["Autorizada"] = "authorized";
|
|
47
|
-
PagarmePaymentStatus["Pago"] = "paid";
|
|
48
|
-
PagarmePaymentStatus["Estornada"] = "refunded";
|
|
49
|
-
PagarmePaymentStatus["Aguardando pagamento"] = "waiting_payment";
|
|
50
|
-
PagarmePaymentStatus["Aguardando estorno"] = "pending_refund";
|
|
51
|
-
PagarmePaymentStatus["Recusada/N\u00E3o autorizada"] = "refused";
|
|
52
|
-
PagarmePaymentStatus["Chargedback"] = "chargedback";
|
|
53
|
-
})(exports.PagarmePaymentStatus || (exports.PagarmePaymentStatus = {}));
|
|
54
|
-
|
|
55
|
-
exports.PaymentMethods = void 0;
|
|
56
|
-
(function (PaymentMethods) {
|
|
57
|
-
PaymentMethods["CARD"] = "card";
|
|
58
|
-
PaymentMethods["BANKSLIP"] = "bankSlip";
|
|
59
|
-
PaymentMethods["PIX"] = "pix";
|
|
60
|
-
PaymentMethods["POINTS"] = "glampoints";
|
|
61
|
-
})(exports.PaymentMethods || (exports.PaymentMethods = {}));
|
|
62
|
-
|
|
63
|
-
exports.PaymentProviders = void 0;
|
|
64
|
-
(function (PaymentProviders) {
|
|
65
|
-
PaymentProviders["PAGARME"] = "pagarMe";
|
|
66
|
-
PaymentProviders["ADYEN"] = "adyen";
|
|
67
|
-
PaymentProviders["GLAMPOINTS"] = "glampoints";
|
|
68
|
-
})(exports.PaymentProviders || (exports.PaymentProviders = {}));
|
|
69
|
-
|
|
70
|
-
class BasePaymentMethodFactory {
|
|
71
|
-
constructor(methods) {
|
|
72
|
-
this.methods = methods;
|
|
73
|
-
}
|
|
74
|
-
build(method) {
|
|
75
|
-
return this.methods[method];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class AntifraudProviderFactory {
|
|
83
|
-
constructor(antifraudProviders) {
|
|
84
|
-
this.antifraudProviders = antifraudProviders;
|
|
85
|
-
}
|
|
86
|
-
build(provider) {
|
|
87
|
-
return this.antifraudProviders[provider];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
class PaymentProviderFactory {
|
|
98
|
-
constructor(paymentProviders) {
|
|
99
|
-
this.paymentProviders = paymentProviders;
|
|
100
|
-
}
|
|
101
|
-
build(provider) {
|
|
102
|
-
return this.paymentProviders[provider];
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
22
|
class BaseModel {
|
|
107
23
|
get identifier() {
|
|
108
24
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -299,6 +215,12 @@ tslib.__decorate([
|
|
|
299
215
|
tslib.__metadata("design:type", Category)
|
|
300
216
|
], CategoryFilter.prototype, "category", void 0);
|
|
301
217
|
|
|
218
|
+
class CategoryProduct extends BaseModel {
|
|
219
|
+
static get identifiersFields() {
|
|
220
|
+
return ['categoryId', 'productId'];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
302
224
|
class FilterOption extends BaseModel {
|
|
303
225
|
static get identifiersFields() {
|
|
304
226
|
return ['id'];
|
|
@@ -649,182 +571,175 @@ exports.Status = void 0;
|
|
|
649
571
|
Status["CANCELLED"] = "Cancelado";
|
|
650
572
|
})(exports.Status || (exports.Status = {}));
|
|
651
573
|
|
|
652
|
-
class
|
|
574
|
+
class Payment extends BaseModel {
|
|
575
|
+
static get identifiersFields() {
|
|
576
|
+
return ['id'];
|
|
577
|
+
}
|
|
653
578
|
}
|
|
654
579
|
tslib.__decorate([
|
|
655
580
|
classTransformer.Expose({ name: 'refuse_reason' }),
|
|
656
581
|
tslib.__metadata("design:type", String)
|
|
657
|
-
],
|
|
582
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
658
583
|
tslib.__decorate([
|
|
659
584
|
classTransformer.Expose({ name: 'status_reason' }),
|
|
660
585
|
tslib.__metadata("design:type", String)
|
|
661
|
-
],
|
|
586
|
+
], Payment.prototype, "statusReason", void 0);
|
|
662
587
|
tslib.__decorate([
|
|
663
588
|
classTransformer.Expose({ name: 'acquirer_response_code' }),
|
|
664
589
|
tslib.__metadata("design:type", String)
|
|
665
|
-
],
|
|
590
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
666
591
|
tslib.__decorate([
|
|
667
592
|
classTransformer.Expose({ name: 'acquirer_name' }),
|
|
668
593
|
tslib.__metadata("design:type", String)
|
|
669
|
-
],
|
|
594
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
670
595
|
tslib.__decorate([
|
|
671
596
|
classTransformer.Expose({ name: 'acquirer_id' }),
|
|
672
597
|
tslib.__metadata("design:type", String)
|
|
673
|
-
],
|
|
598
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
674
599
|
tslib.__decorate([
|
|
675
600
|
classTransformer.Expose({ name: 'authorization_code' }),
|
|
676
601
|
tslib.__metadata("design:type", String)
|
|
677
|
-
],
|
|
602
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
678
603
|
tslib.__decorate([
|
|
679
604
|
classTransformer.Expose({ name: 'soft_descriptor' }),
|
|
680
605
|
tslib.__metadata("design:type", String)
|
|
681
|
-
],
|
|
606
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
682
607
|
tslib.__decorate([
|
|
683
608
|
classTransformer.Expose({ name: 'date_created' }),
|
|
684
609
|
tslib.__metadata("design:type", String)
|
|
685
|
-
],
|
|
610
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
686
611
|
tslib.__decorate([
|
|
687
612
|
classTransformer.Expose({ name: 'date_updated' }),
|
|
688
613
|
tslib.__metadata("design:type", String)
|
|
689
|
-
],
|
|
614
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
690
615
|
tslib.__decorate([
|
|
691
616
|
classTransformer.Expose({ name: 'authorized_amount' }),
|
|
692
617
|
tslib.__metadata("design:type", Number)
|
|
693
|
-
],
|
|
618
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
694
619
|
tslib.__decorate([
|
|
695
620
|
classTransformer.Expose({ name: 'paid_amount' }),
|
|
696
621
|
tslib.__metadata("design:type", Number)
|
|
697
|
-
],
|
|
622
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
698
623
|
tslib.__decorate([
|
|
699
624
|
classTransformer.Expose({ name: 'paid_at' }),
|
|
700
625
|
tslib.__metadata("design:type", String)
|
|
701
|
-
],
|
|
626
|
+
], Payment.prototype, "paidAt", void 0);
|
|
702
627
|
tslib.__decorate([
|
|
703
628
|
classTransformer.Expose({ name: 'refunded_amount' }),
|
|
704
629
|
tslib.__metadata("design:type", Number)
|
|
705
|
-
],
|
|
630
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
706
631
|
tslib.__decorate([
|
|
707
632
|
classTransformer.Expose({ name: 'card_holder_name' }),
|
|
708
633
|
tslib.__metadata("design:type", String)
|
|
709
|
-
],
|
|
634
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
710
635
|
tslib.__decorate([
|
|
711
636
|
classTransformer.Expose({ name: 'card_last_digits' }),
|
|
712
637
|
tslib.__metadata("design:type", String)
|
|
713
|
-
],
|
|
638
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
714
639
|
tslib.__decorate([
|
|
715
640
|
classTransformer.Expose({ name: 'card_first_digits' }),
|
|
716
641
|
tslib.__metadata("design:type", String)
|
|
717
|
-
],
|
|
642
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
718
643
|
tslib.__decorate([
|
|
719
644
|
classTransformer.Expose({ name: 'card_brand' }),
|
|
720
645
|
tslib.__metadata("design:type", String)
|
|
721
|
-
],
|
|
646
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
722
647
|
tslib.__decorate([
|
|
723
648
|
classTransformer.Expose({ name: 'card_pin_mode' }),
|
|
724
649
|
tslib.__metadata("design:type", String)
|
|
725
|
-
],
|
|
650
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
726
651
|
tslib.__decorate([
|
|
727
652
|
classTransformer.Expose({ name: 'card_magstripe_fallback' }),
|
|
728
653
|
tslib.__metadata("design:type", Boolean)
|
|
729
|
-
],
|
|
654
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
730
655
|
tslib.__decorate([
|
|
731
656
|
classTransformer.Expose({ name: 'cvm_pin' }),
|
|
732
657
|
tslib.__metadata("design:type", Boolean)
|
|
733
|
-
],
|
|
658
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
734
659
|
tslib.__decorate([
|
|
735
660
|
classTransformer.Expose({ name: 'postback_url' }),
|
|
736
661
|
tslib.__metadata("design:type", String)
|
|
737
|
-
],
|
|
662
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
738
663
|
tslib.__decorate([
|
|
739
664
|
classTransformer.Expose({ name: 'payment_method' }),
|
|
740
665
|
tslib.__metadata("design:type", String)
|
|
741
|
-
],
|
|
666
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
742
667
|
tslib.__decorate([
|
|
743
668
|
classTransformer.Expose({ name: 'capture_method' }),
|
|
744
669
|
tslib.__metadata("design:type", String)
|
|
745
|
-
],
|
|
670
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
746
671
|
tslib.__decorate([
|
|
747
672
|
classTransformer.Expose({ name: 'antifraud_score' }),
|
|
748
673
|
tslib.__metadata("design:type", String)
|
|
749
|
-
],
|
|
674
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
750
675
|
tslib.__decorate([
|
|
751
676
|
classTransformer.Expose({ name: 'boleto_url' }),
|
|
752
677
|
tslib.__metadata("design:type", String)
|
|
753
|
-
],
|
|
678
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
754
679
|
tslib.__decorate([
|
|
755
680
|
classTransformer.Expose({ name: 'boleto_barcode' }),
|
|
756
681
|
tslib.__metadata("design:type", String)
|
|
757
|
-
],
|
|
682
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
758
683
|
tslib.__decorate([
|
|
759
684
|
classTransformer.Expose({ name: 'boleto_expiration_date' }),
|
|
760
685
|
tslib.__metadata("design:type", String)
|
|
761
|
-
],
|
|
686
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
762
687
|
tslib.__decorate([
|
|
763
688
|
classTransformer.Expose({ name: 'subscription_id' }),
|
|
764
689
|
tslib.__metadata("design:type", String)
|
|
765
|
-
],
|
|
690
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
766
691
|
tslib.__decorate([
|
|
767
692
|
classTransformer.Expose({ name: 'split_rules' }),
|
|
768
693
|
tslib.__metadata("design:type", String)
|
|
769
|
-
],
|
|
694
|
+
], Payment.prototype, "splitRules", void 0);
|
|
770
695
|
tslib.__decorate([
|
|
771
696
|
classTransformer.Expose({ name: 'antifraud_metadata' }),
|
|
772
697
|
tslib.__metadata("design:type", Object)
|
|
773
|
-
],
|
|
698
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
774
699
|
tslib.__decorate([
|
|
775
700
|
classTransformer.Expose({ name: 'reference_key' }),
|
|
776
701
|
tslib.__metadata("design:type", String)
|
|
777
|
-
],
|
|
702
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
778
703
|
tslib.__decorate([
|
|
779
704
|
classTransformer.Expose({ name: 'local_transaction_id' }),
|
|
780
705
|
tslib.__metadata("design:type", String)
|
|
781
|
-
],
|
|
706
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
782
707
|
tslib.__decorate([
|
|
783
708
|
classTransformer.Expose({ name: 'local_time' }),
|
|
784
709
|
tslib.__metadata("design:type", String)
|
|
785
|
-
],
|
|
710
|
+
], Payment.prototype, "localTime", void 0);
|
|
786
711
|
tslib.__decorate([
|
|
787
712
|
classTransformer.Expose({ name: 'fraud_covered' }),
|
|
788
713
|
tslib.__metadata("design:type", Boolean)
|
|
789
|
-
],
|
|
714
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
790
715
|
tslib.__decorate([
|
|
791
716
|
classTransformer.Expose({ name: 'fraud_reimbursed' }),
|
|
792
717
|
tslib.__metadata("design:type", String)
|
|
793
|
-
],
|
|
718
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
794
719
|
tslib.__decorate([
|
|
795
720
|
classTransformer.Expose({ name: 'order_id' }),
|
|
796
721
|
tslib.__metadata("design:type", String)
|
|
797
|
-
],
|
|
722
|
+
], Payment.prototype, "orderId", void 0);
|
|
798
723
|
tslib.__decorate([
|
|
799
724
|
classTransformer.Expose({ name: 'risk_level' }),
|
|
800
725
|
tslib.__metadata("design:type", String)
|
|
801
|
-
],
|
|
726
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
802
727
|
tslib.__decorate([
|
|
803
728
|
classTransformer.Expose({ name: 'receipt_url' }),
|
|
804
729
|
tslib.__metadata("design:type", String)
|
|
805
|
-
],
|
|
730
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
806
731
|
tslib.__decorate([
|
|
807
732
|
classTransformer.Expose({ name: 'private_label' }),
|
|
808
733
|
tslib.__metadata("design:type", String)
|
|
809
|
-
],
|
|
734
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
810
735
|
tslib.__decorate([
|
|
811
736
|
classTransformer.Expose({ name: 'pix_qr_code' }),
|
|
812
737
|
tslib.__metadata("design:type", String)
|
|
813
|
-
],
|
|
738
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
814
739
|
tslib.__decorate([
|
|
815
740
|
classTransformer.Expose({ name: 'pix_expiration_date' }),
|
|
816
741
|
tslib.__metadata("design:type", String)
|
|
817
|
-
],
|
|
818
|
-
|
|
819
|
-
class Payment extends BaseModel {
|
|
820
|
-
static get identifiersFields() {
|
|
821
|
-
return ['id'];
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
tslib.__decorate([
|
|
825
|
-
classTransformer.Type(() => PaymentTransaction),
|
|
826
|
-
tslib.__metadata("design:type", PaymentTransaction)
|
|
827
|
-
], Payment.prototype, "transaction", void 0);
|
|
742
|
+
], Payment.prototype, "pixExpirationDate", void 0);
|
|
828
743
|
|
|
829
744
|
class SubscriptionPayment extends BaseModel {
|
|
830
745
|
static get identifiersFields() {
|
|
@@ -2326,8 +2241,8 @@ exports.OrderStatus = void 0;
|
|
|
2326
2241
|
class Order extends Checkout {
|
|
2327
2242
|
}
|
|
2328
2243
|
tslib.__decorate([
|
|
2329
|
-
classTransformer.Type(() =>
|
|
2330
|
-
tslib.__metadata("design:type",
|
|
2244
|
+
classTransformer.Type(() => Payment),
|
|
2245
|
+
tslib.__metadata("design:type", Payment)
|
|
2331
2246
|
], Order.prototype, "payment", void 0);
|
|
2332
2247
|
|
|
2333
2248
|
class OrderBlocked extends BaseModel {
|
|
@@ -2358,308 +2273,6 @@ tslib.__decorate([
|
|
|
2358
2273
|
tslib.__metadata("design:type", Coupon)
|
|
2359
2274
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2360
2275
|
|
|
2361
|
-
class BusinessError extends tsCustomError.CustomError {
|
|
2362
|
-
constructor(message, additionalData, type = '') {
|
|
2363
|
-
super(message);
|
|
2364
|
-
this.additionalData = additionalData;
|
|
2365
|
-
this.type = type;
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
class DuplicatedResultsError extends tsCustomError.CustomError {
|
|
2370
|
-
constructor(message) {
|
|
2371
|
-
super(message);
|
|
2372
|
-
}
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
class FraudValidationError extends tsCustomError.CustomError {
|
|
2376
|
-
constructor(message, additionalData) {
|
|
2377
|
-
super(message);
|
|
2378
|
-
this.additionalData = additionalData;
|
|
2379
|
-
this.type = 'antifraud';
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
class InvalidArgumentError extends tsCustomError.CustomError {
|
|
2384
|
-
constructor(message) {
|
|
2385
|
-
super(message);
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
class NotFoundError extends tsCustomError.CustomError {
|
|
2390
|
-
constructor(message) {
|
|
2391
|
-
super(message);
|
|
2392
|
-
}
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
class PaymentError extends tsCustomError.CustomError {
|
|
2396
|
-
constructor(message, additionalData) {
|
|
2397
|
-
super(message);
|
|
2398
|
-
this.additionalData = additionalData;
|
|
2399
|
-
this.type = 'payment';
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
class RequiredArgumentError extends tsCustomError.CustomError {
|
|
2404
|
-
constructor(args) {
|
|
2405
|
-
super(`Required arguments: ${args.join(', ')}`);
|
|
2406
|
-
this.args = args;
|
|
2407
|
-
this.arguments = args;
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
class StockLimitError extends BusinessError {
|
|
2412
|
-
constructor(message, additionalData) {
|
|
2413
|
-
super(message, additionalData);
|
|
2414
|
-
this.type = 'stock-limit';
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
class StockOutError extends BusinessError {
|
|
2419
|
-
constructor(message, additionalData) {
|
|
2420
|
-
super(message, additionalData);
|
|
2421
|
-
this.type = 'stock-out';
|
|
2422
|
-
}
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
class AntifraudBankSlipService {
|
|
2426
|
-
constructor(orderBlockedRepository) {
|
|
2427
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2428
|
-
this.MAX_ORDER_VALUE = 5000;
|
|
2429
|
-
}
|
|
2430
|
-
async validate(checkout) {
|
|
2431
|
-
var _a, _b;
|
|
2432
|
-
if (checkout.totalPrice && checkout.totalPrice > this.MAX_ORDER_VALUE && !((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber)) {
|
|
2433
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Boleto not authorized', 'Boleto', 'day');
|
|
2434
|
-
throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
|
|
2435
|
-
checkoutId: checkout.id,
|
|
2436
|
-
userEmail: checkout.user.email,
|
|
2437
|
-
info: {
|
|
2438
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2439
|
-
subtotal: checkout.subTotalPrice,
|
|
2440
|
-
total: checkout.totalPrice,
|
|
2441
|
-
},
|
|
2442
|
-
});
|
|
2443
|
-
}
|
|
2444
|
-
return true;
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
|
-
class AntifraudCardService {
|
|
2449
|
-
constructor(orderRepository, orderBlockedRepository) {
|
|
2450
|
-
this.orderRepository = orderRepository;
|
|
2451
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2452
|
-
this.LIMIT_ORDERS_DAY = 2;
|
|
2453
|
-
this.LIMIT_ORDERS_WEEK = 7;
|
|
2454
|
-
this.LIMIT_BLOCKED_ORDERS_DAY = 5;
|
|
2455
|
-
}
|
|
2456
|
-
async validate(checkout, card) {
|
|
2457
|
-
var _a, _b;
|
|
2458
|
-
if (!(await this.verifyBlockedOrderAttempts(checkout, card)))
|
|
2459
|
-
throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
|
|
2460
|
-
checkoutId: checkout.id,
|
|
2461
|
-
userEmail: checkout.user.email,
|
|
2462
|
-
info: {
|
|
2463
|
-
isSubscriber: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber,
|
|
2464
|
-
subtotal: checkout.subTotalPrice,
|
|
2465
|
-
total: checkout.totalPrice,
|
|
2466
|
-
},
|
|
2467
|
-
});
|
|
2468
|
-
if (!(await this.verifyDayAndWeekOrders(checkout, card)))
|
|
2469
|
-
throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
|
|
2470
|
-
checkoutId: checkout.id,
|
|
2471
|
-
userEmail: checkout.user.email,
|
|
2472
|
-
info: {
|
|
2473
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2474
|
-
subtotal: checkout.subTotalPrice,
|
|
2475
|
-
total: checkout.totalPrice,
|
|
2476
|
-
},
|
|
2477
|
-
});
|
|
2478
|
-
return true;
|
|
2479
|
-
}
|
|
2480
|
-
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2481
|
-
var _a, _b, _c, _d;
|
|
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`;
|
|
2484
|
-
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2485
|
-
.find({
|
|
2486
|
-
filters: {
|
|
2487
|
-
customer: { cpf: { operator: exports.Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
|
|
2488
|
-
date: [
|
|
2489
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2490
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2491
|
-
],
|
|
2492
|
-
},
|
|
2493
|
-
})
|
|
2494
|
-
.then((data) => data.data);
|
|
2495
|
-
const ordersBlockedWithEmail = await this.orderBlockedRepository
|
|
2496
|
-
.find({
|
|
2497
|
-
filters: {
|
|
2498
|
-
customer: { email: { operator: exports.Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
|
|
2499
|
-
date: [
|
|
2500
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2501
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2502
|
-
],
|
|
2503
|
-
},
|
|
2504
|
-
})
|
|
2505
|
-
.then((data) => data.data);
|
|
2506
|
-
const ordersBlockedWithCep = await this.orderBlockedRepository
|
|
2507
|
-
.find({
|
|
2508
|
-
filters: {
|
|
2509
|
-
customer: { shippingAddress: { zip: { operator: exports.Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
|
|
2510
|
-
date: [
|
|
2511
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2512
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2513
|
-
],
|
|
2514
|
-
},
|
|
2515
|
-
})
|
|
2516
|
-
.then((data) => data.data);
|
|
2517
|
-
const ordersBlockedWithPhone = await this.orderBlockedRepository
|
|
2518
|
-
.find({
|
|
2519
|
-
filters: {
|
|
2520
|
-
customer: { phoneNumber: { operator: exports.Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
|
|
2521
|
-
date: [
|
|
2522
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2523
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2524
|
-
],
|
|
2525
|
-
},
|
|
2526
|
-
})
|
|
2527
|
-
.then((data) => data.data);
|
|
2528
|
-
const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
|
|
2529
|
-
var _a;
|
|
2530
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
|
|
2531
|
-
});
|
|
2532
|
-
const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
|
|
2533
|
-
var _a, _b;
|
|
2534
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) && e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email);
|
|
2535
|
-
});
|
|
2536
|
-
const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
|
|
2537
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2538
|
-
return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
|
|
2539
|
-
e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
|
|
2540
|
-
((_d = (_c = e.customer.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip) === null || _d === void 0 ? void 0 : _d.toString()) !== ((_f = (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.zip) === null || _f === void 0 ? void 0 : _f.toString()));
|
|
2541
|
-
});
|
|
2542
|
-
const blockedAttempts = ordersBlockedWithCpf
|
|
2543
|
-
.concat(blockedUniqueEmails)
|
|
2544
|
-
.concat(blockedUniqueCeps)
|
|
2545
|
-
.concat(blockedUniquePhone);
|
|
2546
|
-
if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
|
|
2547
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
|
|
2548
|
-
return false;
|
|
2549
|
-
}
|
|
2550
|
-
return true;
|
|
2551
|
-
}
|
|
2552
|
-
async verifyDayAndWeekOrders(checkout, card) {
|
|
2553
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2554
|
-
const ordersPerDay = await this.validateOrdersByRange((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf, (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email, (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.phone, (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.zip, card, this.getDateRange('day'));
|
|
2555
|
-
for (const key in ordersPerDay) {
|
|
2556
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_DAY) {
|
|
2557
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'day');
|
|
2558
|
-
return false;
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
const ordersPerWeek = await this.validateOrdersByRange((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.cpf, (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.email, (_g = checkout.user) === null || _g === void 0 ? void 0 : _g.phone, (_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip, card, this.getDateRange('week'));
|
|
2562
|
-
for (const key in ordersPerWeek) {
|
|
2563
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
|
|
2564
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
|
|
2565
|
-
return false;
|
|
2566
|
-
}
|
|
2567
|
-
}
|
|
2568
|
-
return true;
|
|
2569
|
-
}
|
|
2570
|
-
async validateOrdersByRange(cpf, email, phone, zip, card, range) {
|
|
2571
|
-
const ordersCpf = await this.countOrdersByField('user', 'cpf', cpf, range);
|
|
2572
|
-
const ordersByEmail = await this.countOrdersByField('user', 'email', email, range);
|
|
2573
|
-
const ordersByPhone = await this.countOrdersByField('user', 'phone', phone, range);
|
|
2574
|
-
const ordersByZip = await this.countOrdersByField('shippingAddress', 'zip', zip, range);
|
|
2575
|
-
return {
|
|
2576
|
-
cpf: ordersCpf,
|
|
2577
|
-
email: ordersByEmail,
|
|
2578
|
-
phone: ordersByPhone,
|
|
2579
|
-
zip: ordersByZip,
|
|
2580
|
-
};
|
|
2581
|
-
}
|
|
2582
|
-
async countOrdersByField(property, field, value, range) {
|
|
2583
|
-
const filters = {
|
|
2584
|
-
[property]: {
|
|
2585
|
-
[field]: value,
|
|
2586
|
-
},
|
|
2587
|
-
['createdAt']: [
|
|
2588
|
-
{ operator: exports.Where.GTE, value: range.firstDate },
|
|
2589
|
-
{ operator: exports.Where.LTE, value: range.lastDate },
|
|
2590
|
-
],
|
|
2591
|
-
};
|
|
2592
|
-
const docs = await (await this.orderRepository.find({ filters })).count;
|
|
2593
|
-
return docs;
|
|
2594
|
-
}
|
|
2595
|
-
getDateRange(range = 'day') {
|
|
2596
|
-
switch (range) {
|
|
2597
|
-
case 'day':
|
|
2598
|
-
return {
|
|
2599
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2600
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2601
|
-
};
|
|
2602
|
-
case 'week':
|
|
2603
|
-
return {
|
|
2604
|
-
firstDate: dateFns.startOfDay(dateFns.subDays(new Date(), 7)).getTime(),
|
|
2605
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2606
|
-
};
|
|
2607
|
-
default:
|
|
2608
|
-
return {
|
|
2609
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2610
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2611
|
-
};
|
|
2612
|
-
}
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
class AntifraudGlampointsService {
|
|
2617
|
-
constructor() { }
|
|
2618
|
-
async validate(checkout) {
|
|
2619
|
-
return true;
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
class AntifraudPixService {
|
|
2624
|
-
constructor() { }
|
|
2625
|
-
async validate(checkout) {
|
|
2626
|
-
return true;
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
|
-
|
|
2630
|
-
class GlampointsPaymentService {
|
|
2631
|
-
constructor(paymentRepository) {
|
|
2632
|
-
this.paymentRepository = paymentRepository;
|
|
2633
|
-
}
|
|
2634
|
-
async pay(checkout) {
|
|
2635
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2636
|
-
createdAt: new Date(),
|
|
2637
|
-
updatedAt: new Date(),
|
|
2638
|
-
userId: checkout.user.id,
|
|
2639
|
-
checkoutId: checkout.id,
|
|
2640
|
-
totalPrice: checkout.totalPrice,
|
|
2641
|
-
paymentProvider: 'glampoints',
|
|
2642
|
-
transaction: {
|
|
2643
|
-
amount: 0,
|
|
2644
|
-
acquirerResponseCode: '0000',
|
|
2645
|
-
acquirerName: 'glampoints',
|
|
2646
|
-
authorizedAmount: 0,
|
|
2647
|
-
captureMethod: 'ecommerce',
|
|
2648
|
-
installments: 1,
|
|
2649
|
-
cost: 0,
|
|
2650
|
-
paidAmount: 0,
|
|
2651
|
-
paidAt: new Date().toISOString(),
|
|
2652
|
-
paymentMethod: 'glampoints',
|
|
2653
|
-
referer: 'api_key',
|
|
2654
|
-
refundedAmount: 0,
|
|
2655
|
-
status: 'paid',
|
|
2656
|
-
statusReason: 'acquirer',
|
|
2657
|
-
},
|
|
2658
|
-
}));
|
|
2659
|
-
return payment;
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
|
|
2663
2276
|
class RoundProductPricesHelper {
|
|
2664
2277
|
static roundProductPrices(product) {
|
|
2665
2278
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2680,12 +2293,6 @@ class LogDocument extends BaseModel {
|
|
|
2680
2293
|
}
|
|
2681
2294
|
}
|
|
2682
2295
|
|
|
2683
|
-
class Sequence extends BaseModel {
|
|
2684
|
-
static get identifiersFields() {
|
|
2685
|
-
return ['id'];
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
2296
|
exports.FilterType = void 0;
|
|
2690
2297
|
(function (FilterType) {
|
|
2691
2298
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2824,82 +2431,29 @@ class ShopSettings extends BaseModel {
|
|
|
2824
2431
|
}
|
|
2825
2432
|
}
|
|
2826
2433
|
|
|
2827
|
-
class
|
|
2828
|
-
constructor(
|
|
2829
|
-
|
|
2830
|
-
this.paymentRepository = paymentRepository;
|
|
2831
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2832
|
-
}
|
|
2833
|
-
createCardHash(bu) {
|
|
2834
|
-
throw new Error('Method not implemented.');
|
|
2835
|
-
}
|
|
2836
|
-
async pay(checkout, card) {
|
|
2837
|
-
try {
|
|
2838
|
-
const result = await axios__default["default"]({
|
|
2839
|
-
method: 'POST',
|
|
2840
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2841
|
-
headers: {
|
|
2842
|
-
'x-api-key': this.credentials.API_KEY,
|
|
2843
|
-
'content-type': 'application/json',
|
|
2844
|
-
},
|
|
2845
|
-
data: this.createCardPayment(checkout, card),
|
|
2846
|
-
});
|
|
2847
|
-
if (result.data.resultCode !== 'Authorised') {
|
|
2848
|
-
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2849
|
-
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`, {
|
|
2850
|
-
checkoutId: checkout.id,
|
|
2851
|
-
userEmail: checkout.user.email,
|
|
2852
|
-
info: result.data,
|
|
2853
|
-
}));
|
|
2854
|
-
}
|
|
2855
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2856
|
-
createdAt: new Date(),
|
|
2857
|
-
updatedAt: new Date(),
|
|
2858
|
-
userId: checkout.user.id,
|
|
2859
|
-
checkoutId: checkout.id,
|
|
2860
|
-
totalPrice: checkout.totalPrice,
|
|
2861
|
-
paymentProvider: 'adyen',
|
|
2862
|
-
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2863
|
-
}));
|
|
2864
|
-
return payment;
|
|
2865
|
-
}
|
|
2866
|
-
catch (error) {
|
|
2867
|
-
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', {
|
|
2868
|
-
checkoutId: checkout.id,
|
|
2869
|
-
userEmail: checkout.user.email,
|
|
2870
|
-
info: error.message,
|
|
2871
|
-
});
|
|
2872
|
-
}
|
|
2873
|
-
}
|
|
2874
|
-
createCardPayment(checkout, card) {
|
|
2875
|
-
return {
|
|
2876
|
-
amount: {
|
|
2877
|
-
currency: 'BRL',
|
|
2878
|
-
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2879
|
-
},
|
|
2880
|
-
paymentMethod: {
|
|
2881
|
-
type: 'scheme',
|
|
2882
|
-
storedPaymentMethodId: card.cardId,
|
|
2883
|
-
},
|
|
2884
|
-
reference: checkout.id,
|
|
2885
|
-
shopperInteraction: 'Ecommerce',
|
|
2886
|
-
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2887
|
-
shopperReference: checkout.user.id,
|
|
2888
|
-
recurringProcessingModel: 'CardOnFile',
|
|
2889
|
-
returnUrl: this.credentials.URL_POSTBACK,
|
|
2890
|
-
installments: {
|
|
2891
|
-
value: card.installments,
|
|
2892
|
-
},
|
|
2893
|
-
};
|
|
2434
|
+
class InvalidArgumentError extends tsCustomError.CustomError {
|
|
2435
|
+
constructor(message) {
|
|
2436
|
+
super(message);
|
|
2894
2437
|
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
class RequiredArgumentError extends tsCustomError.CustomError {
|
|
2441
|
+
constructor(args) {
|
|
2442
|
+
super(`Required arguments: ${args.join(', ')}`);
|
|
2443
|
+
this.args = args;
|
|
2444
|
+
this.arguments = args;
|
|
2897
2445
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
class NotFoundError extends tsCustomError.CustomError {
|
|
2449
|
+
constructor(message) {
|
|
2450
|
+
super(message);
|
|
2900
2451
|
}
|
|
2901
|
-
|
|
2902
|
-
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
class DuplicatedResultsError extends tsCustomError.CustomError {
|
|
2455
|
+
constructor(message) {
|
|
2456
|
+
super(message);
|
|
2903
2457
|
}
|
|
2904
2458
|
}
|
|
2905
2459
|
|
|
@@ -3801,17 +3355,6 @@ class LogFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore
|
|
|
3801
3355
|
}
|
|
3802
3356
|
}
|
|
3803
3357
|
|
|
3804
|
-
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3805
|
-
constructor({ firestore, interceptors }) {
|
|
3806
|
-
super({
|
|
3807
|
-
firestore,
|
|
3808
|
-
collectionName: 'sequences',
|
|
3809
|
-
model: Sequence,
|
|
3810
|
-
interceptors,
|
|
3811
|
-
});
|
|
3812
|
-
}
|
|
3813
|
-
}
|
|
3814
|
-
|
|
3815
3358
|
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3816
3359
|
constructor({ firestore, interceptors }) {
|
|
3817
3360
|
super({
|
|
@@ -4052,7 +3595,11 @@ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
4052
3595
|
limiteRange,
|
|
4053
3596
|
type,
|
|
4054
3597
|
card,
|
|
4055
|
-
checkout
|
|
3598
|
+
checkout: {
|
|
3599
|
+
id: checkout.id,
|
|
3600
|
+
shop: checkout.shop,
|
|
3601
|
+
total: checkout.totalPrice,
|
|
3602
|
+
},
|
|
4056
3603
|
date: new Date(),
|
|
4057
3604
|
}));
|
|
4058
3605
|
}
|
|
@@ -5725,6 +5272,41 @@ tslib.__decorate([
|
|
|
5725
5272
|
tslib.__metadata("design:returntype", Promise)
|
|
5726
5273
|
], CategoryHasuraGraphQLRepository.prototype, "isChild", null);
|
|
5727
5274
|
|
|
5275
|
+
class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5276
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5277
|
+
super({
|
|
5278
|
+
tableName: 'category_product',
|
|
5279
|
+
model: CategoryProduct,
|
|
5280
|
+
endpoint,
|
|
5281
|
+
authOptions,
|
|
5282
|
+
interceptors,
|
|
5283
|
+
fields: [{ productId: { columnName: 'product_id' } }, { categoryId: { columnName: 'category_id' } }, 'order'],
|
|
5284
|
+
});
|
|
5285
|
+
}
|
|
5286
|
+
async removeProductFromCategory(categoryId, productId) {
|
|
5287
|
+
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5288
|
+
where: {
|
|
5289
|
+
type: 'category_product_bool_exp',
|
|
5290
|
+
required: true,
|
|
5291
|
+
value: {
|
|
5292
|
+
product_id: { _eq: productId },
|
|
5293
|
+
category_id: { _eq: categoryId },
|
|
5294
|
+
},
|
|
5295
|
+
},
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
async addProductToCategory(categoryId, productId) {
|
|
5299
|
+
await this.removeProductFromCategory(categoryId, productId);
|
|
5300
|
+
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5301
|
+
objects: {
|
|
5302
|
+
type: 'category_product_insert_input!',
|
|
5303
|
+
required: true,
|
|
5304
|
+
value: { category_id: categoryId, product_id: productId },
|
|
5305
|
+
},
|
|
5306
|
+
});
|
|
5307
|
+
}
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5728
5310
|
class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5729
5311
|
constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
|
|
5730
5312
|
super({
|
|
@@ -6023,6 +5605,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6023
5605
|
fields: ['id', 'name', 'reference', 'slug'],
|
|
6024
5606
|
},
|
|
6025
5607
|
},
|
|
5608
|
+
'group',
|
|
5609
|
+
'validity',
|
|
6026
5610
|
];
|
|
6027
5611
|
this.fields = [
|
|
6028
5612
|
...commonFields,
|
|
@@ -6135,7 +5719,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6135
5719
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6136
5720
|
const id = await this.getId(plainData.id);
|
|
6137
5721
|
const product = await super.update(Object.assign({ id }, data));
|
|
6138
|
-
product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
5722
|
+
// product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
6139
5723
|
product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
|
|
6140
5724
|
product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
|
|
6141
5725
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
@@ -6595,6 +6179,8 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6595
6179
|
type: HasuraGraphQLColumnType.Jsonb,
|
|
6596
6180
|
},
|
|
6597
6181
|
},
|
|
6182
|
+
'group',
|
|
6183
|
+
'validity',
|
|
6598
6184
|
],
|
|
6599
6185
|
});
|
|
6600
6186
|
}
|
|
@@ -6951,313 +6537,6 @@ tslib.__decorate([
|
|
|
6951
6537
|
tslib.__metadata("design:returntype", Promise)
|
|
6952
6538
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6953
6539
|
|
|
6954
|
-
class PagarmeBankSlipAxiosAdapter {
|
|
6955
|
-
constructor(credentials, paymentRepository) {
|
|
6956
|
-
this.credentials = credentials;
|
|
6957
|
-
this.paymentRepository = paymentRepository;
|
|
6958
|
-
}
|
|
6959
|
-
async pay(checkout) {
|
|
6960
|
-
try {
|
|
6961
|
-
const result = await axios__default["default"]({
|
|
6962
|
-
method: 'POST',
|
|
6963
|
-
url: `${this.credentials.URL}/transactions`,
|
|
6964
|
-
data: this.createBoletoPayment(checkout),
|
|
6965
|
-
});
|
|
6966
|
-
if (result.data.status !== exports.PagarmePaymentStatus['Em processamento']) {
|
|
6967
|
-
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
6968
|
-
checkoutId: checkout.id,
|
|
6969
|
-
userEmail: checkout.user.email,
|
|
6970
|
-
info: result.data,
|
|
6971
|
-
}));
|
|
6972
|
-
}
|
|
6973
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
6974
|
-
createdAt: new Date(),
|
|
6975
|
-
updatedAt: new Date(),
|
|
6976
|
-
userId: checkout.user.id,
|
|
6977
|
-
checkoutId: checkout.id,
|
|
6978
|
-
totalPrice: checkout.totalPrice,
|
|
6979
|
-
paymentProvider: 'pagarMe',
|
|
6980
|
-
transaction: result.data,
|
|
6981
|
-
}));
|
|
6982
|
-
return payment;
|
|
6983
|
-
}
|
|
6984
|
-
catch (error) {
|
|
6985
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
6986
|
-
checkoutId: checkout.id,
|
|
6987
|
-
userEmail: checkout.user.email,
|
|
6988
|
-
info: error.response.data,
|
|
6989
|
-
});
|
|
6990
|
-
}
|
|
6991
|
-
}
|
|
6992
|
-
async getBoletoTransaction(paymentId) {
|
|
6993
|
-
try {
|
|
6994
|
-
const { data } = await axios__default["default"]({
|
|
6995
|
-
method: 'GET',
|
|
6996
|
-
url: `${this.credentials.URL}/transactions/${paymentId}`,
|
|
6997
|
-
data: {
|
|
6998
|
-
api_key: this.credentials.API_KEY,
|
|
6999
|
-
},
|
|
7000
|
-
});
|
|
7001
|
-
return data;
|
|
7002
|
-
}
|
|
7003
|
-
catch (error) {
|
|
7004
|
-
throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
|
|
7005
|
-
paymentId,
|
|
7006
|
-
info: error.response.data,
|
|
7007
|
-
});
|
|
7008
|
-
}
|
|
7009
|
-
}
|
|
7010
|
-
createBoletoPayment(checkout) {
|
|
7011
|
-
return {
|
|
7012
|
-
api_key: this.credentials.API_KEY,
|
|
7013
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7014
|
-
boleto_rules: ['strict_expiration_date'],
|
|
7015
|
-
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
7016
|
-
boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
7017
|
-
payment_method: 'boleto',
|
|
7018
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
7019
|
-
customer: {
|
|
7020
|
-
external_id: checkout.user.id,
|
|
7021
|
-
type: 'individual',
|
|
7022
|
-
country: 'br',
|
|
7023
|
-
name: checkout.user.displayName,
|
|
7024
|
-
documents: [
|
|
7025
|
-
{
|
|
7026
|
-
type: 'cpf',
|
|
7027
|
-
number: checkout.user.cpf,
|
|
7028
|
-
},
|
|
7029
|
-
],
|
|
7030
|
-
},
|
|
7031
|
-
};
|
|
7032
|
-
}
|
|
7033
|
-
}
|
|
7034
|
-
|
|
7035
|
-
class PagarmeCardAxiosAdapter {
|
|
7036
|
-
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
7037
|
-
this.credentials = credentials;
|
|
7038
|
-
this.paymentRepository = paymentRepository;
|
|
7039
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
7040
|
-
}
|
|
7041
|
-
async pay(checkout, card) {
|
|
7042
|
-
var _a;
|
|
7043
|
-
try {
|
|
7044
|
-
const result = await axios__default["default"]({
|
|
7045
|
-
method: 'POST',
|
|
7046
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7047
|
-
data: this.createCardPayment(checkout, card),
|
|
7048
|
-
});
|
|
7049
|
-
if (result.data.status !== exports.PagarmePaymentStatus.Pago) {
|
|
7050
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
7051
|
-
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`, {
|
|
7052
|
-
checkoutId: checkout.id,
|
|
7053
|
-
userEmail: checkout.user.email,
|
|
7054
|
-
info: result.data,
|
|
7055
|
-
}));
|
|
7056
|
-
}
|
|
7057
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7058
|
-
createdAt: new Date(),
|
|
7059
|
-
updatedAt: new Date(),
|
|
7060
|
-
userId: checkout.user.id,
|
|
7061
|
-
checkoutId: checkout.id,
|
|
7062
|
-
totalPrice: checkout.totalPrice,
|
|
7063
|
-
paymentProvider: exports.PaymentProviders.PAGARME,
|
|
7064
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7065
|
-
}));
|
|
7066
|
-
return payment;
|
|
7067
|
-
}
|
|
7068
|
-
catch (error) {
|
|
7069
|
-
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', {
|
|
7070
|
-
checkoutId: checkout.id,
|
|
7071
|
-
userEmail: checkout.user.email,
|
|
7072
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7073
|
-
});
|
|
7074
|
-
}
|
|
7075
|
-
}
|
|
7076
|
-
async addCard(card) {
|
|
7077
|
-
try {
|
|
7078
|
-
const { data } = await axios__default["default"]({
|
|
7079
|
-
method: 'POST',
|
|
7080
|
-
url: `${this.credentials.URL}/cards`,
|
|
7081
|
-
data: {
|
|
7082
|
-
api_key: this.credentials.API_KEY,
|
|
7083
|
-
card_number: card.number,
|
|
7084
|
-
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
7085
|
-
card_holder_name: card.name,
|
|
7086
|
-
card_cvv: card.cvv,
|
|
7087
|
-
},
|
|
7088
|
-
});
|
|
7089
|
-
return data;
|
|
7090
|
-
}
|
|
7091
|
-
catch (error) {
|
|
7092
|
-
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
7093
|
-
info: error.response.data,
|
|
7094
|
-
});
|
|
7095
|
-
}
|
|
7096
|
-
}
|
|
7097
|
-
async createCardHash(bu) {
|
|
7098
|
-
console.log('input createCardHash', bu);
|
|
7099
|
-
console.log('input this.credentials', this.credentials);
|
|
7100
|
-
const key = bu === exports.BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
|
|
7101
|
-
console.log('key', key);
|
|
7102
|
-
try {
|
|
7103
|
-
const { data } = await axios__default["default"]({
|
|
7104
|
-
method: 'GET',
|
|
7105
|
-
headers: {
|
|
7106
|
-
'content-type': 'application/json',
|
|
7107
|
-
},
|
|
7108
|
-
url: `${this.credentials.URL}/transactions/card_hash_key`,
|
|
7109
|
-
data: JSON.stringify({
|
|
7110
|
-
api_key: key,
|
|
7111
|
-
}),
|
|
7112
|
-
});
|
|
7113
|
-
return data;
|
|
7114
|
-
}
|
|
7115
|
-
catch (error) {
|
|
7116
|
-
console.log('createCardHash axios error', error);
|
|
7117
|
-
throw new BusinessError('Houve uma falha gerar o hash', {
|
|
7118
|
-
info: error.response.data,
|
|
7119
|
-
});
|
|
7120
|
-
}
|
|
7121
|
-
}
|
|
7122
|
-
async getCardByToken(id) {
|
|
7123
|
-
try {
|
|
7124
|
-
const { data } = await axios__default["default"]({
|
|
7125
|
-
method: 'POST',
|
|
7126
|
-
url: `${this.credentials.URL}/cards/${id}`,
|
|
7127
|
-
data: {
|
|
7128
|
-
api_key: this.credentials.API_KEY,
|
|
7129
|
-
},
|
|
7130
|
-
});
|
|
7131
|
-
return data;
|
|
7132
|
-
}
|
|
7133
|
-
catch (error) {
|
|
7134
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
|
|
7135
|
-
info: error.response.data,
|
|
7136
|
-
});
|
|
7137
|
-
}
|
|
7138
|
-
}
|
|
7139
|
-
async createTransaction(info) {
|
|
7140
|
-
try {
|
|
7141
|
-
const { data } = await axios__default["default"]({
|
|
7142
|
-
method: 'POST',
|
|
7143
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7144
|
-
data: Object.assign(Object.assign({}, info), { api_key: this.credentials.API_KEY }),
|
|
7145
|
-
});
|
|
7146
|
-
return data;
|
|
7147
|
-
}
|
|
7148
|
-
catch (error) {
|
|
7149
|
-
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
7150
|
-
info: error.response.data,
|
|
7151
|
-
});
|
|
7152
|
-
}
|
|
7153
|
-
}
|
|
7154
|
-
createCardPayment(checkout, card) {
|
|
7155
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7156
|
-
return {
|
|
7157
|
-
api_key: this.credentials.API_KEY,
|
|
7158
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7159
|
-
card_id: card.cardId,
|
|
7160
|
-
payment_method: 'credit_card',
|
|
7161
|
-
installments: card.installments,
|
|
7162
|
-
soft_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'Glam' : "Men's Market",
|
|
7163
|
-
customer: {
|
|
7164
|
-
external_id: checkout.user.id,
|
|
7165
|
-
name: checkout.user.displayName,
|
|
7166
|
-
type: 'individual',
|
|
7167
|
-
country: 'br',
|
|
7168
|
-
email: checkout.user.email,
|
|
7169
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7170
|
-
documents: [
|
|
7171
|
-
{
|
|
7172
|
-
type: 'cpf',
|
|
7173
|
-
number: checkout.user.cpf,
|
|
7174
|
-
},
|
|
7175
|
-
],
|
|
7176
|
-
},
|
|
7177
|
-
billing: {
|
|
7178
|
-
name: checkout.user.displayName,
|
|
7179
|
-
address: {
|
|
7180
|
-
country: 'br',
|
|
7181
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
7182
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
7183
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
7184
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
7185
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
7186
|
-
zipcode: checkout.billingAddress
|
|
7187
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
7188
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
7189
|
-
},
|
|
7190
|
-
},
|
|
7191
|
-
items: checkout.lineItems.map((item) => {
|
|
7192
|
-
return {
|
|
7193
|
-
id: item.id,
|
|
7194
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
7195
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
7196
|
-
quantity: item.quantity,
|
|
7197
|
-
tangible: true,
|
|
7198
|
-
};
|
|
7199
|
-
}),
|
|
7200
|
-
};
|
|
7201
|
-
}
|
|
7202
|
-
}
|
|
7203
|
-
|
|
7204
|
-
class PagarmePixAxiosAdapter {
|
|
7205
|
-
constructor(credentials, paymentRepository) {
|
|
7206
|
-
this.credentials = credentials;
|
|
7207
|
-
this.paymentRepository = paymentRepository;
|
|
7208
|
-
}
|
|
7209
|
-
async pay(checkout) {
|
|
7210
|
-
var _a;
|
|
7211
|
-
try {
|
|
7212
|
-
const result = await axios__default["default"]({
|
|
7213
|
-
method: 'POST',
|
|
7214
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7215
|
-
data: this.createPixPayment(checkout),
|
|
7216
|
-
});
|
|
7217
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7218
|
-
createdAt: new Date(),
|
|
7219
|
-
updatedAt: new Date(),
|
|
7220
|
-
userId: checkout.user.id,
|
|
7221
|
-
checkoutId: checkout.id,
|
|
7222
|
-
totalPrice: checkout.totalPrice,
|
|
7223
|
-
paymentProvider: 'pagarMe',
|
|
7224
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7225
|
-
}));
|
|
7226
|
-
return payment;
|
|
7227
|
-
}
|
|
7228
|
-
catch (error) {
|
|
7229
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
7230
|
-
checkoutId: checkout.id,
|
|
7231
|
-
userEmail: checkout.user.email,
|
|
7232
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7233
|
-
});
|
|
7234
|
-
}
|
|
7235
|
-
}
|
|
7236
|
-
createPixPayment(checkout) {
|
|
7237
|
-
return {
|
|
7238
|
-
payment_method: 'pix',
|
|
7239
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7240
|
-
api_key: this.credentials.API_KEY,
|
|
7241
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
7242
|
-
pix_expiration_date: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
7243
|
-
customer: {
|
|
7244
|
-
external_id: checkout.user.id,
|
|
7245
|
-
type: 'individual',
|
|
7246
|
-
country: 'br',
|
|
7247
|
-
name: checkout.user.displayName,
|
|
7248
|
-
email: checkout.user.email.trim(),
|
|
7249
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7250
|
-
documents: [
|
|
7251
|
-
{
|
|
7252
|
-
type: 'cpf',
|
|
7253
|
-
number: checkout.user.cpf,
|
|
7254
|
-
},
|
|
7255
|
-
],
|
|
7256
|
-
},
|
|
7257
|
-
};
|
|
7258
|
-
}
|
|
7259
|
-
}
|
|
7260
|
-
|
|
7261
6540
|
class VertexAxiosAdapter {
|
|
7262
6541
|
constructor(config) {
|
|
7263
6542
|
this.config = config;
|
|
@@ -7455,10 +6734,6 @@ Object.defineProperty(exports, 'sub', {
|
|
|
7455
6734
|
enumerable: true,
|
|
7456
6735
|
get: function () { return dateFns.sub; }
|
|
7457
6736
|
});
|
|
7458
|
-
Object.defineProperty(exports, 'subDays', {
|
|
7459
|
-
enumerable: true,
|
|
7460
|
-
get: function () { return dateFns.subDays; }
|
|
7461
|
-
});
|
|
7462
6737
|
Object.defineProperty(exports, 'chunk', {
|
|
7463
6738
|
enumerable: true,
|
|
7464
6739
|
get: function () { return lodash.chunk; }
|
|
@@ -7532,13 +6807,6 @@ Object.defineProperty(exports, 'unset', {
|
|
|
7532
6807
|
get: function () { return lodash.unset; }
|
|
7533
6808
|
});
|
|
7534
6809
|
exports.Address = Address;
|
|
7535
|
-
exports.AdyenCardAxiosAdapter = AdyenCardAxiosAdapter;
|
|
7536
|
-
exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
|
|
7537
|
-
exports.AntifraudBankSlipService = AntifraudBankSlipService;
|
|
7538
|
-
exports.AntifraudCardService = AntifraudCardService;
|
|
7539
|
-
exports.AntifraudGlampointsService = AntifraudGlampointsService;
|
|
7540
|
-
exports.AntifraudPixService = AntifraudPixService;
|
|
7541
|
-
exports.AntifraudProviderFactory = AntifraudProviderFactory;
|
|
7542
6810
|
exports.Authentication = Authentication;
|
|
7543
6811
|
exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
|
|
7544
6812
|
exports.AxiosAdapter = AxiosAdapter;
|
|
@@ -7546,7 +6814,6 @@ exports.Base = Base;
|
|
|
7546
6814
|
exports.BaseModel = BaseModel;
|
|
7547
6815
|
exports.BeautyProfile = BeautyProfile;
|
|
7548
6816
|
exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
|
|
7549
|
-
exports.BusinessError = BusinessError;
|
|
7550
6817
|
exports.Buy2Win = Buy2Win;
|
|
7551
6818
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
7552
6819
|
exports.Campaign = Campaign;
|
|
@@ -7563,6 +6830,8 @@ exports.CategoryFilterHasuraGraphQLRepository = CategoryFilterHasuraGraphQLRepos
|
|
|
7563
6830
|
exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
7564
6831
|
exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
|
|
7565
6832
|
exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
|
|
6833
|
+
exports.CategoryProduct = CategoryProduct;
|
|
6834
|
+
exports.CategoryProductHasuraGraphQLRepository = CategoryProductHasuraGraphQLRepository;
|
|
7566
6835
|
exports.Checkout = Checkout;
|
|
7567
6836
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
7568
6837
|
exports.CheckoutSubscription = CheckoutSubscription;
|
|
@@ -7584,9 +6853,6 @@ exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
|
7584
6853
|
exports.FilterOption = FilterOption;
|
|
7585
6854
|
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
7586
6855
|
exports.FirebaseFileUploaderService = FirebaseFileUploaderService;
|
|
7587
|
-
exports.FraudValidationError = FraudValidationError;
|
|
7588
|
-
exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
|
|
7589
|
-
exports.GlampointsPaymentService = GlampointsPaymentService;
|
|
7590
6856
|
exports.Home = Home;
|
|
7591
6857
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
7592
6858
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
@@ -7605,15 +6871,8 @@ exports.Order = Order;
|
|
|
7605
6871
|
exports.OrderBlocked = OrderBlocked;
|
|
7606
6872
|
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
7607
6873
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
7608
|
-
exports.PagarmeBankSlipAxiosAdapter = PagarmeBankSlipAxiosAdapter;
|
|
7609
|
-
exports.PagarmeCardAxiosAdapter = PagarmeCardAxiosAdapter;
|
|
7610
|
-
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
7611
|
-
exports.PagarmePixAxiosAdapter = PagarmePixAxiosAdapter;
|
|
7612
6874
|
exports.Payment = Payment;
|
|
7613
|
-
exports.PaymentError = PaymentError;
|
|
7614
6875
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
7615
|
-
exports.PaymentProviderFactory = PaymentProviderFactory;
|
|
7616
|
-
exports.PaymentTransaction = PaymentTransaction;
|
|
7617
6876
|
exports.Product = Product;
|
|
7618
6877
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
7619
6878
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
@@ -7631,16 +6890,12 @@ exports.Register = Register;
|
|
|
7631
6890
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
7632
6891
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
7633
6892
|
exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
7634
|
-
exports.Sequence = Sequence;
|
|
7635
|
-
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
7636
6893
|
exports.ShippingMethod = ShippingMethod;
|
|
7637
6894
|
exports.ShopMenu = ShopMenu;
|
|
7638
6895
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|
|
7639
6896
|
exports.ShopSettings = ShopSettings;
|
|
7640
6897
|
exports.ShopSettingsFirestoreRepository = ShopSettingsFirestoreRepository;
|
|
7641
6898
|
exports.SignOut = SignOut;
|
|
7642
|
-
exports.StockLimitError = StockLimitError;
|
|
7643
|
-
exports.StockOutError = StockOutError;
|
|
7644
6899
|
exports.Subscription = Subscription;
|
|
7645
6900
|
exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
|
|
7646
6901
|
exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
|