@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.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { __decorate, __metadata, __values, __spreadArray, __read, __extends, __rest } from 'tslib';
|
|
3
3
|
import { plainToInstance, instanceToPlain, Type, Expose } from 'class-transformer';
|
|
4
|
-
import { parseISO
|
|
5
|
-
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub
|
|
4
|
+
import { parseISO } from 'date-fns';
|
|
5
|
+
export { add, addBusinessDays, addDays, addMonths, addYears, endOfDay, format, formatISO9075, parseISO, startOfDay, sub } from 'date-fns';
|
|
6
6
|
import { isNil, isArray, first, last, flatten, compact, get, isString, each, unset, isObject, set, isNumber, chunk, isEmpty, isDate, isBoolean, isInteger, isNaN as isNaN$1, sortBy, omit } from 'lodash';
|
|
7
7
|
export { chunk, each, get, isBoolean, isDate, isEmpty, isInteger, isNaN, isNil, isNumber, isObject, isString, now, omit, pick, set, sortBy, unset } from 'lodash';
|
|
8
8
|
import { debug } from 'debug';
|
|
@@ -13,90 +13,6 @@ import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc
|
|
|
13
13
|
import { ref, uploadBytes } from 'firebase/storage';
|
|
14
14
|
import { mutation, query as query$1 } from 'gql-query-builder';
|
|
15
15
|
|
|
16
|
-
var AntifraudProviders;
|
|
17
|
-
(function (AntifraudProviders) {
|
|
18
|
-
AntifraudProviders["BANKSLIP"] = "bankSlip";
|
|
19
|
-
AntifraudProviders["CARD"] = "card";
|
|
20
|
-
AntifraudProviders["PIX"] = "pix";
|
|
21
|
-
AntifraudProviders["POINTS"] = "glampoints";
|
|
22
|
-
})(AntifraudProviders || (AntifraudProviders = {}));
|
|
23
|
-
|
|
24
|
-
var BusinessUnitEnum;
|
|
25
|
-
(function (BusinessUnitEnum) {
|
|
26
|
-
BusinessUnitEnum[BusinessUnitEnum["SUBSCRIPTION"] = 1] = "SUBSCRIPTION";
|
|
27
|
-
BusinessUnitEnum[BusinessUnitEnum["SHOP"] = 2] = "SHOP";
|
|
28
|
-
})(BusinessUnitEnum || (BusinessUnitEnum = {}));
|
|
29
|
-
|
|
30
|
-
var OrderBlockedType;
|
|
31
|
-
(function (OrderBlockedType) {
|
|
32
|
-
OrderBlockedType["Checkout"] = "Checkout";
|
|
33
|
-
OrderBlockedType["Card"] = "Card";
|
|
34
|
-
OrderBlockedType["Boleto"] = "Boleto";
|
|
35
|
-
})(OrderBlockedType || (OrderBlockedType = {}));
|
|
36
|
-
|
|
37
|
-
var PagarmePaymentStatus;
|
|
38
|
-
(function (PagarmePaymentStatus) {
|
|
39
|
-
PagarmePaymentStatus["Em processamento"] = "processing";
|
|
40
|
-
PagarmePaymentStatus["Autorizada"] = "authorized";
|
|
41
|
-
PagarmePaymentStatus["Pago"] = "paid";
|
|
42
|
-
PagarmePaymentStatus["Estornada"] = "refunded";
|
|
43
|
-
PagarmePaymentStatus["Aguardando pagamento"] = "waiting_payment";
|
|
44
|
-
PagarmePaymentStatus["Aguardando estorno"] = "pending_refund";
|
|
45
|
-
PagarmePaymentStatus["Recusada/N\u00E3o autorizada"] = "refused";
|
|
46
|
-
PagarmePaymentStatus["Chargedback"] = "chargedback";
|
|
47
|
-
})(PagarmePaymentStatus || (PagarmePaymentStatus = {}));
|
|
48
|
-
|
|
49
|
-
var PaymentMethods;
|
|
50
|
-
(function (PaymentMethods) {
|
|
51
|
-
PaymentMethods["CARD"] = "card";
|
|
52
|
-
PaymentMethods["BANKSLIP"] = "bankSlip";
|
|
53
|
-
PaymentMethods["PIX"] = "pix";
|
|
54
|
-
PaymentMethods["POINTS"] = "glampoints";
|
|
55
|
-
})(PaymentMethods || (PaymentMethods = {}));
|
|
56
|
-
|
|
57
|
-
var PaymentProviders;
|
|
58
|
-
(function (PaymentProviders) {
|
|
59
|
-
PaymentProviders["PAGARME"] = "pagarMe";
|
|
60
|
-
PaymentProviders["ADYEN"] = "adyen";
|
|
61
|
-
PaymentProviders["GLAMPOINTS"] = "glampoints";
|
|
62
|
-
})(PaymentProviders || (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
16
|
class BaseModel {
|
|
101
17
|
get identifier() {
|
|
102
18
|
const fields = this.constructor.identifiersFields.filter((field) => field !== 'identifier');
|
|
@@ -293,6 +209,12 @@ __decorate([
|
|
|
293
209
|
__metadata("design:type", Category)
|
|
294
210
|
], CategoryFilter.prototype, "category", void 0);
|
|
295
211
|
|
|
212
|
+
class CategoryProduct extends BaseModel {
|
|
213
|
+
static get identifiersFields() {
|
|
214
|
+
return ['categoryId', 'productId'];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
296
218
|
class FilterOption extends BaseModel {
|
|
297
219
|
static get identifiersFields() {
|
|
298
220
|
return ['id'];
|
|
@@ -643,182 +565,175 @@ var Status;
|
|
|
643
565
|
Status["CANCELLED"] = "Cancelado";
|
|
644
566
|
})(Status || (Status = {}));
|
|
645
567
|
|
|
646
|
-
class
|
|
568
|
+
class Payment extends BaseModel {
|
|
569
|
+
static get identifiersFields() {
|
|
570
|
+
return ['id'];
|
|
571
|
+
}
|
|
647
572
|
}
|
|
648
573
|
__decorate([
|
|
649
574
|
Expose({ name: 'refuse_reason' }),
|
|
650
575
|
__metadata("design:type", String)
|
|
651
|
-
],
|
|
576
|
+
], Payment.prototype, "refuseReason", void 0);
|
|
652
577
|
__decorate([
|
|
653
578
|
Expose({ name: 'status_reason' }),
|
|
654
579
|
__metadata("design:type", String)
|
|
655
|
-
],
|
|
580
|
+
], Payment.prototype, "statusReason", void 0);
|
|
656
581
|
__decorate([
|
|
657
582
|
Expose({ name: 'acquirer_response_code' }),
|
|
658
583
|
__metadata("design:type", String)
|
|
659
|
-
],
|
|
584
|
+
], Payment.prototype, "acquirerResponseCode", void 0);
|
|
660
585
|
__decorate([
|
|
661
586
|
Expose({ name: 'acquirer_name' }),
|
|
662
587
|
__metadata("design:type", String)
|
|
663
|
-
],
|
|
588
|
+
], Payment.prototype, "acquirerName", void 0);
|
|
664
589
|
__decorate([
|
|
665
590
|
Expose({ name: 'acquirer_id' }),
|
|
666
591
|
__metadata("design:type", String)
|
|
667
|
-
],
|
|
592
|
+
], Payment.prototype, "acquirerId", void 0);
|
|
668
593
|
__decorate([
|
|
669
594
|
Expose({ name: 'authorization_code' }),
|
|
670
595
|
__metadata("design:type", String)
|
|
671
|
-
],
|
|
596
|
+
], Payment.prototype, "authorizationCode", void 0);
|
|
672
597
|
__decorate([
|
|
673
598
|
Expose({ name: 'soft_descriptor' }),
|
|
674
599
|
__metadata("design:type", String)
|
|
675
|
-
],
|
|
600
|
+
], Payment.prototype, "softDescriptor", void 0);
|
|
676
601
|
__decorate([
|
|
677
602
|
Expose({ name: 'date_created' }),
|
|
678
603
|
__metadata("design:type", String)
|
|
679
|
-
],
|
|
604
|
+
], Payment.prototype, "dateCreated", void 0);
|
|
680
605
|
__decorate([
|
|
681
606
|
Expose({ name: 'date_updated' }),
|
|
682
607
|
__metadata("design:type", String)
|
|
683
|
-
],
|
|
608
|
+
], Payment.prototype, "dateUpdated", void 0);
|
|
684
609
|
__decorate([
|
|
685
610
|
Expose({ name: 'authorized_amount' }),
|
|
686
611
|
__metadata("design:type", Number)
|
|
687
|
-
],
|
|
612
|
+
], Payment.prototype, "authorizedAmount", void 0);
|
|
688
613
|
__decorate([
|
|
689
614
|
Expose({ name: 'paid_amount' }),
|
|
690
615
|
__metadata("design:type", Number)
|
|
691
|
-
],
|
|
616
|
+
], Payment.prototype, "paidAmount", void 0);
|
|
692
617
|
__decorate([
|
|
693
618
|
Expose({ name: 'paid_at' }),
|
|
694
619
|
__metadata("design:type", String)
|
|
695
|
-
],
|
|
620
|
+
], Payment.prototype, "paidAt", void 0);
|
|
696
621
|
__decorate([
|
|
697
622
|
Expose({ name: 'refunded_amount' }),
|
|
698
623
|
__metadata("design:type", Number)
|
|
699
|
-
],
|
|
624
|
+
], Payment.prototype, "refundedAmount", void 0);
|
|
700
625
|
__decorate([
|
|
701
626
|
Expose({ name: 'card_holder_name' }),
|
|
702
627
|
__metadata("design:type", String)
|
|
703
|
-
],
|
|
628
|
+
], Payment.prototype, "cardHolderName", void 0);
|
|
704
629
|
__decorate([
|
|
705
630
|
Expose({ name: 'card_last_digits' }),
|
|
706
631
|
__metadata("design:type", String)
|
|
707
|
-
],
|
|
632
|
+
], Payment.prototype, "cardLastDigits", void 0);
|
|
708
633
|
__decorate([
|
|
709
634
|
Expose({ name: 'card_first_digits' }),
|
|
710
635
|
__metadata("design:type", String)
|
|
711
|
-
],
|
|
636
|
+
], Payment.prototype, "cardFirstDigits", void 0);
|
|
712
637
|
__decorate([
|
|
713
638
|
Expose({ name: 'card_brand' }),
|
|
714
639
|
__metadata("design:type", String)
|
|
715
|
-
],
|
|
640
|
+
], Payment.prototype, "cardBrand", void 0);
|
|
716
641
|
__decorate([
|
|
717
642
|
Expose({ name: 'card_pin_mode' }),
|
|
718
643
|
__metadata("design:type", String)
|
|
719
|
-
],
|
|
644
|
+
], Payment.prototype, "cardPinMode", void 0);
|
|
720
645
|
__decorate([
|
|
721
646
|
Expose({ name: 'card_magstripe_fallback' }),
|
|
722
647
|
__metadata("design:type", Boolean)
|
|
723
|
-
],
|
|
648
|
+
], Payment.prototype, "cardMagstripeFallback", void 0);
|
|
724
649
|
__decorate([
|
|
725
650
|
Expose({ name: 'cvm_pin' }),
|
|
726
651
|
__metadata("design:type", Boolean)
|
|
727
|
-
],
|
|
652
|
+
], Payment.prototype, "cvmPin", void 0);
|
|
728
653
|
__decorate([
|
|
729
654
|
Expose({ name: 'postback_url' }),
|
|
730
655
|
__metadata("design:type", String)
|
|
731
|
-
],
|
|
656
|
+
], Payment.prototype, "postbackUrl", void 0);
|
|
732
657
|
__decorate([
|
|
733
658
|
Expose({ name: 'payment_method' }),
|
|
734
659
|
__metadata("design:type", String)
|
|
735
|
-
],
|
|
660
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
736
661
|
__decorate([
|
|
737
662
|
Expose({ name: 'capture_method' }),
|
|
738
663
|
__metadata("design:type", String)
|
|
739
|
-
],
|
|
664
|
+
], Payment.prototype, "captureMethod", void 0);
|
|
740
665
|
__decorate([
|
|
741
666
|
Expose({ name: 'antifraud_score' }),
|
|
742
667
|
__metadata("design:type", String)
|
|
743
|
-
],
|
|
668
|
+
], Payment.prototype, "antifraudScore", void 0);
|
|
744
669
|
__decorate([
|
|
745
670
|
Expose({ name: 'boleto_url' }),
|
|
746
671
|
__metadata("design:type", String)
|
|
747
|
-
],
|
|
672
|
+
], Payment.prototype, "boletoUrl", void 0);
|
|
748
673
|
__decorate([
|
|
749
674
|
Expose({ name: 'boleto_barcode' }),
|
|
750
675
|
__metadata("design:type", String)
|
|
751
|
-
],
|
|
676
|
+
], Payment.prototype, "boletoBarcode", void 0);
|
|
752
677
|
__decorate([
|
|
753
678
|
Expose({ name: 'boleto_expiration_date' }),
|
|
754
679
|
__metadata("design:type", String)
|
|
755
|
-
],
|
|
680
|
+
], Payment.prototype, "boletoExpirationDate", void 0);
|
|
756
681
|
__decorate([
|
|
757
682
|
Expose({ name: 'subscription_id' }),
|
|
758
683
|
__metadata("design:type", String)
|
|
759
|
-
],
|
|
684
|
+
], Payment.prototype, "subscriptionId", void 0);
|
|
760
685
|
__decorate([
|
|
761
686
|
Expose({ name: 'split_rules' }),
|
|
762
687
|
__metadata("design:type", String)
|
|
763
|
-
],
|
|
688
|
+
], Payment.prototype, "splitRules", void 0);
|
|
764
689
|
__decorate([
|
|
765
690
|
Expose({ name: 'antifraud_metadata' }),
|
|
766
691
|
__metadata("design:type", Object)
|
|
767
|
-
],
|
|
692
|
+
], Payment.prototype, "antifraudMetadata", void 0);
|
|
768
693
|
__decorate([
|
|
769
694
|
Expose({ name: 'reference_key' }),
|
|
770
695
|
__metadata("design:type", String)
|
|
771
|
-
],
|
|
696
|
+
], Payment.prototype, "referenceKey", void 0);
|
|
772
697
|
__decorate([
|
|
773
698
|
Expose({ name: 'local_transaction_id' }),
|
|
774
699
|
__metadata("design:type", String)
|
|
775
|
-
],
|
|
700
|
+
], Payment.prototype, "localTransactionId", void 0);
|
|
776
701
|
__decorate([
|
|
777
702
|
Expose({ name: 'local_time' }),
|
|
778
703
|
__metadata("design:type", String)
|
|
779
|
-
],
|
|
704
|
+
], Payment.prototype, "localTime", void 0);
|
|
780
705
|
__decorate([
|
|
781
706
|
Expose({ name: 'fraud_covered' }),
|
|
782
707
|
__metadata("design:type", Boolean)
|
|
783
|
-
],
|
|
708
|
+
], Payment.prototype, "fraudCovered", void 0);
|
|
784
709
|
__decorate([
|
|
785
710
|
Expose({ name: 'fraud_reimbursed' }),
|
|
786
711
|
__metadata("design:type", String)
|
|
787
|
-
],
|
|
712
|
+
], Payment.prototype, "fraudReimbursed", void 0);
|
|
788
713
|
__decorate([
|
|
789
714
|
Expose({ name: 'order_id' }),
|
|
790
715
|
__metadata("design:type", String)
|
|
791
|
-
],
|
|
716
|
+
], Payment.prototype, "orderId", void 0);
|
|
792
717
|
__decorate([
|
|
793
718
|
Expose({ name: 'risk_level' }),
|
|
794
719
|
__metadata("design:type", String)
|
|
795
|
-
],
|
|
720
|
+
], Payment.prototype, "riskLevel", void 0);
|
|
796
721
|
__decorate([
|
|
797
722
|
Expose({ name: 'receipt_url' }),
|
|
798
723
|
__metadata("design:type", String)
|
|
799
|
-
],
|
|
724
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
800
725
|
__decorate([
|
|
801
726
|
Expose({ name: 'private_label' }),
|
|
802
727
|
__metadata("design:type", String)
|
|
803
|
-
],
|
|
728
|
+
], Payment.prototype, "privateLabel", void 0);
|
|
804
729
|
__decorate([
|
|
805
730
|
Expose({ name: 'pix_qr_code' }),
|
|
806
731
|
__metadata("design:type", String)
|
|
807
|
-
],
|
|
732
|
+
], Payment.prototype, "pixQrCode", void 0);
|
|
808
733
|
__decorate([
|
|
809
734
|
Expose({ name: 'pix_expiration_date' }),
|
|
810
735
|
__metadata("design:type", String)
|
|
811
|
-
],
|
|
812
|
-
|
|
813
|
-
class Payment extends BaseModel {
|
|
814
|
-
static get identifiersFields() {
|
|
815
|
-
return ['id'];
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
__decorate([
|
|
819
|
-
Type(() => PaymentTransaction),
|
|
820
|
-
__metadata("design:type", PaymentTransaction)
|
|
821
|
-
], Payment.prototype, "transaction", void 0);
|
|
736
|
+
], Payment.prototype, "pixExpirationDate", void 0);
|
|
822
737
|
|
|
823
738
|
class SubscriptionPayment extends BaseModel {
|
|
824
739
|
static get identifiersFields() {
|
|
@@ -2320,8 +2235,8 @@ var OrderStatus;
|
|
|
2320
2235
|
class Order extends Checkout {
|
|
2321
2236
|
}
|
|
2322
2237
|
__decorate([
|
|
2323
|
-
Type(() =>
|
|
2324
|
-
__metadata("design:type",
|
|
2238
|
+
Type(() => Payment),
|
|
2239
|
+
__metadata("design:type", Payment)
|
|
2325
2240
|
], Order.prototype, "payment", void 0);
|
|
2326
2241
|
|
|
2327
2242
|
class OrderBlocked extends BaseModel {
|
|
@@ -2352,308 +2267,6 @@ __decorate([
|
|
|
2352
2267
|
__metadata("design:type", Coupon)
|
|
2353
2268
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
2354
2269
|
|
|
2355
|
-
class BusinessError extends CustomError {
|
|
2356
|
-
constructor(message, additionalData, type = '') {
|
|
2357
|
-
super(message);
|
|
2358
|
-
this.additionalData = additionalData;
|
|
2359
|
-
this.type = type;
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
class DuplicatedResultsError extends CustomError {
|
|
2364
|
-
constructor(message) {
|
|
2365
|
-
super(message);
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
class FraudValidationError extends CustomError {
|
|
2370
|
-
constructor(message, additionalData) {
|
|
2371
|
-
super(message);
|
|
2372
|
-
this.additionalData = additionalData;
|
|
2373
|
-
this.type = 'antifraud';
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
|
|
2377
|
-
class InvalidArgumentError extends CustomError {
|
|
2378
|
-
constructor(message) {
|
|
2379
|
-
super(message);
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
class NotFoundError extends CustomError {
|
|
2384
|
-
constructor(message) {
|
|
2385
|
-
super(message);
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
class PaymentError extends CustomError {
|
|
2390
|
-
constructor(message, additionalData) {
|
|
2391
|
-
super(message);
|
|
2392
|
-
this.additionalData = additionalData;
|
|
2393
|
-
this.type = 'payment';
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
class RequiredArgumentError extends CustomError {
|
|
2398
|
-
constructor(args) {
|
|
2399
|
-
super(`Required arguments: ${args.join(', ')}`);
|
|
2400
|
-
this.args = args;
|
|
2401
|
-
this.arguments = args;
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
class StockLimitError extends BusinessError {
|
|
2406
|
-
constructor(message, additionalData) {
|
|
2407
|
-
super(message, additionalData);
|
|
2408
|
-
this.type = 'stock-limit';
|
|
2409
|
-
}
|
|
2410
|
-
}
|
|
2411
|
-
|
|
2412
|
-
class StockOutError extends BusinessError {
|
|
2413
|
-
constructor(message, additionalData) {
|
|
2414
|
-
super(message, additionalData);
|
|
2415
|
-
this.type = 'stock-out';
|
|
2416
|
-
}
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
class AntifraudBankSlipService {
|
|
2420
|
-
constructor(orderBlockedRepository) {
|
|
2421
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2422
|
-
this.MAX_ORDER_VALUE = 5000;
|
|
2423
|
-
}
|
|
2424
|
-
async validate(checkout) {
|
|
2425
|
-
var _a, _b;
|
|
2426
|
-
if (checkout.totalPrice && checkout.totalPrice > this.MAX_ORDER_VALUE && !((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber)) {
|
|
2427
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Boleto not authorized', 'Boleto', 'day');
|
|
2428
|
-
throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
|
|
2429
|
-
checkoutId: checkout.id,
|
|
2430
|
-
userEmail: checkout.user.email,
|
|
2431
|
-
info: {
|
|
2432
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2433
|
-
subtotal: checkout.subTotalPrice,
|
|
2434
|
-
total: checkout.totalPrice,
|
|
2435
|
-
},
|
|
2436
|
-
});
|
|
2437
|
-
}
|
|
2438
|
-
return true;
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
|
|
2442
|
-
class AntifraudCardService {
|
|
2443
|
-
constructor(orderRepository, orderBlockedRepository) {
|
|
2444
|
-
this.orderRepository = orderRepository;
|
|
2445
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2446
|
-
this.LIMIT_ORDERS_DAY = 2;
|
|
2447
|
-
this.LIMIT_ORDERS_WEEK = 7;
|
|
2448
|
-
this.LIMIT_BLOCKED_ORDERS_DAY = 5;
|
|
2449
|
-
}
|
|
2450
|
-
async validate(checkout, card) {
|
|
2451
|
-
var _a, _b;
|
|
2452
|
-
if (!(await this.verifyBlockedOrderAttempts(checkout, card)))
|
|
2453
|
-
throw new FraudValidationError('Cliente com mais de 5 compras negadas/bloqueadas no dia', {
|
|
2454
|
-
checkoutId: checkout.id,
|
|
2455
|
-
userEmail: checkout.user.email,
|
|
2456
|
-
info: {
|
|
2457
|
-
isSubscriber: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.isSubscriber,
|
|
2458
|
-
subtotal: checkout.subTotalPrice,
|
|
2459
|
-
total: checkout.totalPrice,
|
|
2460
|
-
},
|
|
2461
|
-
});
|
|
2462
|
-
if (!(await this.verifyDayAndWeekOrders(checkout, card)))
|
|
2463
|
-
throw new FraudValidationError('Cliente tentando comprar mais de 2 vezes no dia ou 7 vezes na semana', {
|
|
2464
|
-
checkoutId: checkout.id,
|
|
2465
|
-
userEmail: checkout.user.email,
|
|
2466
|
-
info: {
|
|
2467
|
-
isSubscriber: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.isSubscriber,
|
|
2468
|
-
subtotal: checkout.subTotalPrice,
|
|
2469
|
-
total: checkout.totalPrice,
|
|
2470
|
-
},
|
|
2471
|
-
});
|
|
2472
|
-
return true;
|
|
2473
|
-
}
|
|
2474
|
-
async verifyBlockedOrderAttempts(checkout, card) {
|
|
2475
|
-
var _a, _b, _c, _d;
|
|
2476
|
-
const day = `${format(new Date(), 'yyyy-MM-DD')}T00:00:00`;
|
|
2477
|
-
const endOfDay = `${format(new Date(), 'yyyy-MM-DD')}T23:59:59`;
|
|
2478
|
-
const ordersBlockedWithCpf = await this.orderBlockedRepository
|
|
2479
|
-
.find({
|
|
2480
|
-
filters: {
|
|
2481
|
-
customer: { cpf: { operator: Where.EQUALS, value: (_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf } },
|
|
2482
|
-
date: [
|
|
2483
|
-
{ operator: Where.GTE, value: new Date(day) },
|
|
2484
|
-
{ operator: Where.LTE, value: new Date(endOfDay) },
|
|
2485
|
-
],
|
|
2486
|
-
},
|
|
2487
|
-
})
|
|
2488
|
-
.then((data) => data.data);
|
|
2489
|
-
const ordersBlockedWithEmail = await this.orderBlockedRepository
|
|
2490
|
-
.find({
|
|
2491
|
-
filters: {
|
|
2492
|
-
customer: { email: { operator: Where.EQUALS, value: (_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email } },
|
|
2493
|
-
date: [
|
|
2494
|
-
{ operator: Where.GTE, value: new Date(day) },
|
|
2495
|
-
{ operator: Where.LTE, value: new Date(endOfDay) },
|
|
2496
|
-
],
|
|
2497
|
-
},
|
|
2498
|
-
})
|
|
2499
|
-
.then((data) => data.data);
|
|
2500
|
-
const ordersBlockedWithCep = await this.orderBlockedRepository
|
|
2501
|
-
.find({
|
|
2502
|
-
filters: {
|
|
2503
|
-
customer: { shippingAddress: { zip: { operator: Where.EQUALS, value: (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.zip } } },
|
|
2504
|
-
date: [
|
|
2505
|
-
{ operator: Where.GTE, value: new Date(day) },
|
|
2506
|
-
{ operator: Where.LTE, value: new Date(endOfDay) },
|
|
2507
|
-
],
|
|
2508
|
-
},
|
|
2509
|
-
})
|
|
2510
|
-
.then((data) => data.data);
|
|
2511
|
-
const ordersBlockedWithPhone = await this.orderBlockedRepository
|
|
2512
|
-
.find({
|
|
2513
|
-
filters: {
|
|
2514
|
-
customer: { phoneNumber: { operator: Where.EQUALS, value: (_d = checkout.user) === null || _d === void 0 ? void 0 : _d.phone } },
|
|
2515
|
-
date: [
|
|
2516
|
-
{ operator: Where.GTE, value: new Date(day) },
|
|
2517
|
-
{ operator: Where.LTE, value: new Date(endOfDay) },
|
|
2518
|
-
],
|
|
2519
|
-
},
|
|
2520
|
-
})
|
|
2521
|
-
.then((data) => data.data);
|
|
2522
|
-
const blockedUniqueEmails = ordersBlockedWithEmail.filter((e) => {
|
|
2523
|
-
var _a;
|
|
2524
|
-
return e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf);
|
|
2525
|
-
});
|
|
2526
|
-
const blockedUniqueCeps = ordersBlockedWithCep.filter((e) => {
|
|
2527
|
-
var _a, _b;
|
|
2528
|
-
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);
|
|
2529
|
-
});
|
|
2530
|
-
const blockedUniquePhone = ordersBlockedWithPhone.filter((e) => {
|
|
2531
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2532
|
-
return (e.customer.cpf !== ((_a = checkout.user) === null || _a === void 0 ? void 0 : _a.cpf) &&
|
|
2533
|
-
e.customer.email !== ((_b = checkout.user) === null || _b === void 0 ? void 0 : _b.email) &&
|
|
2534
|
-
((_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()));
|
|
2535
|
-
});
|
|
2536
|
-
const blockedAttempts = ordersBlockedWithCpf
|
|
2537
|
-
.concat(blockedUniqueEmails)
|
|
2538
|
-
.concat(blockedUniqueCeps)
|
|
2539
|
-
.concat(blockedUniquePhone);
|
|
2540
|
-
if (blockedAttempts.length >= this.LIMIT_BLOCKED_ORDERS_DAY) {
|
|
2541
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'More than 5 attempts have failed', 'Failed attempts', 'day', card || null);
|
|
2542
|
-
return false;
|
|
2543
|
-
}
|
|
2544
|
-
return true;
|
|
2545
|
-
}
|
|
2546
|
-
async verifyDayAndWeekOrders(checkout, card) {
|
|
2547
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2548
|
-
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'));
|
|
2549
|
-
for (const key in ordersPerDay) {
|
|
2550
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_DAY) {
|
|
2551
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'day');
|
|
2552
|
-
return false;
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
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'));
|
|
2556
|
-
for (const key in ordersPerWeek) {
|
|
2557
|
-
if (ordersPerDay[key] > this.LIMIT_ORDERS_WEEK) {
|
|
2558
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Order limit', key, 'week');
|
|
2559
|
-
return false;
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
return true;
|
|
2563
|
-
}
|
|
2564
|
-
async validateOrdersByRange(cpf, email, phone, zip, card, range) {
|
|
2565
|
-
const ordersCpf = await this.countOrdersByField('user', 'cpf', cpf, range);
|
|
2566
|
-
const ordersByEmail = await this.countOrdersByField('user', 'email', email, range);
|
|
2567
|
-
const ordersByPhone = await this.countOrdersByField('user', 'phone', phone, range);
|
|
2568
|
-
const ordersByZip = await this.countOrdersByField('shippingAddress', 'zip', zip, range);
|
|
2569
|
-
return {
|
|
2570
|
-
cpf: ordersCpf,
|
|
2571
|
-
email: ordersByEmail,
|
|
2572
|
-
phone: ordersByPhone,
|
|
2573
|
-
zip: ordersByZip,
|
|
2574
|
-
};
|
|
2575
|
-
}
|
|
2576
|
-
async countOrdersByField(property, field, value, range) {
|
|
2577
|
-
const filters = {
|
|
2578
|
-
[property]: {
|
|
2579
|
-
[field]: value,
|
|
2580
|
-
},
|
|
2581
|
-
['createdAt']: [
|
|
2582
|
-
{ operator: Where.GTE, value: range.firstDate },
|
|
2583
|
-
{ operator: Where.LTE, value: range.lastDate },
|
|
2584
|
-
],
|
|
2585
|
-
};
|
|
2586
|
-
const docs = await (await this.orderRepository.find({ filters })).count;
|
|
2587
|
-
return docs;
|
|
2588
|
-
}
|
|
2589
|
-
getDateRange(range = 'day') {
|
|
2590
|
-
switch (range) {
|
|
2591
|
-
case 'day':
|
|
2592
|
-
return {
|
|
2593
|
-
firstDate: startOfDay(new Date()).getTime(),
|
|
2594
|
-
lastDate: endOfDay(new Date()).getTime(),
|
|
2595
|
-
};
|
|
2596
|
-
case 'week':
|
|
2597
|
-
return {
|
|
2598
|
-
firstDate: startOfDay(subDays(new Date(), 7)).getTime(),
|
|
2599
|
-
lastDate: endOfDay(new Date()).getTime(),
|
|
2600
|
-
};
|
|
2601
|
-
default:
|
|
2602
|
-
return {
|
|
2603
|
-
firstDate: startOfDay(new Date()).getTime(),
|
|
2604
|
-
lastDate: endOfDay(new Date()).getTime(),
|
|
2605
|
-
};
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2610
|
-
class AntifraudGlampointsService {
|
|
2611
|
-
constructor() { }
|
|
2612
|
-
async validate(checkout) {
|
|
2613
|
-
return true;
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2617
|
-
class AntifraudPixService {
|
|
2618
|
-
constructor() { }
|
|
2619
|
-
async validate(checkout) {
|
|
2620
|
-
return true;
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
class GlampointsPaymentService {
|
|
2625
|
-
constructor(paymentRepository) {
|
|
2626
|
-
this.paymentRepository = paymentRepository;
|
|
2627
|
-
}
|
|
2628
|
-
async pay(checkout) {
|
|
2629
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2630
|
-
createdAt: new Date(),
|
|
2631
|
-
updatedAt: new Date(),
|
|
2632
|
-
userId: checkout.user.id,
|
|
2633
|
-
checkoutId: checkout.id,
|
|
2634
|
-
totalPrice: checkout.totalPrice,
|
|
2635
|
-
paymentProvider: 'glampoints',
|
|
2636
|
-
transaction: {
|
|
2637
|
-
amount: 0,
|
|
2638
|
-
acquirerResponseCode: '0000',
|
|
2639
|
-
acquirerName: 'glampoints',
|
|
2640
|
-
authorizedAmount: 0,
|
|
2641
|
-
captureMethod: 'ecommerce',
|
|
2642
|
-
installments: 1,
|
|
2643
|
-
cost: 0,
|
|
2644
|
-
paidAmount: 0,
|
|
2645
|
-
paidAt: new Date().toISOString(),
|
|
2646
|
-
paymentMethod: 'glampoints',
|
|
2647
|
-
referer: 'api_key',
|
|
2648
|
-
refundedAmount: 0,
|
|
2649
|
-
status: 'paid',
|
|
2650
|
-
statusReason: 'acquirer',
|
|
2651
|
-
},
|
|
2652
|
-
}));
|
|
2653
|
-
return payment;
|
|
2654
|
-
}
|
|
2655
|
-
}
|
|
2656
|
-
|
|
2657
2270
|
class RoundProductPricesHelper {
|
|
2658
2271
|
static roundProductPrices(product) {
|
|
2659
2272
|
product.price.price = Number(product.price.price.toFixed(2));
|
|
@@ -2674,12 +2287,6 @@ class LogDocument extends BaseModel {
|
|
|
2674
2287
|
}
|
|
2675
2288
|
}
|
|
2676
2289
|
|
|
2677
|
-
class Sequence extends BaseModel {
|
|
2678
|
-
static get identifiersFields() {
|
|
2679
|
-
return ['id'];
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
|
|
2683
2290
|
var FilterType;
|
|
2684
2291
|
(function (FilterType) {
|
|
2685
2292
|
FilterType["ACCESSORY_IMPORTANCE"] = "accessoryImportance";
|
|
@@ -2818,82 +2425,29 @@ class ShopSettings extends BaseModel {
|
|
|
2818
2425
|
}
|
|
2819
2426
|
}
|
|
2820
2427
|
|
|
2821
|
-
class
|
|
2822
|
-
constructor(
|
|
2823
|
-
|
|
2824
|
-
this.paymentRepository = paymentRepository;
|
|
2825
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
2826
|
-
}
|
|
2827
|
-
createCardHash(bu) {
|
|
2828
|
-
throw new Error('Method not implemented.');
|
|
2829
|
-
}
|
|
2830
|
-
async pay(checkout, card) {
|
|
2831
|
-
try {
|
|
2832
|
-
const result = await axios({
|
|
2833
|
-
method: 'POST',
|
|
2834
|
-
url: this.credentials.URL_TRANSACTION,
|
|
2835
|
-
headers: {
|
|
2836
|
-
'x-api-key': this.credentials.API_KEY,
|
|
2837
|
-
'content-type': 'application/json',
|
|
2838
|
-
},
|
|
2839
|
-
data: this.createCardPayment(checkout, card),
|
|
2840
|
-
});
|
|
2841
|
-
if (result.data.resultCode !== 'Authorised') {
|
|
2842
|
-
this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
2843
|
-
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`, {
|
|
2844
|
-
checkoutId: checkout.id,
|
|
2845
|
-
userEmail: checkout.user.email,
|
|
2846
|
-
info: result.data,
|
|
2847
|
-
}));
|
|
2848
|
-
}
|
|
2849
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
2850
|
-
createdAt: new Date(),
|
|
2851
|
-
updatedAt: new Date(),
|
|
2852
|
-
userId: checkout.user.id,
|
|
2853
|
-
checkoutId: checkout.id,
|
|
2854
|
-
totalPrice: checkout.totalPrice,
|
|
2855
|
-
paymentProvider: 'adyen',
|
|
2856
|
-
transaction: Object.assign(Object.assign({}, result.data), { status: 'paid' }),
|
|
2857
|
-
}));
|
|
2858
|
-
return payment;
|
|
2859
|
-
}
|
|
2860
|
-
catch (error) {
|
|
2861
|
-
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', {
|
|
2862
|
-
checkoutId: checkout.id,
|
|
2863
|
-
userEmail: checkout.user.email,
|
|
2864
|
-
info: error.message,
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
}
|
|
2868
|
-
createCardPayment(checkout, card) {
|
|
2869
|
-
return {
|
|
2870
|
-
amount: {
|
|
2871
|
-
currency: 'BRL',
|
|
2872
|
-
value: ((checkout === null || checkout === void 0 ? void 0 : checkout.totalPrice) || 0) * 100,
|
|
2873
|
-
},
|
|
2874
|
-
paymentMethod: {
|
|
2875
|
-
type: 'scheme',
|
|
2876
|
-
storedPaymentMethodId: card.cardId,
|
|
2877
|
-
},
|
|
2878
|
-
reference: checkout.id,
|
|
2879
|
-
shopperInteraction: 'Ecommerce',
|
|
2880
|
-
merchantAccount: this.credentials.MERCHANT_ACCOUNT,
|
|
2881
|
-
shopperReference: checkout.user.id,
|
|
2882
|
-
recurringProcessingModel: 'CardOnFile',
|
|
2883
|
-
returnUrl: this.credentials.URL_POSTBACK,
|
|
2884
|
-
installments: {
|
|
2885
|
-
value: card.installments,
|
|
2886
|
-
},
|
|
2887
|
-
};
|
|
2428
|
+
class InvalidArgumentError extends CustomError {
|
|
2429
|
+
constructor(message) {
|
|
2430
|
+
super(message);
|
|
2888
2431
|
}
|
|
2889
|
-
|
|
2890
|
-
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
class RequiredArgumentError extends CustomError {
|
|
2435
|
+
constructor(args) {
|
|
2436
|
+
super(`Required arguments: ${args.join(', ')}`);
|
|
2437
|
+
this.args = args;
|
|
2438
|
+
this.arguments = args;
|
|
2891
2439
|
}
|
|
2892
|
-
|
|
2893
|
-
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
class NotFoundError extends CustomError {
|
|
2443
|
+
constructor(message) {
|
|
2444
|
+
super(message);
|
|
2894
2445
|
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
class DuplicatedResultsError extends CustomError {
|
|
2449
|
+
constructor(message) {
|
|
2450
|
+
super(message);
|
|
2897
2451
|
}
|
|
2898
2452
|
}
|
|
2899
2453
|
|
|
@@ -3795,17 +3349,6 @@ class LogFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore
|
|
|
3795
3349
|
}
|
|
3796
3350
|
}
|
|
3797
3351
|
|
|
3798
|
-
class SequenceFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3799
|
-
constructor({ firestore, interceptors }) {
|
|
3800
|
-
super({
|
|
3801
|
-
firestore,
|
|
3802
|
-
collectionName: 'sequences',
|
|
3803
|
-
model: Sequence,
|
|
3804
|
-
interceptors,
|
|
3805
|
-
});
|
|
3806
|
-
}
|
|
3807
|
-
}
|
|
3808
|
-
|
|
3809
3352
|
class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
3810
3353
|
constructor({ firestore, interceptors }) {
|
|
3811
3354
|
super({
|
|
@@ -4046,7 +3589,11 @@ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
4046
3589
|
limiteRange,
|
|
4047
3590
|
type,
|
|
4048
3591
|
card,
|
|
4049
|
-
checkout
|
|
3592
|
+
checkout: {
|
|
3593
|
+
id: checkout.id,
|
|
3594
|
+
shop: checkout.shop,
|
|
3595
|
+
total: checkout.totalPrice,
|
|
3596
|
+
},
|
|
4050
3597
|
date: new Date(),
|
|
4051
3598
|
}));
|
|
4052
3599
|
}
|
|
@@ -5719,6 +5266,41 @@ __decorate([
|
|
|
5719
5266
|
__metadata("design:returntype", Promise)
|
|
5720
5267
|
], CategoryHasuraGraphQLRepository.prototype, "isChild", null);
|
|
5721
5268
|
|
|
5269
|
+
class CategoryProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5270
|
+
constructor({ endpoint, authOptions, interceptors, }) {
|
|
5271
|
+
super({
|
|
5272
|
+
tableName: 'category_product',
|
|
5273
|
+
model: CategoryProduct,
|
|
5274
|
+
endpoint,
|
|
5275
|
+
authOptions,
|
|
5276
|
+
interceptors,
|
|
5277
|
+
fields: [{ productId: { columnName: 'product_id' } }, { categoryId: { columnName: 'category_id' } }, 'order'],
|
|
5278
|
+
});
|
|
5279
|
+
}
|
|
5280
|
+
async removeProductFromCategory(categoryId, productId) {
|
|
5281
|
+
await this.mutation('delete_category_product', ['affected_rows'], {
|
|
5282
|
+
where: {
|
|
5283
|
+
type: 'category_product_bool_exp',
|
|
5284
|
+
required: true,
|
|
5285
|
+
value: {
|
|
5286
|
+
product_id: { _eq: productId },
|
|
5287
|
+
category_id: { _eq: categoryId },
|
|
5288
|
+
},
|
|
5289
|
+
},
|
|
5290
|
+
});
|
|
5291
|
+
}
|
|
5292
|
+
async addProductToCategory(categoryId, productId) {
|
|
5293
|
+
await this.removeProductFromCategory(categoryId, productId);
|
|
5294
|
+
await this.mutation('insert_category_product', ['affected_rows'], {
|
|
5295
|
+
objects: {
|
|
5296
|
+
type: 'category_product_insert_input!',
|
|
5297
|
+
required: true,
|
|
5298
|
+
value: { category_id: categoryId, product_id: productId },
|
|
5299
|
+
},
|
|
5300
|
+
});
|
|
5301
|
+
}
|
|
5302
|
+
}
|
|
5303
|
+
|
|
5722
5304
|
class FilterHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5723
5305
|
constructor({ endpoint, authOptions, interceptors, }, filterOptionRepository, categoryFilterRepository) {
|
|
5724
5306
|
super({
|
|
@@ -6017,6 +5599,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6017
5599
|
fields: ['id', 'name', 'reference', 'slug'],
|
|
6018
5600
|
},
|
|
6019
5601
|
},
|
|
5602
|
+
'group',
|
|
5603
|
+
'validity',
|
|
6020
5604
|
];
|
|
6021
5605
|
this.fields = [
|
|
6022
5606
|
...commonFields,
|
|
@@ -6129,7 +5713,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6129
5713
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
6130
5714
|
const id = await this.getId(plainData.id);
|
|
6131
5715
|
const product = await super.update(Object.assign({ id }, data));
|
|
6132
|
-
product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
5716
|
+
// product.categories = categories && (await this.updateCategories(+id, { categories }))
|
|
6133
5717
|
product.kitProducts = kitProducts && (await this.updateKitProducts(+id, { kitProducts }));
|
|
6134
5718
|
product.reviews = reviews && (await this.updateReviews(+id, { reviews }));
|
|
6135
5719
|
product.metadata = metadata && (await this.updateMetadata(+id, { metadata }));
|
|
@@ -6589,6 +6173,8 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
6589
6173
|
type: HasuraGraphQLColumnType.Jsonb,
|
|
6590
6174
|
},
|
|
6591
6175
|
},
|
|
6176
|
+
'group',
|
|
6177
|
+
'validity',
|
|
6592
6178
|
],
|
|
6593
6179
|
});
|
|
6594
6180
|
}
|
|
@@ -6945,313 +6531,6 @@ __decorate([
|
|
|
6945
6531
|
__metadata("design:returntype", Promise)
|
|
6946
6532
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
6947
6533
|
|
|
6948
|
-
class PagarmeBankSlipAxiosAdapter {
|
|
6949
|
-
constructor(credentials, paymentRepository) {
|
|
6950
|
-
this.credentials = credentials;
|
|
6951
|
-
this.paymentRepository = paymentRepository;
|
|
6952
|
-
}
|
|
6953
|
-
async pay(checkout) {
|
|
6954
|
-
try {
|
|
6955
|
-
const result = await axios({
|
|
6956
|
-
method: 'POST',
|
|
6957
|
-
url: `${this.credentials.URL}/transactions`,
|
|
6958
|
-
data: this.createBoletoPayment(checkout),
|
|
6959
|
-
});
|
|
6960
|
-
if (result.data.status !== PagarmePaymentStatus['Em processamento']) {
|
|
6961
|
-
return Promise.reject(new PaymentError(`Houve uma falha ao gerar o boleto. Tente novamente`, {
|
|
6962
|
-
checkoutId: checkout.id,
|
|
6963
|
-
userEmail: checkout.user.email,
|
|
6964
|
-
info: result.data,
|
|
6965
|
-
}));
|
|
6966
|
-
}
|
|
6967
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
6968
|
-
createdAt: new Date(),
|
|
6969
|
-
updatedAt: new Date(),
|
|
6970
|
-
userId: checkout.user.id,
|
|
6971
|
-
checkoutId: checkout.id,
|
|
6972
|
-
totalPrice: checkout.totalPrice,
|
|
6973
|
-
paymentProvider: 'pagarMe',
|
|
6974
|
-
transaction: result.data,
|
|
6975
|
-
}));
|
|
6976
|
-
return payment;
|
|
6977
|
-
}
|
|
6978
|
-
catch (error) {
|
|
6979
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
6980
|
-
checkoutId: checkout.id,
|
|
6981
|
-
userEmail: checkout.user.email,
|
|
6982
|
-
info: error.response.data,
|
|
6983
|
-
});
|
|
6984
|
-
}
|
|
6985
|
-
}
|
|
6986
|
-
async getBoletoTransaction(paymentId) {
|
|
6987
|
-
try {
|
|
6988
|
-
const { data } = await axios({
|
|
6989
|
-
method: 'GET',
|
|
6990
|
-
url: `${this.credentials.URL}/transactions/${paymentId}`,
|
|
6991
|
-
data: {
|
|
6992
|
-
api_key: this.credentials.API_KEY,
|
|
6993
|
-
},
|
|
6994
|
-
});
|
|
6995
|
-
return data;
|
|
6996
|
-
}
|
|
6997
|
-
catch (error) {
|
|
6998
|
-
throw new BusinessError('Houve uma falha buscar o boleto com paymentId: ' + paymentId, {
|
|
6999
|
-
paymentId,
|
|
7000
|
-
info: error.response.data,
|
|
7001
|
-
});
|
|
7002
|
-
}
|
|
7003
|
-
}
|
|
7004
|
-
createBoletoPayment(checkout) {
|
|
7005
|
-
return {
|
|
7006
|
-
api_key: this.credentials.API_KEY,
|
|
7007
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7008
|
-
boleto_rules: ['strict_expiration_date'],
|
|
7009
|
-
boleto_instructions: 'Sr. Caixa, NÃO aceitar o pagamento após o vencimento.',
|
|
7010
|
-
boleto_expiration_date: format(addDays(new Date(), 3), 'yyyy-MM-dd'),
|
|
7011
|
-
payment_method: 'boleto',
|
|
7012
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
7013
|
-
customer: {
|
|
7014
|
-
external_id: checkout.user.id,
|
|
7015
|
-
type: 'individual',
|
|
7016
|
-
country: 'br',
|
|
7017
|
-
name: checkout.user.displayName,
|
|
7018
|
-
documents: [
|
|
7019
|
-
{
|
|
7020
|
-
type: 'cpf',
|
|
7021
|
-
number: checkout.user.cpf,
|
|
7022
|
-
},
|
|
7023
|
-
],
|
|
7024
|
-
},
|
|
7025
|
-
};
|
|
7026
|
-
}
|
|
7027
|
-
}
|
|
7028
|
-
|
|
7029
|
-
class PagarmeCardAxiosAdapter {
|
|
7030
|
-
constructor(credentials, paymentRepository, orderBlockedRepository) {
|
|
7031
|
-
this.credentials = credentials;
|
|
7032
|
-
this.paymentRepository = paymentRepository;
|
|
7033
|
-
this.orderBlockedRepository = orderBlockedRepository;
|
|
7034
|
-
}
|
|
7035
|
-
async pay(checkout, card) {
|
|
7036
|
-
var _a;
|
|
7037
|
-
try {
|
|
7038
|
-
const result = await axios({
|
|
7039
|
-
method: 'POST',
|
|
7040
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7041
|
-
data: this.createCardPayment(checkout, card),
|
|
7042
|
-
});
|
|
7043
|
-
if (result.data.status !== PagarmePaymentStatus.Pago) {
|
|
7044
|
-
await this.orderBlockedRepository.createBlockedOrderOrPayment(checkout, 'Card not authorized', 'Card', 'day', card);
|
|
7045
|
-
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`, {
|
|
7046
|
-
checkoutId: checkout.id,
|
|
7047
|
-
userEmail: checkout.user.email,
|
|
7048
|
-
info: result.data,
|
|
7049
|
-
}));
|
|
7050
|
-
}
|
|
7051
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7052
|
-
createdAt: new Date(),
|
|
7053
|
-
updatedAt: new Date(),
|
|
7054
|
-
userId: checkout.user.id,
|
|
7055
|
-
checkoutId: checkout.id,
|
|
7056
|
-
totalPrice: checkout.totalPrice,
|
|
7057
|
-
paymentProvider: PaymentProviders.PAGARME,
|
|
7058
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7059
|
-
}));
|
|
7060
|
-
return payment;
|
|
7061
|
-
}
|
|
7062
|
-
catch (error) {
|
|
7063
|
-
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', {
|
|
7064
|
-
checkoutId: checkout.id,
|
|
7065
|
-
userEmail: checkout.user.email,
|
|
7066
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7067
|
-
});
|
|
7068
|
-
}
|
|
7069
|
-
}
|
|
7070
|
-
async addCard(card) {
|
|
7071
|
-
try {
|
|
7072
|
-
const { data } = await axios({
|
|
7073
|
-
method: 'POST',
|
|
7074
|
-
url: `${this.credentials.URL}/cards`,
|
|
7075
|
-
data: {
|
|
7076
|
-
api_key: this.credentials.API_KEY,
|
|
7077
|
-
card_number: card.number,
|
|
7078
|
-
card_expiration_date: card.expirationDate.replace('/', ''),
|
|
7079
|
-
card_holder_name: card.name,
|
|
7080
|
-
card_cvv: card.cvv,
|
|
7081
|
-
},
|
|
7082
|
-
});
|
|
7083
|
-
return data;
|
|
7084
|
-
}
|
|
7085
|
-
catch (error) {
|
|
7086
|
-
throw new BusinessError('Houve uma falha adicionar o cartão', {
|
|
7087
|
-
info: error.response.data,
|
|
7088
|
-
});
|
|
7089
|
-
}
|
|
7090
|
-
}
|
|
7091
|
-
async createCardHash(bu) {
|
|
7092
|
-
console.log('input createCardHash', bu);
|
|
7093
|
-
console.log('input this.credentials', this.credentials);
|
|
7094
|
-
const key = bu === BusinessUnitEnum.SHOP ? this.credentials.SHOP_API_KEY : this.credentials.SUBSCRIPTION_API_KEY;
|
|
7095
|
-
console.log('key', key);
|
|
7096
|
-
try {
|
|
7097
|
-
const { data } = await axios({
|
|
7098
|
-
method: 'GET',
|
|
7099
|
-
headers: {
|
|
7100
|
-
'content-type': 'application/json',
|
|
7101
|
-
},
|
|
7102
|
-
url: `${this.credentials.URL}/transactions/card_hash_key`,
|
|
7103
|
-
data: JSON.stringify({
|
|
7104
|
-
api_key: key,
|
|
7105
|
-
}),
|
|
7106
|
-
});
|
|
7107
|
-
return data;
|
|
7108
|
-
}
|
|
7109
|
-
catch (error) {
|
|
7110
|
-
console.log('createCardHash axios error', error);
|
|
7111
|
-
throw new BusinessError('Houve uma falha gerar o hash', {
|
|
7112
|
-
info: error.response.data,
|
|
7113
|
-
});
|
|
7114
|
-
}
|
|
7115
|
-
}
|
|
7116
|
-
async getCardByToken(id) {
|
|
7117
|
-
try {
|
|
7118
|
-
const { data } = await axios({
|
|
7119
|
-
method: 'POST',
|
|
7120
|
-
url: `${this.credentials.URL}/cards/${id}`,
|
|
7121
|
-
data: {
|
|
7122
|
-
api_key: this.credentials.API_KEY,
|
|
7123
|
-
},
|
|
7124
|
-
});
|
|
7125
|
-
return data;
|
|
7126
|
-
}
|
|
7127
|
-
catch (error) {
|
|
7128
|
-
throw new BusinessError('Houve uma falha buscar o cartão com id: ' + id, {
|
|
7129
|
-
info: error.response.data,
|
|
7130
|
-
});
|
|
7131
|
-
}
|
|
7132
|
-
}
|
|
7133
|
-
async createTransaction(info) {
|
|
7134
|
-
try {
|
|
7135
|
-
const { data } = await axios({
|
|
7136
|
-
method: 'POST',
|
|
7137
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7138
|
-
data: Object.assign(Object.assign({}, info), { api_key: this.credentials.API_KEY }),
|
|
7139
|
-
});
|
|
7140
|
-
return data;
|
|
7141
|
-
}
|
|
7142
|
-
catch (error) {
|
|
7143
|
-
throw new BusinessError('Houve uma falha ao criar a transação', {
|
|
7144
|
-
info: error.response.data,
|
|
7145
|
-
});
|
|
7146
|
-
}
|
|
7147
|
-
}
|
|
7148
|
-
createCardPayment(checkout, card) {
|
|
7149
|
-
var _a, _b, _c, _d, _e, _f;
|
|
7150
|
-
return {
|
|
7151
|
-
api_key: this.credentials.API_KEY,
|
|
7152
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7153
|
-
card_id: card.cardId,
|
|
7154
|
-
payment_method: 'credit_card',
|
|
7155
|
-
installments: card.installments,
|
|
7156
|
-
soft_descriptor: checkout.shop === Shops.GLAMSHOP ? 'Glam' : "Men's Market",
|
|
7157
|
-
customer: {
|
|
7158
|
-
external_id: checkout.user.id,
|
|
7159
|
-
name: checkout.user.displayName,
|
|
7160
|
-
type: 'individual',
|
|
7161
|
-
country: 'br',
|
|
7162
|
-
email: checkout.user.email,
|
|
7163
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7164
|
-
documents: [
|
|
7165
|
-
{
|
|
7166
|
-
type: 'cpf',
|
|
7167
|
-
number: checkout.user.cpf,
|
|
7168
|
-
},
|
|
7169
|
-
],
|
|
7170
|
-
},
|
|
7171
|
-
billing: {
|
|
7172
|
-
name: checkout.user.displayName,
|
|
7173
|
-
address: {
|
|
7174
|
-
country: 'br',
|
|
7175
|
-
state: checkout.billingAddress ? checkout.billingAddress.state : (_a = checkout.shippingAddress) === null || _a === void 0 ? void 0 : _a.state,
|
|
7176
|
-
city: checkout.billingAddress ? checkout.billingAddress.city : (_b = checkout.shippingAddress) === null || _b === void 0 ? void 0 : _b.city,
|
|
7177
|
-
neighborhood: checkout.billingAddress ? checkout.billingAddress.district : (_c = checkout.shippingAddress) === null || _c === void 0 ? void 0 : _c.district,
|
|
7178
|
-
street: checkout.billingAddress ? checkout.billingAddress.street : (_d = checkout.shippingAddress) === null || _d === void 0 ? void 0 : _d.street,
|
|
7179
|
-
street_number: checkout.billingAddress ? checkout.billingAddress.number : (_e = checkout.shippingAddress) === null || _e === void 0 ? void 0 : _e.number,
|
|
7180
|
-
zipcode: checkout.billingAddress
|
|
7181
|
-
? checkout.billingAddress.zip.replace('-', '')
|
|
7182
|
-
: (_f = checkout.shippingAddress) === null || _f === void 0 ? void 0 : _f.zip.replace('-', ''),
|
|
7183
|
-
},
|
|
7184
|
-
},
|
|
7185
|
-
items: checkout.lineItems.map((item) => {
|
|
7186
|
-
return {
|
|
7187
|
-
id: item.id,
|
|
7188
|
-
title: checkout.user.isSubscriber ? `${item.name} - ASSINANTE` : item.name,
|
|
7189
|
-
unit_price: Math.floor(item.pricePaid * 100),
|
|
7190
|
-
quantity: item.quantity,
|
|
7191
|
-
tangible: true,
|
|
7192
|
-
};
|
|
7193
|
-
}),
|
|
7194
|
-
};
|
|
7195
|
-
}
|
|
7196
|
-
}
|
|
7197
|
-
|
|
7198
|
-
class PagarmePixAxiosAdapter {
|
|
7199
|
-
constructor(credentials, paymentRepository) {
|
|
7200
|
-
this.credentials = credentials;
|
|
7201
|
-
this.paymentRepository = paymentRepository;
|
|
7202
|
-
}
|
|
7203
|
-
async pay(checkout) {
|
|
7204
|
-
var _a;
|
|
7205
|
-
try {
|
|
7206
|
-
const result = await axios({
|
|
7207
|
-
method: 'POST',
|
|
7208
|
-
url: `${this.credentials.URL}/transactions`,
|
|
7209
|
-
data: this.createPixPayment(checkout),
|
|
7210
|
-
});
|
|
7211
|
-
const payment = await this.paymentRepository.create(Payment.toInstance({
|
|
7212
|
-
createdAt: new Date(),
|
|
7213
|
-
updatedAt: new Date(),
|
|
7214
|
-
userId: checkout.user.id,
|
|
7215
|
-
checkoutId: checkout.id,
|
|
7216
|
-
totalPrice: checkout.totalPrice,
|
|
7217
|
-
paymentProvider: 'pagarMe',
|
|
7218
|
-
transaction: Object.assign(Object.assign({}, result.data), { paidAt: new Date() }),
|
|
7219
|
-
}));
|
|
7220
|
-
return payment;
|
|
7221
|
-
}
|
|
7222
|
-
catch (error) {
|
|
7223
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
7224
|
-
checkoutId: checkout.id,
|
|
7225
|
-
userEmail: checkout.user.email,
|
|
7226
|
-
info: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
7227
|
-
});
|
|
7228
|
-
}
|
|
7229
|
-
}
|
|
7230
|
-
createPixPayment(checkout) {
|
|
7231
|
-
return {
|
|
7232
|
-
payment_method: 'pix',
|
|
7233
|
-
amount: Math.floor(checkout.totalPrice * 100),
|
|
7234
|
-
api_key: this.credentials.API_KEY,
|
|
7235
|
-
postback_url: this.credentials.URL_POSTBACK,
|
|
7236
|
-
pix_expiration_date: format(addDays(new Date(), 1), 'yyyy-MM-dd'),
|
|
7237
|
-
customer: {
|
|
7238
|
-
external_id: checkout.user.id,
|
|
7239
|
-
type: 'individual',
|
|
7240
|
-
country: 'br',
|
|
7241
|
-
name: checkout.user.displayName,
|
|
7242
|
-
email: checkout.user.email.trim(),
|
|
7243
|
-
phone_numbers: checkout.user.phone ? ['+55' + checkout.user.phone] : '',
|
|
7244
|
-
documents: [
|
|
7245
|
-
{
|
|
7246
|
-
type: 'cpf',
|
|
7247
|
-
number: checkout.user.cpf,
|
|
7248
|
-
},
|
|
7249
|
-
],
|
|
7250
|
-
},
|
|
7251
|
-
};
|
|
7252
|
-
}
|
|
7253
|
-
}
|
|
7254
|
-
|
|
7255
6534
|
class VertexAxiosAdapter {
|
|
7256
6535
|
constructor(config) {
|
|
7257
6536
|
this.config = config;
|
|
@@ -7405,4 +6684,4 @@ class ProductsVertexSearch {
|
|
|
7405
6684
|
}
|
|
7406
6685
|
}
|
|
7407
6686
|
|
|
7408
|
-
export { AccessoryImportances, Address,
|
|
6687
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Campaign, CampaignBanner, CampaignDashboard, CampaignDashboardFirestoreRepository, CampaignHashtag, CampaignHashtagFirestoreRepository, Category, CategoryCollectionChildren, CategoryCollectionChildrenHasuraGraphQLRepository, CategoryFilter, CategoryFilterHasuraGraphQLRepository, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, CategoryProduct, CategoryProductHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, ClassNameHelper, ConnectBaseDocumentSnapshot, ConnectCollectionService, ConnectDocumentService, ConnectFirestoreService, Coupon, CouponCategories, CouponCategory, CouponChannels, CouponFirestoreRepository, CouponOldCategories, CouponSubtypes, CouponTypes, Debug, DebugDecoratorHelper, DebugHelper, DebugNamespaces, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, Filter, FilterHasuraGraphQLRepository, FilterOption, FilterOptionHasuraGraphQLRepository, FilterType, FirebaseFileUploaderService, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, Log, LogDocument, LogFirestoreRepository, Logger, NotFoundError, OfficePosition, Order, OrderBlocked, OrderBlockedFirestoreRepository, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, PersonTypes, Plans, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductReviews, ProductReviewsHasuraGraphQLRepository, ProductSpents, ProductStockNotification, ProductStockNotificationHasuraGraphQLRepository, ProductVariantFirestoreRepository, ProductsIndex, ProductsVertexSearch, QuestionsFilters, RecoveryPassword, ReflectHelper, Register, RegisterFirebaseAuthService, RequiredArgumentError, RoundProductPricesHelper, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, ShopPageName, ShopSettings, ShopSettingsFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionMaterialization, SubscriptionMaterializationFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, SubscriptionSummary, SubscriptionSummaryFirestoreRepository, Trace, UnauthorizedError, UpdateOptionActions, UpdateUserImage, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, VertexAxiosAdapter, WeakPasswordError, Where, Wishlist, WishlistHasuraGraphQLRepository, WishlistLogType, is, isDebuggable, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|