@infrab4a/connect 4.9.1-beta.0 → 4.9.1
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 +344 -1057
- package/index.esm.js +338 -1023
- package/package.json +2 -2
- package/src/domain/general/index.d.ts +0 -2
- package/src/domain/shopping/index.d.ts +0 -5
- package/src/domain/shopping/models/index.d.ts +0 -2
- 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/repositories/index.d.ts +0 -1
- package/src/errors/index.d.ts +2 -7
- package/src/infra/firebase/firestore/repositories/index.d.ts +2 -3
- package/src/infra/firebase/firestore/repositories/shopping/index.d.ts +0 -1
- package/src/utils/index.d.ts +2 -2
- package/src/domain/general/models/index.d.ts +0 -1
- package/src/domain/general/models/sequences.d.ts +0 -9
- package/src/domain/general/repositories/index.d.ts +0 -1
- 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/index.d.ts +0 -3
- 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 -8
- 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 -10
- 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 -5
- package/src/domain/shopping/interfaces/payment-provider-card.interface.d.ts +0 -7
- 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/order-blocked.d.ts +0 -26
- package/src/domain/shopping/models/payment-transaction.d.ts +0 -66
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +0 -6
- package/src/domain/shopping/services/adyen-card-payment.service.d.ts +0 -13
- 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 -9
- package/src/domain/shopping/services/pagarme-bank-slip-payment.service.d.ts +0 -11
- package/src/domain/shopping/services/pagarme-card-payment.service.d.ts +0 -13
- package/src/domain/shopping/services/pagarme-pix-payment.service.d.ts +0 -11
- 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/index.d.ts +0 -6
- package/src/domain/shopping/types/pagarme-credentials.type.d.ts +0 -5
- package/src/domain/shopping/types/payment-card-info.type.d.ts +0 -4
- 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 -5
- package/src/errors/types/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/general/index.d.ts +0 -1
- package/src/infra/firebase/firestore/repositories/general/sequences-firestore.repository.d.ts +0 -7
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +0 -9
package/index.cjs.js
CHANGED
|
@@ -38,65 +38,6 @@ function _interopNamespace(e) {
|
|
|
38
38
|
var tslib_1__namespace = /*#__PURE__*/_interopNamespace(tslib_1);
|
|
39
39
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
40
40
|
|
|
41
|
-
exports.antifraudProviders = void 0;
|
|
42
|
-
(function (antifraudProviders) {
|
|
43
|
-
antifraudProviders["BANKSLIP"] = "bankSlip";
|
|
44
|
-
antifraudProviders["CARD"] = "card";
|
|
45
|
-
antifraudProviders["PIX"] = "pix";
|
|
46
|
-
antifraudProviders["POINTS"] = "glampoints";
|
|
47
|
-
})(exports.antifraudProviders || (exports.antifraudProviders = {}));
|
|
48
|
-
|
|
49
|
-
exports.paymentMethods = void 0;
|
|
50
|
-
(function (paymentMethods) {
|
|
51
|
-
paymentMethods["CARD"] = "card";
|
|
52
|
-
paymentMethods["BANKSLIP"] = "bankSlip";
|
|
53
|
-
paymentMethods["PIX"] = "pix";
|
|
54
|
-
paymentMethods["POINTS"] = "glampoints";
|
|
55
|
-
})(exports.paymentMethods || (exports.paymentMethods = {}));
|
|
56
|
-
|
|
57
|
-
exports.paymentProviders = void 0;
|
|
58
|
-
(function (paymentProviders) {
|
|
59
|
-
paymentProviders["PAGARME"] = "pagarMe";
|
|
60
|
-
paymentProviders["ADYEN"] = "adyen";
|
|
61
|
-
paymentProviders["GLAMPOINTS"] = "glampoints";
|
|
62
|
-
})(exports.paymentProviders || (exports.paymentProviders = {}));
|
|
63
|
-
|
|
64
|
-
class BasePaymentMethodFactory {
|
|
65
|
-
constructor(methods) {
|
|
66
|
-
this.methods = methods;
|
|
67
|
-
}
|
|
68
|
-
build(method) {
|
|
69
|
-
return this.methods[method];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
class AdyenPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
class AntifraudProviderFactory {
|
|
77
|
-
constructor(antifraudProviders) {
|
|
78
|
-
this.antifraudProviders = antifraudProviders;
|
|
79
|
-
}
|
|
80
|
-
build(provider) {
|
|
81
|
-
return this.antifraudProviders[provider];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class GlampointsPaymentMethodFactory extends BasePaymentMethodFactory {
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
class PagarmePaymentMethodFactory extends BasePaymentMethodFactory {
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
class PaymentProviderFactory {
|
|
92
|
-
constructor(paymentProviders) {
|
|
93
|
-
this.paymentProviders = paymentProviders;
|
|
94
|
-
}
|
|
95
|
-
build(provider) {
|
|
96
|
-
return this.paymentProviders[provider];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
41
|
class BaseModel {
|
|
101
42
|
get identifier() {
|
|
102
43
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -579,178 +520,175 @@ exports.Status = void 0;
|
|
|
579
520
|
Status["CANCELLED"] = "Cancelado";
|
|
580
521
|
})(exports.Status || (exports.Status = {}));
|
|
581
522
|
|
|
582
|
-
class
|
|
523
|
+
class Payment extends BaseModel {
|
|
524
|
+
static get identifiersFields() {
|
|
525
|
+
return ['id'];
|
|
526
|
+
}
|
|
583
527
|
}
|
|
584
528
|
tslib_1.__decorate([
|
|
585
529
|
classTransformer.Expose({ name: 'refuse_reason' }),
|
|
586
530
|
tslib_1.__metadata("design:type", String)
|
|
587
|
-
],
|
|
531
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
588
532
|
tslib_1.__decorate([
|
|
589
533
|
classTransformer.Expose({ name: 'status_reason' }),
|
|
590
534
|
tslib_1.__metadata("design:type", String)
|
|
591
|
-
],
|
|
535
|
+
], Payment.prototype, "statusReason", void 0);
|
|
592
536
|
tslib_1.__decorate([
|
|
593
537
|
classTransformer.Expose({ name: 'acquirer_response_code' }),
|
|
594
538
|
tslib_1.__metadata("design:type", String)
|
|
595
|
-
],
|
|
539
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
596
540
|
tslib_1.__decorate([
|
|
597
541
|
classTransformer.Expose({ name: 'acquirer_name' }),
|
|
598
542
|
tslib_1.__metadata("design:type", String)
|
|
599
|
-
],
|
|
543
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
600
544
|
tslib_1.__decorate([
|
|
601
545
|
classTransformer.Expose({ name: 'acquirer_id' }),
|
|
602
546
|
tslib_1.__metadata("design:type", String)
|
|
603
|
-
],
|
|
547
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
604
548
|
tslib_1.__decorate([
|
|
605
549
|
classTransformer.Expose({ name: 'authorization_code' }),
|
|
606
550
|
tslib_1.__metadata("design:type", String)
|
|
607
|
-
],
|
|
551
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
608
552
|
tslib_1.__decorate([
|
|
609
553
|
classTransformer.Expose({ name: 'soft_descriptor' }),
|
|
610
554
|
tslib_1.__metadata("design:type", String)
|
|
611
|
-
],
|
|
555
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
612
556
|
tslib_1.__decorate([
|
|
613
557
|
classTransformer.Expose({ name: 'date_created' }),
|
|
614
558
|
tslib_1.__metadata("design:type", String)
|
|
615
|
-
],
|
|
559
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
616
560
|
tslib_1.__decorate([
|
|
617
561
|
classTransformer.Expose({ name: 'date_updated' }),
|
|
618
562
|
tslib_1.__metadata("design:type", String)
|
|
619
|
-
],
|
|
563
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
620
564
|
tslib_1.__decorate([
|
|
621
565
|
classTransformer.Expose({ name: 'authorized_amount' }),
|
|
622
566
|
tslib_1.__metadata("design:type", Number)
|
|
623
|
-
],
|
|
567
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
624
568
|
tslib_1.__decorate([
|
|
625
569
|
classTransformer.Expose({ name: 'paid_amount' }),
|
|
626
570
|
tslib_1.__metadata("design:type", Number)
|
|
627
|
-
],
|
|
571
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
572
|
+
tslib_1.__decorate([
|
|
573
|
+
classTransformer.Expose({ name: 'paid_at' }),
|
|
574
|
+
tslib_1.__metadata("design:type", String)
|
|
575
|
+
], Payment.prototype, "paidAt", void 0);
|
|
628
576
|
tslib_1.__decorate([
|
|
629
577
|
classTransformer.Expose({ name: 'refunded_amount' }),
|
|
630
578
|
tslib_1.__metadata("design:type", Number)
|
|
631
|
-
],
|
|
579
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
632
580
|
tslib_1.__decorate([
|
|
633
581
|
classTransformer.Expose({ name: 'card_holder_name' }),
|
|
634
582
|
tslib_1.__metadata("design:type", String)
|
|
635
|
-
],
|
|
583
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
636
584
|
tslib_1.__decorate([
|
|
637
585
|
classTransformer.Expose({ name: 'card_last_digits' }),
|
|
638
586
|
tslib_1.__metadata("design:type", String)
|
|
639
|
-
],
|
|
587
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
640
588
|
tslib_1.__decorate([
|
|
641
589
|
classTransformer.Expose({ name: 'card_first_digits' }),
|
|
642
590
|
tslib_1.__metadata("design:type", String)
|
|
643
|
-
],
|
|
591
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
644
592
|
tslib_1.__decorate([
|
|
645
593
|
classTransformer.Expose({ name: 'card_brand' }),
|
|
646
594
|
tslib_1.__metadata("design:type", String)
|
|
647
|
-
],
|
|
595
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
648
596
|
tslib_1.__decorate([
|
|
649
597
|
classTransformer.Expose({ name: 'card_pin_mode' }),
|
|
650
598
|
tslib_1.__metadata("design:type", String)
|
|
651
|
-
],
|
|
599
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
652
600
|
tslib_1.__decorate([
|
|
653
601
|
classTransformer.Expose({ name: 'card_magstripe_fallback' }),
|
|
654
602
|
tslib_1.__metadata("design:type", Boolean)
|
|
655
|
-
],
|
|
603
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
656
604
|
tslib_1.__decorate([
|
|
657
605
|
classTransformer.Expose({ name: 'cvm_pin' }),
|
|
658
606
|
tslib_1.__metadata("design:type", Boolean)
|
|
659
|
-
],
|
|
607
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
660
608
|
tslib_1.__decorate([
|
|
661
609
|
classTransformer.Expose({ name: 'postback_url' }),
|
|
662
610
|
tslib_1.__metadata("design:type", String)
|
|
663
|
-
],
|
|
611
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
664
612
|
tslib_1.__decorate([
|
|
665
613
|
classTransformer.Expose({ name: 'payment_method' }),
|
|
666
614
|
tslib_1.__metadata("design:type", String)
|
|
667
|
-
],
|
|
615
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
668
616
|
tslib_1.__decorate([
|
|
669
617
|
classTransformer.Expose({ name: 'capture_method' }),
|
|
670
618
|
tslib_1.__metadata("design:type", String)
|
|
671
|
-
],
|
|
619
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
672
620
|
tslib_1.__decorate([
|
|
673
621
|
classTransformer.Expose({ name: 'antifraud_score' }),
|
|
674
622
|
tslib_1.__metadata("design:type", String)
|
|
675
|
-
],
|
|
623
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
676
624
|
tslib_1.__decorate([
|
|
677
625
|
classTransformer.Expose({ name: 'boleto_url' }),
|
|
678
626
|
tslib_1.__metadata("design:type", String)
|
|
679
|
-
],
|
|
627
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
680
628
|
tslib_1.__decorate([
|
|
681
629
|
classTransformer.Expose({ name: 'boleto_barcode' }),
|
|
682
630
|
tslib_1.__metadata("design:type", String)
|
|
683
|
-
],
|
|
631
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
684
632
|
tslib_1.__decorate([
|
|
685
633
|
classTransformer.Expose({ name: 'boleto_expiration_date' }),
|
|
686
634
|
tslib_1.__metadata("design:type", String)
|
|
687
|
-
],
|
|
635
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
688
636
|
tslib_1.__decorate([
|
|
689
637
|
classTransformer.Expose({ name: 'subscription_id' }),
|
|
690
638
|
tslib_1.__metadata("design:type", String)
|
|
691
|
-
],
|
|
639
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
692
640
|
tslib_1.__decorate([
|
|
693
641
|
classTransformer.Expose({ name: 'split_rules' }),
|
|
694
642
|
tslib_1.__metadata("design:type", String)
|
|
695
|
-
],
|
|
643
|
+
], Payment.prototype, "splitRules", void 0);
|
|
696
644
|
tslib_1.__decorate([
|
|
697
645
|
classTransformer.Expose({ name: 'antifraud_metadata' }),
|
|
698
646
|
tslib_1.__metadata("design:type", Object)
|
|
699
|
-
],
|
|
647
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
700
648
|
tslib_1.__decorate([
|
|
701
649
|
classTransformer.Expose({ name: 'reference_key' }),
|
|
702
650
|
tslib_1.__metadata("design:type", String)
|
|
703
|
-
],
|
|
651
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
704
652
|
tslib_1.__decorate([
|
|
705
653
|
classTransformer.Expose({ name: 'local_transaction_id' }),
|
|
706
654
|
tslib_1.__metadata("design:type", String)
|
|
707
|
-
],
|
|
655
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
708
656
|
tslib_1.__decorate([
|
|
709
657
|
classTransformer.Expose({ name: 'local_time' }),
|
|
710
658
|
tslib_1.__metadata("design:type", String)
|
|
711
|
-
],
|
|
659
|
+
], Payment.prototype, "localTime", void 0);
|
|
712
660
|
tslib_1.__decorate([
|
|
713
661
|
classTransformer.Expose({ name: 'fraud_covered' }),
|
|
714
662
|
tslib_1.__metadata("design:type", Boolean)
|
|
715
|
-
],
|
|
663
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
716
664
|
tslib_1.__decorate([
|
|
717
665
|
classTransformer.Expose({ name: 'fraud_reimbursed' }),
|
|
718
666
|
tslib_1.__metadata("design:type", String)
|
|
719
|
-
],
|
|
667
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
720
668
|
tslib_1.__decorate([
|
|
721
669
|
classTransformer.Expose({ name: 'order_id' }),
|
|
722
670
|
tslib_1.__metadata("design:type", String)
|
|
723
|
-
],
|
|
671
|
+
], Payment.prototype, "orderId", void 0);
|
|
724
672
|
tslib_1.__decorate([
|
|
725
673
|
classTransformer.Expose({ name: 'risk_level' }),
|
|
726
674
|
tslib_1.__metadata("design:type", String)
|
|
727
|
-
],
|
|
675
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
728
676
|
tslib_1.__decorate([
|
|
729
677
|
classTransformer.Expose({ name: 'receipt_url' }),
|
|
730
678
|
tslib_1.__metadata("design:type", String)
|
|
731
|
-
],
|
|
679
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
732
680
|
tslib_1.__decorate([
|
|
733
681
|
classTransformer.Expose({ name: 'private_label' }),
|
|
734
682
|
tslib_1.__metadata("design:type", String)
|
|
735
|
-
],
|
|
683
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
736
684
|
tslib_1.__decorate([
|
|
737
685
|
classTransformer.Expose({ name: 'pix_qr_code' }),
|
|
738
686
|
tslib_1.__metadata("design:type", String)
|
|
739
|
-
],
|
|
687
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
740
688
|
tslib_1.__decorate([
|
|
741
689
|
classTransformer.Expose({ name: 'pix_expiration_date' }),
|
|
742
690
|
tslib_1.__metadata("design:type", String)
|
|
743
|
-
],
|
|
744
|
-
|
|
745
|
-
class Payment extends BaseModel {
|
|
746
|
-
static get identifiersFields() {
|
|
747
|
-
return ['id'];
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
tslib_1.__decorate([
|
|
751
|
-
classTransformer.Type(() => PaymentTransaction),
|
|
752
|
-
tslib_1.__metadata("design:type", PaymentTransaction)
|
|
753
|
-
], Payment.prototype, "transaction", void 0);
|
|
691
|
+
], Payment.prototype, "pixExpirationDate", void 0);
|
|
754
692
|
|
|
755
693
|
class SubscriptionPayment extends BaseModel {
|
|
756
694
|
static get identifiersFields() {
|
|
@@ -2361,16 +2299,10 @@ exports.OrderStatus = void 0;
|
|
|
2361
2299
|
class Order extends Checkout {
|
|
2362
2300
|
}
|
|
2363
2301
|
tslib_1.__decorate([
|
|
2364
|
-
classTransformer.Type(() =>
|
|
2365
|
-
tslib_1.__metadata("design:type",
|
|
2302
|
+
classTransformer.Type(() => Payment),
|
|
2303
|
+
tslib_1.__metadata("design:type", Payment)
|
|
2366
2304
|
], Order.prototype, "payment", void 0);
|
|
2367
2305
|
|
|
2368
|
-
class OrderBlocked extends BaseModel {
|
|
2369
|
-
static get identifiersFields() {
|
|
2370
|
-
return ['id'];
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
2306
|
class CheckoutSubscription extends BaseModel {
|
|
2375
2307
|
static get identifiersFields() {
|
|
2376
2308
|
return ['id'];
|
|
@@ -2393,591 +2325,6 @@ tslib_1.__decorate([
|
|
|
2393
2325
|
tslib_1.__metadata("design:type", Coupon)
|
|
2394
2326
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2395
2327
|
|
|
2396
|
-
class BusinessError extends tsCustomError.CustomError {
|
|
2397
|
-
constructor(message, additionalData, type = '') {
|
|
2398
|
-
super(message);
|
|
2399
|
-
this.additionalData = additionalData;
|
|
2400
|
-
this.type = type;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
class DuplicatedResultsError extends tsCustomError.CustomError {
|
|
2405
|
-
constructor(message) {
|
|
2406
|
-
super(message);
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
class FraudValidationError extends tsCustomError.CustomError {
|
|
2411
|
-
constructor(message, additionalData) {
|
|
2412
|
-
super(message);
|
|
2413
|
-
this.additionalData = additionalData;
|
|
2414
|
-
this.type = 'antifraud';
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
class InvalidArgumentError extends tsCustomError.CustomError {
|
|
2419
|
-
constructor(message) {
|
|
2420
|
-
super(message);
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
|
|
2424
|
-
class NotFoundError extends tsCustomError.CustomError {
|
|
2425
|
-
constructor(message) {
|
|
2426
|
-
super(message);
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
|
|
2430
|
-
class PaymentError extends tsCustomError.CustomError {
|
|
2431
|
-
constructor(message, additionalData) {
|
|
2432
|
-
super(message);
|
|
2433
|
-
this.additionalData = additionalData;
|
|
2434
|
-
this.type = 'payment';
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
class RequiredArgumentError extends tsCustomError.CustomError {
|
|
2439
|
-
constructor(args) {
|
|
2440
|
-
super(`Required arguments: ${args.join(', ')}`);
|
|
2441
|
-
this.args = args;
|
|
2442
|
-
this.arguments = args;
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
class StockLimitError extends BusinessError {
|
|
2447
|
-
constructor(message, additionalData) {
|
|
2448
|
-
super(message, additionalData);
|
|
2449
|
-
this.type = 'stock-limit';
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
class StockOutError extends BusinessError {
|
|
2454
|
-
constructor(message, additionalData) {
|
|
2455
|
-
super(message, additionalData);
|
|
2456
|
-
this.type = 'stock-out';
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
|
|
2460
|
-
class AdyenCardService {
|
|
2461
|
-
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
2462
|
-
this.credentials = credentials;
|
|
2463
|
-
this.paymentRepository = paymentRepository;
|
|
2464
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2465
|
-
}
|
|
2466
|
-
async pay(checkout, card) {
|
|
2467
|
-
try {
|
|
2468
|
-
const result = await axios__default["default"]({
|
|
2469
|
-
method: 'POST',
|
|
2470
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2471
|
-
headers: {
|
|
2472
|
-
'x-api-key': this.credentials.API_KEY,
|
|
2473
|
-
'content-type': 'application/json',
|
|
2474
|
-
},
|
|
2475
|
-
data: this.createCardPayment(checkout, card),
|
|
2476
|
-
});
|
|
2477
|
-
if (result.data.resultCode !== 'Authorised') {
|
|
2478
|
-
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2479
|
-
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`, {
|
|
2480
|
-
checkoutId: checkout.id,
|
|
2481
|
-
userEmail: checkout.user.email,
|
|
2482
|
-
info: result.data,
|
|
2483
|
-
}));
|
|
2484
|
-
}
|
|
2485
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2486
|
-
createdAt: new Date(),
|
|
2487
|
-
updatedAt: new Date(),
|
|
2488
|
-
userId: checkout.user.id,
|
|
2489
|
-
checkoutId: checkout.id,
|
|
2490
|
-
totalPrice: checkout.totalPrice,
|
|
2491
|
-
paymentProvider: 'adyen',
|
|
2492
|
-
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2493
|
-
}));
|
|
2494
|
-
return payment;
|
|
2495
|
-
}
|
|
2496
|
-
catch (error) {
|
|
2497
|
-
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', {
|
|
2498
|
-
checkoutId: checkout.id,
|
|
2499
|
-
userEmail: checkout.user.email,
|
|
2500
|
-
info: error.message,
|
|
2501
|
-
});
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
createCardPayment(checkout, card) {
|
|
2505
|
-
return {
|
|
2506
|
-
amount: {
|
|
2507
|
-
currency: 'BRL',
|
|
2508
|
-
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2509
|
-
},
|
|
2510
|
-
paymentMethod: {
|
|
2511
|
-
type: 'scheme',
|
|
2512
|
-
storedPaymentMethodId: card.cardId,
|
|
2513
|
-
},
|
|
2514
|
-
reference: checkout.id,
|
|
2515
|
-
shopperInteraction: 'Ecommerce',
|
|
2516
|
-
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2517
|
-
shopperReference: checkout.user.id,
|
|
2518
|
-
recurringProcessingModel: 'CardOnFile',
|
|
2519
|
-
returnUrl: this.credentials.URL_POSTBACK,
|
|
2520
|
-
installments: {
|
|
2521
|
-
value: card.installments,
|
|
2522
|
-
},
|
|
2523
|
-
};
|
|
2524
|
-
}
|
|
2525
|
-
addCard() {
|
|
2526
|
-
throw new Error('Method not implemented.');
|
|
2527
|
-
}
|
|
2528
|
-
}
|
|
2529
|
-
|
|
2530
|
-
class AntifraudBankSlipService {
|
|
2531
|
-
constructor(orderBlockedRepository) {
|
|
2532
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2533
|
-
this.MAX_ORDER_VALUE = 5000;
|
|
2534
|
-
}
|
|
2535
|
-
async validate(checkout) {
|
|
2536
|
-
var _a, _b;
|
|
2537
|
-
if (checkout.totalPrice && checkout.totalPrice > this.MAX_ORDER_VALUE && !((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber)) {
|
|
2538
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Boleto not authorized', 'Boleto', 'day');
|
|
2539
|
-
throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
|
|
2540
|
-
checkoutId: checkout.id,
|
|
2541
|
-
userEmail: checkout.user.email,
|
|
2542
|
-
info: {
|
|
2543
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2544
|
-
subtotal: checkout.subTotalPrice,
|
|
2545
|
-
total: checkout.totalPrice,
|
|
2546
|
-
},
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
return true;
|
|
2550
|
-
}
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
class AntifraudCardService {
|
|
2554
|
-
constructor(orderRepository, orderBlockedRepository) {
|
|
2555
|
-
this.orderRepository = orderRepository;
|
|
2556
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2557
|
-
this.LIMIT_ORDERS_DAY = 2;
|
|
2558
|
-
this.LIMIT_ORDERS_WEEK = 7;
|
|
2559
|
-
this.LIMIT_BLOCKED_ORDERS_DAY = 5;
|
|
2560
|
-
}
|
|
2561
|
-
async validate(checkout, card) {
|
|
2562
|
-
var _a, _b;
|
|
2563
|
-
if (!(await this.verifyBlockedOrderAttempts(checkout, card)))
|
|
2564
|
-
throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
|
|
2565
|
-
checkoutId: checkout.id,
|
|
2566
|
-
userEmail: checkout.user.email,
|
|
2567
|
-
info: {
|
|
2568
|
-
isSubscriber: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber,
|
|
2569
|
-
subtotal: checkout.subTotalPrice,
|
|
2570
|
-
total: checkout.totalPrice,
|
|
2571
|
-
},
|
|
2572
|
-
});
|
|
2573
|
-
if (!(await this.verifyDayAndWeekOrders(checkout, card)))
|
|
2574
|
-
throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
|
|
2575
|
-
checkoutId: checkout.id,
|
|
2576
|
-
userEmail: checkout.user.email,
|
|
2577
|
-
info: {
|
|
2578
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2579
|
-
subtotal: checkout.subTotalPrice,
|
|
2580
|
-
total: checkout.totalPrice,
|
|
2581
|
-
},
|
|
2582
|
-
});
|
|
2583
|
-
return true;
|
|
2584
|
-
}
|
|
2585
|
-
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2586
|
-
var _a, _b, _c, _d;
|
|
2587
|
-
const day = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T00:00:00`;
|
|
2588
|
-
const endOfDay = `${dateFns.format(new Date(), 'YYYY-MM-DD')}T23:59:59`;
|
|
2589
|
-
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2590
|
-
.find({
|
|
2591
|
-
filters: {
|
|
2592
|
-
customer: { cpf: { operator: exports.Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
|
|
2593
|
-
date: [
|
|
2594
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2595
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2596
|
-
],
|
|
2597
|
-
},
|
|
2598
|
-
})
|
|
2599
|
-
.then((data) => data.data);
|
|
2600
|
-
const ordersBlockedWithEmail = await this.orderBlockedRepository
|
|
2601
|
-
.find({
|
|
2602
|
-
filters: {
|
|
2603
|
-
customer: { email: { operator: exports.Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
|
|
2604
|
-
date: [
|
|
2605
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2606
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2607
|
-
],
|
|
2608
|
-
},
|
|
2609
|
-
})
|
|
2610
|
-
.then((data) => data.data);
|
|
2611
|
-
const ordersBlockedWithCep = await this.orderBlockedRepository
|
|
2612
|
-
.find({
|
|
2613
|
-
filters: {
|
|
2614
|
-
customer: { shippingAddress: { zip: { operator: exports.Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
|
|
2615
|
-
date: [
|
|
2616
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2617
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2618
|
-
],
|
|
2619
|
-
},
|
|
2620
|
-
})
|
|
2621
|
-
.then((data) => data.data);
|
|
2622
|
-
const ordersBlockedWithPhone = await this.orderBlockedRepository
|
|
2623
|
-
.find({
|
|
2624
|
-
filters: {
|
|
2625
|
-
customer: { phoneNumber: { operator: exports.Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
|
|
2626
|
-
date: [
|
|
2627
|
-
{ operator: exports.Where.GTE, value: new Date(day) },
|
|
2628
|
-
{ operator: exports.Where.LTE, value: new Date(endOfDay) },
|
|
2629
|
-
],
|
|
2630
|
-
},
|
|
2631
|
-
})
|
|
2632
|
-
.then((data) => data.data);
|
|
2633
|
-
const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
|
|
2634
|
-
var _a;
|
|
2635
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
|
|
2636
|
-
});
|
|
2637
|
-
const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
|
|
2638
|
-
var _a, _b;
|
|
2639
|
-
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);
|
|
2640
|
-
});
|
|
2641
|
-
const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
|
|
2642
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2643
|
-
return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
|
|
2644
|
-
e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
|
|
2645
|
-
((_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()));
|
|
2646
|
-
});
|
|
2647
|
-
const blockedAttempts = ordersBlockedWithCpf
|
|
2648
|
-
.concat(blockedUniqueEmails)
|
|
2649
|
-
.concat(blockedUniqueCeps)
|
|
2650
|
-
.concat(blockedUniquePhone);
|
|
2651
|
-
if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
|
|
2652
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
|
|
2653
|
-
return false;
|
|
2654
|
-
}
|
|
2655
|
-
return true;
|
|
2656
|
-
}
|
|
2657
|
-
async verifyDayAndWeekOrders(checkout, card) {
|
|
2658
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2659
|
-
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'));
|
|
2660
|
-
for (const key in ordersPerDay) {
|
|
2661
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_DAY) {
|
|
2662
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'day');
|
|
2663
|
-
return false;
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
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'));
|
|
2667
|
-
for (const key in ordersPerWeek) {
|
|
2668
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
|
|
2669
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
|
|
2670
|
-
return false;
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
return true;
|
|
2674
|
-
}
|
|
2675
|
-
async validateOrdersByRange(cpf, email, phone, zip, card, range) {
|
|
2676
|
-
const ordersCpf = await this.countOrdersByField('user', 'cpf', cpf, range);
|
|
2677
|
-
const ordersByEmail = await this.countOrdersByField('user', 'email', email, range);
|
|
2678
|
-
const ordersByPhone = await this.countOrdersByField('user', 'phone', phone, range);
|
|
2679
|
-
const ordersByZip = await this.countOrdersByField('shippingAddress', 'zip', zip, range);
|
|
2680
|
-
return {
|
|
2681
|
-
cpf: ordersCpf,
|
|
2682
|
-
email: ordersByEmail,
|
|
2683
|
-
phone: ordersByPhone,
|
|
2684
|
-
zip: ordersByZip,
|
|
2685
|
-
};
|
|
2686
|
-
}
|
|
2687
|
-
async countOrdersByField(property, field, value, range) {
|
|
2688
|
-
const filters = {
|
|
2689
|
-
[property]: {
|
|
2690
|
-
[field]: value,
|
|
2691
|
-
},
|
|
2692
|
-
['createdAt']: [
|
|
2693
|
-
{ operator: exports.Where.GTE, value: range.firstDate },
|
|
2694
|
-
{ operator: exports.Where.LTE, value: range.lastDate },
|
|
2695
|
-
],
|
|
2696
|
-
};
|
|
2697
|
-
const docs = await (await this.orderRepository.find({ filters })).count;
|
|
2698
|
-
return docs;
|
|
2699
|
-
}
|
|
2700
|
-
getDateRange(range = 'day') {
|
|
2701
|
-
switch (range) {
|
|
2702
|
-
case 'day':
|
|
2703
|
-
return {
|
|
2704
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2705
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2706
|
-
};
|
|
2707
|
-
case 'week':
|
|
2708
|
-
return {
|
|
2709
|
-
firstDate: dateFns.startOfDay(dateFns.subDays(new Date(), 7)).getTime(),
|
|
2710
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2711
|
-
};
|
|
2712
|
-
default:
|
|
2713
|
-
return {
|
|
2714
|
-
firstDate: dateFns.startOfDay(new Date()).getTime(),
|
|
2715
|
-
lastDate: dateFns.endOfDay(new Date()).getTime(),
|
|
2716
|
-
};
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
class AntifraudGlampointsService {
|
|
2722
|
-
constructor() { }
|
|
2723
|
-
async validate(checkout) {
|
|
2724
|
-
return true;
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
|
|
2728
|
-
class AntifraudPixService {
|
|
2729
|
-
constructor() { }
|
|
2730
|
-
async validate(checkout) {
|
|
2731
|
-
return true;
|
|
2732
|
-
}
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
class GlampointsPaymentService {
|
|
2736
|
-
constructor(paymentRepository) {
|
|
2737
|
-
this.paymentRepository = paymentRepository;
|
|
2738
|
-
}
|
|
2739
|
-
async pay(checkout) {
|
|
2740
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2741
|
-
createdAt: new Date(),
|
|
2742
|
-
updatedAt: new Date(),
|
|
2743
|
-
userId: checkout.user.id,
|
|
2744
|
-
checkoutId: checkout.id,
|
|
2745
|
-
totalPrice: checkout.totalPrice,
|
|
2746
|
-
paymentProvider: 'glampoints',
|
|
2747
|
-
transaction: {
|
|
2748
|
-
amount: 0,
|
|
2749
|
-
acquirerResponseCode: '0000',
|
|
2750
|
-
acquirerName: 'glampoints',
|
|
2751
|
-
authorizedAmount: 0,
|
|
2752
|
-
captureMethod: 'ecommerce',
|
|
2753
|
-
installments: 1,
|
|
2754
|
-
cost: 0,
|
|
2755
|
-
paidAmount: 0,
|
|
2756
|
-
paymentMethod: 'glampoints',
|
|
2757
|
-
referer: 'api_key',
|
|
2758
|
-
refundedAmount: 0,
|
|
2759
|
-
status: 'paid',
|
|
2760
|
-
statusReason: 'acquirer',
|
|
2761
|
-
},
|
|
2762
|
-
}));
|
|
2763
|
-
return payment;
|
|
2764
|
-
}
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
class PagarmeBankSlipService {
|
|
2768
|
-
constructor(credentials, paymentRepository) {
|
|
2769
|
-
this.credentials = credentials;
|
|
2770
|
-
this.paymentRepository = paymentRepository;
|
|
2771
|
-
}
|
|
2772
|
-
async pay(checkout) {
|
|
2773
|
-
try {
|
|
2774
|
-
const result = await axios__default["default"]({
|
|
2775
|
-
method: 'POST',
|
|
2776
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2777
|
-
data: this.createBoletoPayment(checkout),
|
|
2778
|
-
});
|
|
2779
|
-
if (result.data.status !== 'processing') {
|
|
2780
|
-
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
2781
|
-
checkoutId: checkout.id,
|
|
2782
|
-
userEmail: checkout.user.email,
|
|
2783
|
-
info: result.data,
|
|
2784
|
-
}));
|
|
2785
|
-
}
|
|
2786
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2787
|
-
createdAt: new Date(),
|
|
2788
|
-
updatedAt: new Date(),
|
|
2789
|
-
userId: checkout.user.id,
|
|
2790
|
-
checkoutId: checkout.id,
|
|
2791
|
-
totalPrice: checkout.totalPrice,
|
|
2792
|
-
paymentProvider: 'pagarMe',
|
|
2793
|
-
transaction: result.data,
|
|
2794
|
-
}));
|
|
2795
|
-
return payment;
|
|
2796
|
-
}
|
|
2797
|
-
catch (error) {
|
|
2798
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
2799
|
-
checkoutId: checkout.id,
|
|
2800
|
-
userEmail: checkout.user.email,
|
|
2801
|
-
info: error.response.data,
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
createBoletoPayment(checkout) {
|
|
2806
|
-
return {
|
|
2807
|
-
api_key: this.credentials.API_KEY,
|
|
2808
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2809
|
-
boleto_rules: ['strict_expiration_date'],
|
|
2810
|
-
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
2811
|
-
boleto_expiration_date: dateFns.format(dateFns.addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
2812
|
-
payment_method: 'boleto',
|
|
2813
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
2814
|
-
customer: {
|
|
2815
|
-
external_id: checkout.user.id,
|
|
2816
|
-
type: 'individual',
|
|
2817
|
-
country: 'br',
|
|
2818
|
-
name: checkout.user.displayName,
|
|
2819
|
-
documents: [
|
|
2820
|
-
{
|
|
2821
|
-
type: 'cpf',
|
|
2822
|
-
number: checkout.user.cpf,
|
|
2823
|
-
},
|
|
2824
|
-
],
|
|
2825
|
-
},
|
|
2826
|
-
};
|
|
2827
|
-
}
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
class PagarmeCardService {
|
|
2831
|
-
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
2832
|
-
this.credentials = credentials;
|
|
2833
|
-
this.paymentRepository = paymentRepository;
|
|
2834
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2835
|
-
}
|
|
2836
|
-
async pay(checkout, card) {
|
|
2837
|
-
var _a;
|
|
2838
|
-
try {
|
|
2839
|
-
const result = await axios__default["default"]({
|
|
2840
|
-
method: 'POST',
|
|
2841
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2842
|
-
data: this.createCardPayment(checkout, card),
|
|
2843
|
-
});
|
|
2844
|
-
if (result.data.status !== 'paid') {
|
|
2845
|
-
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2846
|
-
return Promise.reject(new PaymentError(`Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito`, {
|
|
2847
|
-
checkoutId: checkout.id,
|
|
2848
|
-
userEmail: checkout.user.email,
|
|
2849
|
-
info: result.data,
|
|
2850
|
-
}));
|
|
2851
|
-
}
|
|
2852
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2853
|
-
createdAt: new Date(),
|
|
2854
|
-
updatedAt: new Date(),
|
|
2855
|
-
userId: checkout.user.id,
|
|
2856
|
-
checkoutId: checkout.id,
|
|
2857
|
-
totalPrice: checkout.totalPrice,
|
|
2858
|
-
paymentProvider: 'pagarMe',
|
|
2859
|
-
transaction: result.data,
|
|
2860
|
-
}));
|
|
2861
|
-
return payment;
|
|
2862
|
-
}
|
|
2863
|
-
catch (error) {
|
|
2864
|
-
throw new PaymentError('Seu pagamento com cartão não foi autorizado. Para não perder seus produtos, pague com PIX ou outro cartão de crédito', {
|
|
2865
|
-
checkoutId: checkout.id,
|
|
2866
|
-
userEmail: checkout.user.email,
|
|
2867
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
2868
|
-
});
|
|
2869
|
-
}
|
|
2870
|
-
}
|
|
2871
|
-
addCard() {
|
|
2872
|
-
throw new Error('Method not implemented.');
|
|
2873
|
-
}
|
|
2874
|
-
createCardPayment(checkout, card) {
|
|
2875
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2876
|
-
return {
|
|
2877
|
-
api_key: this.credentials.API_KEY,
|
|
2878
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2879
|
-
card_id: card.cardId,
|
|
2880
|
-
payment_method: 'credit_card',
|
|
2881
|
-
installments: card.installments,
|
|
2882
|
-
soft_descriptor: checkout.shop,
|
|
2883
|
-
customer: {
|
|
2884
|
-
external_id: checkout.user.id,
|
|
2885
|
-
name: checkout.user.displayName,
|
|
2886
|
-
type: 'individual',
|
|
2887
|
-
country: 'br',
|
|
2888
|
-
email: checkout.user.email,
|
|
2889
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2890
|
-
documents: [
|
|
2891
|
-
{
|
|
2892
|
-
type: 'cpf',
|
|
2893
|
-
number: checkout.user.cpf,
|
|
2894
|
-
},
|
|
2895
|
-
],
|
|
2896
|
-
},
|
|
2897
|
-
billing: {
|
|
2898
|
-
name: checkout.user.displayName,
|
|
2899
|
-
address: {
|
|
2900
|
-
country: 'br',
|
|
2901
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
2902
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
2903
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
2904
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
2905
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
2906
|
-
zipcode: checkout.billingAddress
|
|
2907
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
2908
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
2909
|
-
},
|
|
2910
|
-
},
|
|
2911
|
-
items: checkout.lineItems.map((item) => {
|
|
2912
|
-
return {
|
|
2913
|
-
id: item.id,
|
|
2914
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
2915
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
2916
|
-
quantity: item.quantity,
|
|
2917
|
-
tangible: true,
|
|
2918
|
-
};
|
|
2919
|
-
}),
|
|
2920
|
-
};
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
|
|
2924
|
-
class PagarmePixService {
|
|
2925
|
-
constructor(credentials, paymentRepository) {
|
|
2926
|
-
this.credentials = credentials;
|
|
2927
|
-
this.paymentRepository = paymentRepository;
|
|
2928
|
-
}
|
|
2929
|
-
async pay(checkout) {
|
|
2930
|
-
var _a;
|
|
2931
|
-
try {
|
|
2932
|
-
const result = await axios__default["default"]({
|
|
2933
|
-
method: 'POST',
|
|
2934
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2935
|
-
data: this.createPixPayment(checkout),
|
|
2936
|
-
});
|
|
2937
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2938
|
-
createdAt: new Date(),
|
|
2939
|
-
updatedAt: new Date(),
|
|
2940
|
-
userId: checkout.user.id,
|
|
2941
|
-
checkoutId: checkout.id,
|
|
2942
|
-
totalPrice: checkout.totalPrice,
|
|
2943
|
-
paymentProvider: 'pagarMe',
|
|
2944
|
-
transaction: result.data,
|
|
2945
|
-
}));
|
|
2946
|
-
return payment;
|
|
2947
|
-
}
|
|
2948
|
-
catch (error) {
|
|
2949
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
2950
|
-
checkoutId: checkout.id,
|
|
2951
|
-
userEmail: checkout.user.email,
|
|
2952
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
2953
|
-
});
|
|
2954
|
-
}
|
|
2955
|
-
}
|
|
2956
|
-
createPixPayment(checkout) {
|
|
2957
|
-
return {
|
|
2958
|
-
payment_method: 'pix',
|
|
2959
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
2960
|
-
api_key: this.credentials.API_KEY,
|
|
2961
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
2962
|
-
pix_expiration_date: dateFns.format(dateFns.addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
2963
|
-
customer: {
|
|
2964
|
-
external_id: checkout.user.id,
|
|
2965
|
-
type: 'individual',
|
|
2966
|
-
country: 'br',
|
|
2967
|
-
name: checkout.user.displayName,
|
|
2968
|
-
email: checkout.user.email.trim(),
|
|
2969
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
2970
|
-
documents: [
|
|
2971
|
-
{
|
|
2972
|
-
type: 'cpf',
|
|
2973
|
-
number: checkout.user.cpf,
|
|
2974
|
-
},
|
|
2975
|
-
],
|
|
2976
|
-
},
|
|
2977
|
-
};
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
|
|
2981
2328
|
class RoundProductPricesHelper {
|
|
2982
2329
|
static roundProductPrices(product) {
|
|
2983
2330
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2992,12 +2339,6 @@ class RoundProductPricesHelper {
|
|
|
2992
2339
|
}
|
|
2993
2340
|
}
|
|
2994
2341
|
|
|
2995
|
-
class Sequence extends BaseModel {
|
|
2996
|
-
static get identifiersFields() {
|
|
2997
|
-
return ['id'];
|
|
2998
|
-
}
|
|
2999
|
-
}
|
|
3000
|
-
|
|
3001
2342
|
exports.FilterType = void 0;
|
|
3002
2343
|
(function (FilterType) {
|
|
3003
2344
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -3136,17 +2477,43 @@ class ShopSettings extends BaseModel {
|
|
|
3136
2477
|
}
|
|
3137
2478
|
}
|
|
3138
2479
|
|
|
3139
|
-
class
|
|
3140
|
-
constructor(
|
|
3141
|
-
|
|
3142
|
-
this.logger = DebugHelper.from(this);
|
|
2480
|
+
class InvalidArgumentError extends tsCustomError.CustomError {
|
|
2481
|
+
constructor(message) {
|
|
2482
|
+
super(message);
|
|
3143
2483
|
}
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
class RequiredArgumentError extends tsCustomError.CustomError {
|
|
2487
|
+
constructor(args) {
|
|
2488
|
+
super(`Required arguments: ${args.join(', ')}`);
|
|
2489
|
+
this.args = args;
|
|
2490
|
+
this.arguments = args;
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
class NotFoundError extends tsCustomError.CustomError {
|
|
2495
|
+
constructor(message) {
|
|
2496
|
+
super(message);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
class DuplicatedResultsError extends tsCustomError.CustomError {
|
|
2501
|
+
constructor(message) {
|
|
2502
|
+
super(message);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
class AxiosAdapter {
|
|
2507
|
+
constructor(config) {
|
|
2508
|
+
this.config = config;
|
|
2509
|
+
this.logger = DebugHelper.from(this);
|
|
2510
|
+
}
|
|
2511
|
+
async get(index, id) {
|
|
2512
|
+
const logger = this.logger.with('get');
|
|
2513
|
+
const req = {
|
|
2514
|
+
url: `${this.config.url}/${index}/_doc/${id}`,
|
|
2515
|
+
method: 'GET',
|
|
2516
|
+
responseType: 'json',
|
|
3150
2517
|
headers: {
|
|
3151
2518
|
'Content-Type': 'application/json',
|
|
3152
2519
|
Authorization: `ApiKey ${this.config.credential}`,
|
|
@@ -3828,6 +3195,180 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
3828
3195
|
};
|
|
3829
3196
|
};
|
|
3830
3197
|
|
|
3198
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3199
|
+
constructor({ firestore, interceptors }) {
|
|
3200
|
+
super({
|
|
3201
|
+
firestore,
|
|
3202
|
+
collectionName: 'leads',
|
|
3203
|
+
model: Lead,
|
|
3204
|
+
interceptors,
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
|
|
3209
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3210
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3211
|
+
super({
|
|
3212
|
+
firestore,
|
|
3213
|
+
collectionName: 'editions',
|
|
3214
|
+
parentIdField: 'subscriptionId',
|
|
3215
|
+
model: Edition,
|
|
3216
|
+
interceptors,
|
|
3217
|
+
});
|
|
3218
|
+
this.parentRepository = parentRepository;
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3223
|
+
constructor({ firestore, interceptors, }) {
|
|
3224
|
+
super({
|
|
3225
|
+
firestore,
|
|
3226
|
+
collectionName: 'subscription',
|
|
3227
|
+
model: Subscription,
|
|
3228
|
+
interceptors,
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
class SubscriptionMaterializationFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3234
|
+
constructor({ firestore, interceptors }) {
|
|
3235
|
+
super({
|
|
3236
|
+
firestore,
|
|
3237
|
+
collectionName: 'subscriptionMaterialization',
|
|
3238
|
+
model: SubscriptionMaterialization,
|
|
3239
|
+
interceptors,
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
|
|
3244
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3245
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3246
|
+
super({
|
|
3247
|
+
firestore,
|
|
3248
|
+
collectionName: 'payments',
|
|
3249
|
+
parentIdField: 'subscriptionId',
|
|
3250
|
+
model: SubscriptionPayment,
|
|
3251
|
+
interceptors,
|
|
3252
|
+
});
|
|
3253
|
+
this.parentRepository = parentRepository;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
class SubscriptionSummaryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3258
|
+
constructor({ firestore, interceptors, }) {
|
|
3259
|
+
super({
|
|
3260
|
+
firestore,
|
|
3261
|
+
collectionName: 'subscriptionSummary',
|
|
3262
|
+
model: SubscriptionSummary,
|
|
3263
|
+
interceptors,
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3269
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3270
|
+
super({
|
|
3271
|
+
firestore,
|
|
3272
|
+
collectionName: 'address',
|
|
3273
|
+
parentIdField: 'userId',
|
|
3274
|
+
model: UserAddress,
|
|
3275
|
+
interceptors,
|
|
3276
|
+
});
|
|
3277
|
+
this.parentRepository = parentRepository;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3282
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3283
|
+
super({
|
|
3284
|
+
firestore,
|
|
3285
|
+
collectionName: 'CX',
|
|
3286
|
+
parentIdField: 'userId',
|
|
3287
|
+
model: BeautyProfile,
|
|
3288
|
+
interceptors,
|
|
3289
|
+
});
|
|
3290
|
+
this.parentRepository = parentRepository;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
|
|
3294
|
+
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3295
|
+
constructor({ firestore, interceptors }) {
|
|
3296
|
+
super({
|
|
3297
|
+
firestore,
|
|
3298
|
+
collectionName: 'users',
|
|
3299
|
+
model: User,
|
|
3300
|
+
interceptors,
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
async get(identifiers) {
|
|
3304
|
+
const user = await super.get({ id: identifiers.id });
|
|
3305
|
+
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
3306
|
+
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
3307
|
+
return user;
|
|
3308
|
+
}
|
|
3309
|
+
async checkIfExistsByField(field, value) {
|
|
3310
|
+
const result = await this.find({ filters: { [field]: value } });
|
|
3311
|
+
return result.count > 0;
|
|
3312
|
+
}
|
|
3313
|
+
buildModelInstance() {
|
|
3314
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3315
|
+
return {
|
|
3316
|
+
toFirestore: (data) => {
|
|
3317
|
+
const plain = toFirestore(data);
|
|
3318
|
+
delete plain.isSubscriber;
|
|
3319
|
+
return plain;
|
|
3320
|
+
},
|
|
3321
|
+
fromFirestore,
|
|
3322
|
+
};
|
|
3323
|
+
}
|
|
3324
|
+
async getBeautyProfile(userId) {
|
|
3325
|
+
const beautyProfile = await this.firestore
|
|
3326
|
+
.getCollection(`${this.collectionName}/${userId}/CX`)
|
|
3327
|
+
.withConverter(this.buildBeautyProfileModelInstance())
|
|
3328
|
+
.getDoc('beautyProfile')
|
|
3329
|
+
.get();
|
|
3330
|
+
return beautyProfile.data();
|
|
3331
|
+
}
|
|
3332
|
+
async checkIfIsSubscriber(userId) {
|
|
3333
|
+
const docs = await this.collection('subscription')
|
|
3334
|
+
.where('user.id', '==', userId)
|
|
3335
|
+
.where('status', '==', 'active')
|
|
3336
|
+
.getDocs();
|
|
3337
|
+
return !!docs && !!docs.size;
|
|
3338
|
+
}
|
|
3339
|
+
buildBeautyProfileModelInstance() {
|
|
3340
|
+
return {
|
|
3341
|
+
toFirestore: (data) => data.toPlain(),
|
|
3342
|
+
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
tslib_1.__decorate([
|
|
3347
|
+
Log(),
|
|
3348
|
+
tslib_1.__metadata("design:type", Function),
|
|
3349
|
+
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
3350
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
3351
|
+
], UserFirestoreRepository.prototype, "get", null);
|
|
3352
|
+
tslib_1.__decorate([
|
|
3353
|
+
Log(),
|
|
3354
|
+
tslib_1.__metadata("design:type", Function),
|
|
3355
|
+
tslib_1.__metadata("design:paramtypes", [String, String]),
|
|
3356
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
3357
|
+
], UserFirestoreRepository.prototype, "checkIfExistsByField", null);
|
|
3358
|
+
|
|
3359
|
+
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3360
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
3361
|
+
super({
|
|
3362
|
+
firestore,
|
|
3363
|
+
collectionName: 'payment_method',
|
|
3364
|
+
parentIdField: 'userId',
|
|
3365
|
+
model: UserPaymentMethod,
|
|
3366
|
+
interceptors,
|
|
3367
|
+
});
|
|
3368
|
+
this.parentRepository = parentRepository;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3831
3372
|
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3832
3373
|
constructor({ firestore, interceptors }) {
|
|
3833
3374
|
super({
|
|
@@ -3971,137 +3512,42 @@ class ProductFirestoreRepository extends withCrudFirestore(withHelpers(withFires
|
|
|
3971
3512
|
findCatalog(params) {
|
|
3972
3513
|
return this.find(params);
|
|
3973
3514
|
}
|
|
3974
|
-
async fetchPaginatedReviews() {
|
|
3975
|
-
return Promise.resolve([]);
|
|
3976
|
-
}
|
|
3977
|
-
}
|
|
3978
|
-
tslib_1.__decorate([
|
|
3979
|
-
Log(),
|
|
3980
|
-
tslib_1.__metadata("design:type", Function),
|
|
3981
|
-
tslib_1.__metadata("design:paramtypes", [String]),
|
|
3982
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
3983
|
-
], ProductFirestoreRepository.prototype, "getBySlug", null);
|
|
3984
|
-
tslib_1.__decorate([
|
|
3985
|
-
Log(),
|
|
3986
|
-
tslib_1.__metadata("design:type", Function),
|
|
3987
|
-
tslib_1.__metadata("design:paramtypes", [String]),
|
|
3988
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
3989
|
-
], ProductFirestoreRepository.prototype, "fetchReviews", null);
|
|
3990
|
-
|
|
3991
|
-
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3992
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
3993
|
-
super({
|
|
3994
|
-
firestore,
|
|
3995
|
-
collectionName: 'variants',
|
|
3996
|
-
parentIdField: 'productId',
|
|
3997
|
-
model: Variant,
|
|
3998
|
-
interceptors,
|
|
3999
|
-
});
|
|
4000
|
-
this.parentRepository = parentRepository;
|
|
4001
|
-
}
|
|
4002
|
-
}
|
|
4003
|
-
|
|
4004
|
-
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4005
|
-
constructor({ firestore, interceptors }) {
|
|
4006
|
-
super({
|
|
4007
|
-
firestore,
|
|
4008
|
-
collectionName: 'subscriptionProducts',
|
|
4009
|
-
model: Product,
|
|
4010
|
-
interceptors,
|
|
4011
|
-
});
|
|
4012
|
-
}
|
|
4013
|
-
}
|
|
4014
|
-
|
|
4015
|
-
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4016
|
-
constructor({ firestore, interceptors }) {
|
|
4017
|
-
super({
|
|
4018
|
-
firestore,
|
|
4019
|
-
collectionName: 'sequences',
|
|
4020
|
-
model: Sequence,
|
|
4021
|
-
interceptors,
|
|
4022
|
-
});
|
|
4023
|
-
}
|
|
4024
|
-
}
|
|
4025
|
-
|
|
4026
|
-
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4027
|
-
constructor({ firestore, interceptors }) {
|
|
4028
|
-
super({
|
|
4029
|
-
firestore,
|
|
4030
|
-
collectionName: 'dms',
|
|
4031
|
-
model: Home,
|
|
4032
|
-
interceptors,
|
|
4033
|
-
});
|
|
4034
|
-
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
4035
|
-
var _a, _b, _c;
|
|
4036
|
-
return ({
|
|
4037
|
-
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
4038
|
-
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
4039
|
-
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
4040
|
-
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
4041
|
-
});
|
|
4042
|
-
};
|
|
4043
|
-
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
4044
|
-
var _a;
|
|
4045
|
-
return ({
|
|
4046
|
-
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
4047
|
-
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
4048
|
-
});
|
|
4049
|
-
};
|
|
4050
|
-
}
|
|
4051
|
-
buildModelInstance() {
|
|
4052
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
4053
|
-
return {
|
|
4054
|
-
toFirestore: (data) => {
|
|
4055
|
-
const modifiedData = this.homeToFirestore(data);
|
|
4056
|
-
return toFirestore(modifiedData);
|
|
4057
|
-
},
|
|
4058
|
-
fromFirestore: (snap) => {
|
|
4059
|
-
const instance = fromFirestore(snap);
|
|
4060
|
-
return this.homeFromFirestore(instance);
|
|
4061
|
-
},
|
|
4062
|
-
};
|
|
4063
|
-
}
|
|
4064
|
-
homeToFirestore(home) {
|
|
4065
|
-
var _a, _b, _c, _d;
|
|
4066
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
4067
|
-
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
4068
|
-
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
4069
|
-
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
4070
|
-
}
|
|
4071
|
-
return home;
|
|
4072
|
-
}
|
|
4073
|
-
homeFromFirestore(home) {
|
|
4074
|
-
var _a;
|
|
4075
|
-
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
4076
|
-
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
4077
|
-
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
4078
|
-
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
4079
|
-
home.data.createdAt =
|
|
4080
|
-
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
4081
|
-
home.data.expiresAt =
|
|
4082
|
-
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
4083
|
-
}
|
|
4084
|
-
return home;
|
|
4085
|
-
}
|
|
4086
|
-
}
|
|
3515
|
+
async fetchPaginatedReviews() {
|
|
3516
|
+
return Promise.resolve([]);
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
tslib_1.__decorate([
|
|
3520
|
+
Log(),
|
|
3521
|
+
tslib_1.__metadata("design:type", Function),
|
|
3522
|
+
tslib_1.__metadata("design:paramtypes", [String]),
|
|
3523
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
3524
|
+
], ProductFirestoreRepository.prototype, "getBySlug", null);
|
|
3525
|
+
tslib_1.__decorate([
|
|
3526
|
+
Log(),
|
|
3527
|
+
tslib_1.__metadata("design:type", Function),
|
|
3528
|
+
tslib_1.__metadata("design:paramtypes", [String]),
|
|
3529
|
+
tslib_1.__metadata("design:returntype", Promise)
|
|
3530
|
+
], ProductFirestoreRepository.prototype, "fetchReviews", null);
|
|
4087
3531
|
|
|
4088
|
-
class
|
|
4089
|
-
constructor({ firestore, interceptors }) {
|
|
3532
|
+
class ProductVariantFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
3533
|
+
constructor({ firestore, interceptors }, parentRepository) {
|
|
4090
3534
|
super({
|
|
4091
3535
|
firestore,
|
|
4092
|
-
collectionName: '
|
|
4093
|
-
|
|
3536
|
+
collectionName: 'variants',
|
|
3537
|
+
parentIdField: 'productId',
|
|
3538
|
+
model: Variant,
|
|
4094
3539
|
interceptors,
|
|
4095
3540
|
});
|
|
3541
|
+
this.parentRepository = parentRepository;
|
|
4096
3542
|
}
|
|
4097
3543
|
}
|
|
4098
3544
|
|
|
4099
|
-
class
|
|
4100
|
-
constructor({ firestore, interceptors
|
|
3545
|
+
class SubscriptionProductFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3546
|
+
constructor({ firestore, interceptors }) {
|
|
4101
3547
|
super({
|
|
4102
3548
|
firestore,
|
|
4103
|
-
collectionName: '
|
|
4104
|
-
model:
|
|
3549
|
+
collectionName: 'subscriptionProducts',
|
|
3550
|
+
model: Product,
|
|
4105
3551
|
interceptors,
|
|
4106
3552
|
});
|
|
4107
3553
|
}
|
|
@@ -4237,47 +3683,6 @@ class LegacyOrderFirestoreRepository extends OrderFirestoreRepository {
|
|
|
4237
3683
|
}
|
|
4238
3684
|
}
|
|
4239
3685
|
|
|
4240
|
-
class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4241
|
-
constructor({ firestore, interceptors, }) {
|
|
4242
|
-
super({
|
|
4243
|
-
firestore,
|
|
4244
|
-
collectionName: 'paymentBlockedAttempts',
|
|
4245
|
-
model: OrderBlocked,
|
|
4246
|
-
interceptors,
|
|
4247
|
-
});
|
|
4248
|
-
}
|
|
4249
|
-
async createBlockedOrderOrPayment(checkout, blockType, type, limiteRange, card = null) {
|
|
4250
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4251
|
-
return this.create(OrderBlocked.toInstance({
|
|
4252
|
-
customer: {
|
|
4253
|
-
name: ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.displayName) || '',
|
|
4254
|
-
cpf: ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.cpf) || '',
|
|
4255
|
-
id: (_c = checkout.user) === null || _c === void 0 ? void 0 : _c.id,
|
|
4256
|
-
email: ((_d = checkout.user) === null || _d === void 0 ? void 0 : _d.email) || '',
|
|
4257
|
-
phoneNumber: '+55' + ((_e = checkout.user) === null || _e === void 0 ? void 0 : _e.phone),
|
|
4258
|
-
isSubscriber: (_f = checkout.user) === null || _f === void 0 ? void 0 : _f.isSubscriber,
|
|
4259
|
-
subscriptionPlan: ((_g = checkout.user) === null || _g === void 0 ? void 0 : _g.subscriptionPlan) || '',
|
|
4260
|
-
shippingAddress: Object.assign(Object.assign({}, checkout.shippingAddress), { zip: this.formatZip((_h = checkout.shippingAddress) === null || _h === void 0 ? void 0 : _h.zip) }),
|
|
4261
|
-
},
|
|
4262
|
-
blockType,
|
|
4263
|
-
limiteRange,
|
|
4264
|
-
type,
|
|
4265
|
-
card,
|
|
4266
|
-
checkout: {
|
|
4267
|
-
id: checkout.id,
|
|
4268
|
-
shop: checkout.shop,
|
|
4269
|
-
total: checkout.totalPrice,
|
|
4270
|
-
},
|
|
4271
|
-
date: new Date(),
|
|
4272
|
-
}));
|
|
4273
|
-
}
|
|
4274
|
-
formatZip(zip) {
|
|
4275
|
-
if (zip.length === 8)
|
|
4276
|
-
return zip.substring(0, 5) + '-' + zip.substring(5, 8);
|
|
4277
|
-
return zip;
|
|
4278
|
-
}
|
|
4279
|
-
}
|
|
4280
|
-
|
|
4281
3686
|
class PaymentFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4282
3687
|
constructor({ firestore, interceptors }) {
|
|
4283
3688
|
super({
|
|
@@ -4300,177 +3705,87 @@ class SubscriptionPlanFirestoreRepository extends withCrudFirestore(withHelpers(
|
|
|
4300
3705
|
}
|
|
4301
3706
|
}
|
|
4302
3707
|
|
|
4303
|
-
class
|
|
3708
|
+
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4304
3709
|
constructor({ firestore, interceptors }) {
|
|
4305
3710
|
super({
|
|
4306
3711
|
firestore,
|
|
4307
|
-
collectionName: '
|
|
4308
|
-
model:
|
|
3712
|
+
collectionName: 'dms',
|
|
3713
|
+
model: Home,
|
|
4309
3714
|
interceptors,
|
|
4310
3715
|
});
|
|
3716
|
+
this.homeCategoryGroupToPlain = (homeCategoryGroup) => {
|
|
3717
|
+
var _a, _b, _c;
|
|
3718
|
+
return ({
|
|
3719
|
+
category: ((_a = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _a === void 0 ? void 0 : _a.toPlain)
|
|
3720
|
+
? (_b = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category) === null || _b === void 0 ? void 0 : _b.toPlain()
|
|
3721
|
+
: homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category,
|
|
3722
|
+
products: ((_c = homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.products) === null || _c === void 0 ? void 0 : _c.map((product) => ((product === null || product === void 0 ? void 0 : product.toPlain) ? product === null || product === void 0 ? void 0 : product.toPlain() : product)).filter(Boolean)) || [],
|
|
3723
|
+
});
|
|
3724
|
+
};
|
|
3725
|
+
this.plainToHomeCategoryGroup = (homeCategoryGroup) => {
|
|
3726
|
+
var _a;
|
|
3727
|
+
return ({
|
|
3728
|
+
category: Category.toInstance(homeCategoryGroup === null || homeCategoryGroup === void 0 ? void 0 : homeCategoryGroup.category),
|
|
3729
|
+
products: (_a = homeCategoryGroup.products) === null || _a === void 0 ? void 0 : _a.map((product) => Product.toInstance(product)),
|
|
3730
|
+
});
|
|
3731
|
+
};
|
|
4311
3732
|
}
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
3733
|
+
buildModelInstance() {
|
|
3734
|
+
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
3735
|
+
return {
|
|
3736
|
+
toFirestore: (data) => {
|
|
3737
|
+
const modifiedData = this.homeToFirestore(data);
|
|
3738
|
+
return toFirestore(modifiedData);
|
|
3739
|
+
},
|
|
3740
|
+
fromFirestore: (snap) => {
|
|
3741
|
+
const instance = fromFirestore(snap);
|
|
3742
|
+
return this.homeFromFirestore(instance);
|
|
3743
|
+
},
|
|
3744
|
+
};
|
|
4324
3745
|
}
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
interceptors,
|
|
4334
|
-
});
|
|
3746
|
+
homeToFirestore(home) {
|
|
3747
|
+
var _a, _b, _c, _d;
|
|
3748
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3749
|
+
home.data.data.discoverProducts = ((_b = home.data.data.discoverProducts) === null || _b === void 0 ? void 0 : _b.map(this.homeCategoryGroupToPlain)) || [];
|
|
3750
|
+
home.data.data.featuredProducts = ((_c = home.data.data.featuredProducts) === null || _c === void 0 ? void 0 : _c.map(this.homeCategoryGroupToPlain)) || [];
|
|
3751
|
+
home.data.data.verticalProducts = ((_d = home.data.data.verticalProducts) === null || _d === void 0 ? void 0 : _d.map(this.homeCategoryGroupToPlain)) || [];
|
|
3752
|
+
}
|
|
3753
|
+
return home;
|
|
4335
3754
|
}
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
3755
|
+
homeFromFirestore(home) {
|
|
3756
|
+
var _a;
|
|
3757
|
+
if ((_a = home.data) === null || _a === void 0 ? void 0 : _a.data) {
|
|
3758
|
+
home.data.data.discoverProducts = home.data.data.discoverProducts.map(this.plainToHomeCategoryGroup);
|
|
3759
|
+
home.data.data.featuredProducts = home.data.data.featuredProducts.map(this.plainToHomeCategoryGroup);
|
|
3760
|
+
home.data.data.verticalProducts = home.data.data.verticalProducts.map(this.plainToHomeCategoryGroup);
|
|
3761
|
+
home.data.createdAt =
|
|
3762
|
+
home.data.createdAt instanceof firestore.Timestamp ? home.data.createdAt.toDate() : home.data.createdAt;
|
|
3763
|
+
home.data.expiresAt =
|
|
3764
|
+
home.data.expiresAt instanceof firestore.Timestamp ? home.data.expiresAt.toDate() : home.data.expiresAt;
|
|
3765
|
+
}
|
|
3766
|
+
return home;
|
|
4346
3767
|
}
|
|
4347
3768
|
}
|
|
4348
3769
|
|
|
4349
|
-
class
|
|
4350
|
-
constructor({ firestore, interceptors }
|
|
3770
|
+
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3771
|
+
constructor({ firestore, interceptors }) {
|
|
4351
3772
|
super({
|
|
4352
3773
|
firestore,
|
|
4353
|
-
collectionName: '
|
|
4354
|
-
|
|
4355
|
-
model: SubscriptionPayment,
|
|
3774
|
+
collectionName: 'shopMenus',
|
|
3775
|
+
model: ShopMenu,
|
|
4356
3776
|
interceptors,
|
|
4357
3777
|
});
|
|
4358
|
-
this.parentRepository = parentRepository;
|
|
4359
3778
|
}
|
|
4360
3779
|
}
|
|
4361
3780
|
|
|
4362
|
-
class
|
|
3781
|
+
class ShopSettingsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4363
3782
|
constructor({ firestore, interceptors, }) {
|
|
4364
3783
|
super({
|
|
4365
3784
|
firestore,
|
|
4366
|
-
collectionName: '
|
|
4367
|
-
model:
|
|
4368
|
-
interceptors,
|
|
4369
|
-
});
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
|
|
4373
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4374
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
4375
|
-
super({
|
|
4376
|
-
firestore,
|
|
4377
|
-
collectionName: 'address',
|
|
4378
|
-
parentIdField: 'userId',
|
|
4379
|
-
model: UserAddress,
|
|
4380
|
-
interceptors,
|
|
4381
|
-
});
|
|
4382
|
-
this.parentRepository = parentRepository;
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
|
|
4386
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4387
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
4388
|
-
super({
|
|
4389
|
-
firestore,
|
|
4390
|
-
collectionName: 'CX',
|
|
4391
|
-
parentIdField: 'userId',
|
|
4392
|
-
model: BeautyProfile,
|
|
4393
|
-
interceptors,
|
|
4394
|
-
});
|
|
4395
|
-
this.parentRepository = parentRepository;
|
|
4396
|
-
}
|
|
4397
|
-
}
|
|
4398
|
-
|
|
4399
|
-
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
4400
|
-
constructor({ firestore, interceptors }) {
|
|
4401
|
-
super({
|
|
4402
|
-
firestore,
|
|
4403
|
-
collectionName: 'users',
|
|
4404
|
-
model: User,
|
|
4405
|
-
interceptors,
|
|
4406
|
-
});
|
|
4407
|
-
}
|
|
4408
|
-
async get(identifiers) {
|
|
4409
|
-
const user = await super.get({ id: identifiers.id });
|
|
4410
|
-
user.beautyProfile = await this.getBeautyProfile(user.id);
|
|
4411
|
-
user.isSubscriber = await this.checkIfIsSubscriber(user.id);
|
|
4412
|
-
return user;
|
|
4413
|
-
}
|
|
4414
|
-
async checkIfExistsByField(field, value) {
|
|
4415
|
-
const result = await this.find({ filters: { [field]: value } });
|
|
4416
|
-
return result.count > 0;
|
|
4417
|
-
}
|
|
4418
|
-
buildModelInstance() {
|
|
4419
|
-
const { fromFirestore, toFirestore } = super.buildModelInstance();
|
|
4420
|
-
return {
|
|
4421
|
-
toFirestore: (data) => {
|
|
4422
|
-
const plain = toFirestore(data);
|
|
4423
|
-
delete plain.isSubscriber;
|
|
4424
|
-
return plain;
|
|
4425
|
-
},
|
|
4426
|
-
fromFirestore,
|
|
4427
|
-
};
|
|
4428
|
-
}
|
|
4429
|
-
async getBeautyProfile(userId) {
|
|
4430
|
-
const beautyProfile = await this.firestore
|
|
4431
|
-
.getCollection(`${this.collectionName}/${userId}/CX`)
|
|
4432
|
-
.withConverter(this.buildBeautyProfileModelInstance())
|
|
4433
|
-
.getDoc('beautyProfile')
|
|
4434
|
-
.get();
|
|
4435
|
-
return beautyProfile.data();
|
|
4436
|
-
}
|
|
4437
|
-
async checkIfIsSubscriber(userId) {
|
|
4438
|
-
const docs = await this.collection('subscription')
|
|
4439
|
-
.where('user.id', '==', userId)
|
|
4440
|
-
.where('status', '==', 'active')
|
|
4441
|
-
.getDocs();
|
|
4442
|
-
return !!docs && !!docs.size;
|
|
4443
|
-
}
|
|
4444
|
-
buildBeautyProfileModelInstance() {
|
|
4445
|
-
return {
|
|
4446
|
-
toFirestore: (data) => data.toPlain(),
|
|
4447
|
-
fromFirestore: (snap) => BeautyProfile.toInstance(snap.data()),
|
|
4448
|
-
};
|
|
4449
|
-
}
|
|
4450
|
-
}
|
|
4451
|
-
tslib_1.__decorate([
|
|
4452
|
-
Log(),
|
|
4453
|
-
tslib_1.__metadata("design:type", Function),
|
|
4454
|
-
tslib_1.__metadata("design:paramtypes", [Object]),
|
|
4455
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
4456
|
-
], UserFirestoreRepository.prototype, "get", null);
|
|
4457
|
-
tslib_1.__decorate([
|
|
4458
|
-
Log(),
|
|
4459
|
-
tslib_1.__metadata("design:type", Function),
|
|
4460
|
-
tslib_1.__metadata("design:paramtypes", [String, String]),
|
|
4461
|
-
tslib_1.__metadata("design:returntype", Promise)
|
|
4462
|
-
], UserFirestoreRepository.prototype, "checkIfExistsByField", null);
|
|
4463
|
-
|
|
4464
|
-
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base)))) {
|
|
4465
|
-
constructor({ firestore, interceptors }, parentRepository) {
|
|
4466
|
-
super({
|
|
4467
|
-
firestore,
|
|
4468
|
-
collectionName: 'payment_method',
|
|
4469
|
-
parentIdField: 'userId',
|
|
4470
|
-
model: UserPaymentMethod,
|
|
3785
|
+
collectionName: 'shopSettings',
|
|
3786
|
+
model: ShopSettings,
|
|
4471
3787
|
interceptors,
|
|
4472
3788
|
});
|
|
4473
|
-
this.parentRepository = parentRepository;
|
|
4474
3789
|
}
|
|
4475
3790
|
}
|
|
4476
3791
|
|
|
@@ -7009,10 +6324,6 @@ Object.defineProperty(exports, 'sub', {
|
|
|
7009
6324
|
enumerable: true,
|
|
7010
6325
|
get: function () { return dateFns.sub; }
|
|
7011
6326
|
});
|
|
7012
|
-
Object.defineProperty(exports, 'subDays', {
|
|
7013
|
-
enumerable: true,
|
|
7014
|
-
get: function () { return dateFns.subDays; }
|
|
7015
|
-
});
|
|
7016
6327
|
Object.defineProperty(exports, 'chunk', {
|
|
7017
6328
|
enumerable: true,
|
|
7018
6329
|
get: function () { return lodash.chunk; }
|
|
@@ -7086,13 +6397,6 @@ Object.defineProperty(exports, 'unset', {
|
|
|
7086
6397
|
get: function () { return lodash.unset; }
|
|
7087
6398
|
});
|
|
7088
6399
|
exports.Address = Address;
|
|
7089
|
-
exports.AdyenCardService = AdyenCardService;
|
|
7090
|
-
exports.AdyenPaymentMethodFactory = AdyenPaymentMethodFactory;
|
|
7091
|
-
exports.AntifraudBankSlipService = AntifraudBankSlipService;
|
|
7092
|
-
exports.AntifraudCardService = AntifraudCardService;
|
|
7093
|
-
exports.AntifraudGlampointsService = AntifraudGlampointsService;
|
|
7094
|
-
exports.AntifraudPixService = AntifraudPixService;
|
|
7095
|
-
exports.AntifraudProviderFactory = AntifraudProviderFactory;
|
|
7096
6400
|
exports.Authentication = Authentication;
|
|
7097
6401
|
exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;
|
|
7098
6402
|
exports.AxiosAdapter = AxiosAdapter;
|
|
@@ -7100,7 +6404,6 @@ exports.Base = Base;
|
|
|
7100
6404
|
exports.BaseModel = BaseModel;
|
|
7101
6405
|
exports.BeautyProfile = BeautyProfile;
|
|
7102
6406
|
exports.BeautyQuestionsHelper = BeautyQuestionsHelper;
|
|
7103
|
-
exports.BusinessError = BusinessError;
|
|
7104
6407
|
exports.Buy2Win = Buy2Win;
|
|
7105
6408
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
7106
6409
|
exports.Campaign = Campaign;
|
|
@@ -7138,9 +6441,6 @@ exports.FilterHasuraGraphQLRepository = FilterHasuraGraphQLRepository;
|
|
|
7138
6441
|
exports.FilterOption = FilterOption;
|
|
7139
6442
|
exports.FilterOptionHasuraGraphQLRepository = FilterOptionHasuraGraphQLRepository;
|
|
7140
6443
|
exports.FirebaseFileUploaderService = FirebaseFileUploaderService;
|
|
7141
|
-
exports.FraudValidationError = FraudValidationError;
|
|
7142
|
-
exports.GlampointsPaymentMethodFactory = GlampointsPaymentMethodFactory;
|
|
7143
|
-
exports.GlampointsPaymentService = GlampointsPaymentService;
|
|
7144
6444
|
exports.Home = Home;
|
|
7145
6445
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
7146
6446
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
@@ -7154,18 +6454,9 @@ exports.Log = Log;
|
|
|
7154
6454
|
exports.Logger = Logger;
|
|
7155
6455
|
exports.NotFoundError = NotFoundError;
|
|
7156
6456
|
exports.Order = Order;
|
|
7157
|
-
exports.OrderBlocked = OrderBlocked;
|
|
7158
|
-
exports.OrderBlockedFirestoreRepository = OrderBlockedFirestoreRepository;
|
|
7159
6457
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
7160
|
-
exports.PagarmeBankSlipService = PagarmeBankSlipService;
|
|
7161
|
-
exports.PagarmeCardService = PagarmeCardService;
|
|
7162
|
-
exports.PagarmePaymentMethodFactory = PagarmePaymentMethodFactory;
|
|
7163
|
-
exports.PagarmePixService = PagarmePixService;
|
|
7164
6458
|
exports.Payment = Payment;
|
|
7165
|
-
exports.PaymentError = PaymentError;
|
|
7166
6459
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
7167
|
-
exports.PaymentProviderFactory = PaymentProviderFactory;
|
|
7168
|
-
exports.PaymentTransaction = PaymentTransaction;
|
|
7169
6460
|
exports.Product = Product;
|
|
7170
6461
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
7171
6462
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
@@ -7182,16 +6473,12 @@ exports.Register = Register;
|
|
|
7182
6473
|
exports.RegisterFirebaseAuthService = RegisterFirebaseAuthService;
|
|
7183
6474
|
exports.RequiredArgumentError = RequiredArgumentError;
|
|
7184
6475
|
exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
7185
|
-
exports.Sequence = Sequence;
|
|
7186
|
-
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
7187
6476
|
exports.ShippingMethod = ShippingMethod;
|
|
7188
6477
|
exports.ShopMenu = ShopMenu;
|
|
7189
6478
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|
|
7190
6479
|
exports.ShopSettings = ShopSettings;
|
|
7191
6480
|
exports.ShopSettingsFirestoreRepository = ShopSettingsFirestoreRepository;
|
|
7192
6481
|
exports.SignOut = SignOut;
|
|
7193
|
-
exports.StockLimitError = StockLimitError;
|
|
7194
|
-
exports.StockOutError = StockOutError;
|
|
7195
6482
|
exports.Subscription = Subscription;
|
|
7196
6483
|
exports.SubscriptionEditionFirestoreRepository = SubscriptionEditionFirestoreRepository;
|
|
7197
6484
|
exports.SubscriptionFirestoreRepository = SubscriptionFirestoreRepository;
|