@infrab4a/connect 5.6.0-alpha.2 → 5.6.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 +412 -113
- package/index.esm.js +405 -111
- package/package.json +1 -1
- package/src/domain/catalog/models/index.d.ts +2 -1
- package/src/domain/catalog/models/product-group.d.ts +12 -0
- package/src/domain/catalog/models/product-price-log.d.ts +25 -0
- package/src/domain/catalog/models/types/index.d.ts +1 -0
- package/src/domain/catalog/models/types/product-competitors-price.d.ts +5 -0
- package/src/domain/catalog/repositories/index.d.ts +2 -1
- package/src/domain/catalog/repositories/product-group.repository.d.ts +4 -0
- package/src/domain/catalog/repositories/product-price-log.repository.d.ts +4 -0
- package/src/domain/shop-settings/models/index.d.ts +2 -1
- package/src/domain/shop-settings/models/shop-configs.d.ts +18 -0
- package/src/domain/shop-settings/models/types/index.d.ts +2 -0
- package/src/domain/shop-settings/models/types/limit-orders.type.d.ts +7 -0
- package/src/domain/shop-settings/models/types/shop-error-messages.type.d.ts +10 -0
- package/src/domain/shop-settings/repositories/index.d.ts +1 -0
- package/src/domain/shop-settings/repositories/shop-configs.repository.d.ts +4 -0
- package/src/domain/shop-settings/repositories/shop-settings.repository.d.ts +1 -1
- package/src/domain/shopping/models/order-blocked.d.ts +1 -0
- package/src/domain/shopping/repositories/order-blocked.repository.d.ts +1 -0
- package/src/errors/enum/error.enum.d.ts +14 -0
- package/src/errors/enum/index.d.ts +1 -0
- package/src/errors/fraud-validation.error.d.ts +1 -1
- package/src/errors/index.d.ts +2 -0
- package/src/errors/invalid-checkout.error.d.ts +7 -0
- package/src/errors/not-found.error.d.ts +1 -0
- package/src/errors/payment.error.d.ts +1 -1
- package/src/infra/firebase/firestore/mixins/with-helpers.mixin.d.ts +1 -1
- package/src/infra/firebase/firestore/repositories/shop-settings/index.d.ts +1 -0
- package/src/infra/firebase/firestore/repositories/shop-settings/shop-configs-firestore.repository.d.ts +7 -0
- package/src/infra/firebase/firestore/repositories/shopping/order-blocked-firestore.repository.d.ts +1 -0
- package/src/infra/hasura-graphql/models/index.d.ts +0 -1
- package/src/infra/hasura-graphql/repositories/catalog/index.d.ts +2 -1
- package/src/infra/hasura-graphql/repositories/catalog/product-group-hasura-graphql.repository.d.ts +7 -0
- package/src/infra/hasura-graphql/repositories/catalog/product-price-log-hasura-graphql.repository.d.ts +7 -0
- package/src/infra/mercado-pago/adapters/mercado-pago-card-payment-axios.adapter.d.ts +1 -0
- package/src/infra/mercado-pago/helpers/index.d.ts +1 -0
- package/src/infra/mercado-pago/helpers/mercado-pago-errors.helper.d.ts +3 -0
- package/src/infra/pagarme/adapters/helpers/index.d.ts +1 -0
- package/src/infra/pagarme/adapters/helpers/pagarme-blocked-order.helper.d.ts +6 -2
- package/src/infra/pagarme/adapters/helpers/pagarme-errors.helper.d.ts +3 -0
- package/src/domain/catalog/models/product-stock-entry.d.ts +0 -16
- package/src/domain/catalog/repositories/product-stock-entry.repository.d.ts +0 -4
- package/src/infra/hasura-graphql/models/product-stock-entry-hasura-graphql.d.ts +0 -3
- package/src/infra/hasura-graphql/repositories/catalog/product-stock-entry-hasura-graphql.repository.d.ts +0 -8
- /package/src/domain/shop-settings/models/{shop-settings.d.ts → shop-page-settings.d.ts} +0 -0
package/index.cjs.js
CHANGED
|
@@ -939,7 +939,39 @@ tslib.__decorate([
|
|
|
939
939
|
tslib.__metadata("design:type", Object)
|
|
940
940
|
], ProductErrors.prototype, "product", void 0);
|
|
941
941
|
|
|
942
|
-
|
|
942
|
+
exports.Where = void 0;
|
|
943
|
+
(function (Where) {
|
|
944
|
+
Where["EQUALS"] = "==";
|
|
945
|
+
Where["NOTEQUALS"] = "!=";
|
|
946
|
+
Where["GT"] = ">";
|
|
947
|
+
Where["GTE"] = ">=";
|
|
948
|
+
Where["IN"] = "in";
|
|
949
|
+
Where["NOTIN"] = "not in";
|
|
950
|
+
Where["LT"] = "<";
|
|
951
|
+
Where["LTE"] = "<=";
|
|
952
|
+
Where["LIKE"] = "like";
|
|
953
|
+
Where["NOTLIKE"] = "not like";
|
|
954
|
+
Where["ISNULL"] = "is null";
|
|
955
|
+
Where["ISNOTNULL"] = "is not null";
|
|
956
|
+
Where["IREGEX"] = "iregex";
|
|
957
|
+
})(exports.Where || (exports.Where = {}));
|
|
958
|
+
|
|
959
|
+
exports.UpdateOptionActions = void 0;
|
|
960
|
+
(function (UpdateOptionActions) {
|
|
961
|
+
UpdateOptionActions["UPDATE"] = "update";
|
|
962
|
+
UpdateOptionActions["MERGE"] = "merge";
|
|
963
|
+
UpdateOptionActions["REMOVE"] = "remove";
|
|
964
|
+
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
965
|
+
UpdateOptionActions["NULL"] = "null";
|
|
966
|
+
})(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
|
|
967
|
+
|
|
968
|
+
class ProductGroup extends BaseModel {
|
|
969
|
+
static get identifiersFields() {
|
|
970
|
+
return ['id'];
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
class ProductPriceLog extends BaseModel {
|
|
943
975
|
static get identifiersFields() {
|
|
944
976
|
return ['id'];
|
|
945
977
|
}
|
|
@@ -967,32 +999,6 @@ tslib.__decorate([
|
|
|
967
999
|
tslib.__metadata("design:type", Array)
|
|
968
1000
|
], Buy2Win.prototype, "categories", void 0);
|
|
969
1001
|
|
|
970
|
-
exports.Where = void 0;
|
|
971
|
-
(function (Where) {
|
|
972
|
-
Where["EQUALS"] = "==";
|
|
973
|
-
Where["NOTEQUALS"] = "!=";
|
|
974
|
-
Where["GT"] = ">";
|
|
975
|
-
Where["GTE"] = ">=";
|
|
976
|
-
Where["IN"] = "in";
|
|
977
|
-
Where["NOTIN"] = "not in";
|
|
978
|
-
Where["LT"] = "<";
|
|
979
|
-
Where["LTE"] = "<=";
|
|
980
|
-
Where["LIKE"] = "like";
|
|
981
|
-
Where["NOTLIKE"] = "not like";
|
|
982
|
-
Where["ISNULL"] = "is null";
|
|
983
|
-
Where["ISNOTNULL"] = "is not null";
|
|
984
|
-
Where["IREGEX"] = "iregex";
|
|
985
|
-
})(exports.Where || (exports.Where = {}));
|
|
986
|
-
|
|
987
|
-
exports.UpdateOptionActions = void 0;
|
|
988
|
-
(function (UpdateOptionActions) {
|
|
989
|
-
UpdateOptionActions["UPDATE"] = "update";
|
|
990
|
-
UpdateOptionActions["MERGE"] = "merge";
|
|
991
|
-
UpdateOptionActions["REMOVE"] = "remove";
|
|
992
|
-
UpdateOptionActions["REMOVE_FIELD"] = "removeField";
|
|
993
|
-
UpdateOptionActions["NULL"] = "null";
|
|
994
|
-
})(exports.UpdateOptionActions || (exports.UpdateOptionActions = {}));
|
|
995
|
-
|
|
996
1002
|
class CampaignDashboard extends BaseModel {
|
|
997
1003
|
static get identifiersFields() {
|
|
998
1004
|
return ['id'];
|
|
@@ -1716,11 +1722,27 @@ tslib.__decorate([
|
|
|
1716
1722
|
tslib.__metadata("design:type", Coupon)
|
|
1717
1723
|
], CheckoutSubscription.prototype, "coupon", void 0);
|
|
1718
1724
|
|
|
1725
|
+
exports.ErrorsCode = void 0;
|
|
1726
|
+
(function (ErrorsCode) {
|
|
1727
|
+
ErrorsCode["genericError"] = "generic-error";
|
|
1728
|
+
ErrorsCode["businessError"] = "business-error";
|
|
1729
|
+
ErrorsCode["invalidCheckoutError"] = "invalid-checkout";
|
|
1730
|
+
ErrorsCode["stockLimit"] = "stock-limit";
|
|
1731
|
+
ErrorsCode["stockOut"] = "stock-out";
|
|
1732
|
+
ErrorsCode["notFound"] = "not-found";
|
|
1733
|
+
ErrorsCode["fraudPreventionInternal"] = "fraud-prevention-internal";
|
|
1734
|
+
ErrorsCode["fraudPreventionExternal"] = "fraud-prevention-external";
|
|
1735
|
+
ErrorsCode["invalidCardError"] = "invalid-card-error";
|
|
1736
|
+
ErrorsCode["insufficientFundsError"] = "insufficient-funds-error";
|
|
1737
|
+
ErrorsCode["paymentNotAuthorizedError"] = "payment-not-authorized-error";
|
|
1738
|
+
ErrorsCode["paymentError"] = "payment-error";
|
|
1739
|
+
})(exports.ErrorsCode || (exports.ErrorsCode = {}));
|
|
1740
|
+
|
|
1719
1741
|
class BusinessError extends tsCustomError.CustomError {
|
|
1720
|
-
constructor(message, additionalData, type
|
|
1742
|
+
constructor(message, additionalData, type) {
|
|
1721
1743
|
super(message);
|
|
1722
1744
|
this.additionalData = additionalData;
|
|
1723
|
-
this.type = type;
|
|
1745
|
+
this.type = type || exports.ErrorsCode.businessError;
|
|
1724
1746
|
}
|
|
1725
1747
|
}
|
|
1726
1748
|
|
|
@@ -1731,10 +1753,10 @@ class DuplicatedResultsError extends tsCustomError.CustomError {
|
|
|
1731
1753
|
}
|
|
1732
1754
|
|
|
1733
1755
|
class FraudValidationError extends tsCustomError.CustomError {
|
|
1734
|
-
constructor(message, additionalData) {
|
|
1756
|
+
constructor(message, type, additionalData) {
|
|
1735
1757
|
super(message);
|
|
1736
1758
|
this.additionalData = additionalData;
|
|
1737
|
-
this.type =
|
|
1759
|
+
this.type = type;
|
|
1738
1760
|
}
|
|
1739
1761
|
}
|
|
1740
1762
|
|
|
@@ -1744,17 +1766,26 @@ class InvalidArgumentError extends tsCustomError.CustomError {
|
|
|
1744
1766
|
}
|
|
1745
1767
|
}
|
|
1746
1768
|
|
|
1769
|
+
class InvalidCheckoutError extends tsCustomError.CustomError {
|
|
1770
|
+
constructor(message, additionalData) {
|
|
1771
|
+
super(message);
|
|
1772
|
+
this.additionalData = additionalData;
|
|
1773
|
+
this.type = exports.ErrorsCode.invalidCheckoutError;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1747
1777
|
class NotFoundError extends tsCustomError.CustomError {
|
|
1748
1778
|
constructor(message) {
|
|
1749
1779
|
super(message);
|
|
1780
|
+
this.type = exports.ErrorsCode.notFound;
|
|
1750
1781
|
}
|
|
1751
1782
|
}
|
|
1752
1783
|
|
|
1753
1784
|
class PaymentError extends tsCustomError.CustomError {
|
|
1754
|
-
constructor(message, additionalData) {
|
|
1785
|
+
constructor(message, type, additionalData) {
|
|
1755
1786
|
super(message);
|
|
1756
1787
|
this.additionalData = additionalData;
|
|
1757
|
-
this.type =
|
|
1788
|
+
this.type = type;
|
|
1758
1789
|
}
|
|
1759
1790
|
}
|
|
1760
1791
|
|
|
@@ -1769,14 +1800,14 @@ class RequiredArgumentError extends tsCustomError.CustomError {
|
|
|
1769
1800
|
class StockLimitError extends BusinessError {
|
|
1770
1801
|
constructor(message, additionalData) {
|
|
1771
1802
|
super(message, additionalData);
|
|
1772
|
-
this.type =
|
|
1803
|
+
this.type = exports.ErrorsCode.stockLimit;
|
|
1773
1804
|
}
|
|
1774
1805
|
}
|
|
1775
1806
|
|
|
1776
1807
|
class StockOutError extends BusinessError {
|
|
1777
1808
|
constructor(message, additionalData) {
|
|
1778
1809
|
super(message, additionalData);
|
|
1779
|
-
this.type =
|
|
1810
|
+
this.type = exports.ErrorsCode.stockOut;
|
|
1780
1811
|
}
|
|
1781
1812
|
}
|
|
1782
1813
|
|
|
@@ -1793,7 +1824,7 @@ class AntifraudBankSlipService {
|
|
|
1793
1824
|
type: 'Boleto',
|
|
1794
1825
|
limiteRange: 'day',
|
|
1795
1826
|
});
|
|
1796
|
-
throw new FraudValidationError('Boleto não autorizado para cliente não assinante', {
|
|
1827
|
+
throw new FraudValidationError('Boleto não autorizado para cliente não assinante', exports.ErrorsCode.fraudPreventionInternal, {
|
|
1797
1828
|
checkoutId: checkout.id,
|
|
1798
1829
|
userEmail: checkout.user.email,
|
|
1799
1830
|
info: {
|
|
@@ -1862,7 +1893,7 @@ class AntifraudCardService {
|
|
|
1862
1893
|
async validateBlockedOrderAttempts(checkout, card) {
|
|
1863
1894
|
const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
|
|
1864
1895
|
if (!isValid) {
|
|
1865
|
-
throw new FraudValidationError(`Cliente com mais de ${this.LIMIT_BLOCKED_ORDERS_DAY} compras negadas/bloqueadas no dia`, {
|
|
1896
|
+
throw new FraudValidationError(`Cliente com mais de ${this.LIMIT_BLOCKED_ORDERS_DAY} compras negadas/bloqueadas no dia`, exports.ErrorsCode.fraudPreventionInternal, {
|
|
1866
1897
|
checkoutId: checkout.id,
|
|
1867
1898
|
userEmail: checkout.user.email,
|
|
1868
1899
|
info: {
|
|
@@ -1876,7 +1907,7 @@ class AntifraudCardService {
|
|
|
1876
1907
|
async validateDayAndWeekOrderLimits(checkout, card) {
|
|
1877
1908
|
const isValid = await this.verifyDayAndWeekOrders(checkout, card);
|
|
1878
1909
|
if (!isValid) {
|
|
1879
|
-
throw new FraudValidationError('Cliente tentando comprar mais do que o permitido no dia/semana', {
|
|
1910
|
+
throw new FraudValidationError('Cliente tentando comprar mais do que o permitido no dia/semana', exports.ErrorsCode.fraudPreventionInternal, {
|
|
1880
1911
|
checkoutId: checkout.id,
|
|
1881
1912
|
userEmail: checkout.user.email,
|
|
1882
1913
|
info: {
|
|
@@ -2368,6 +2399,12 @@ class Home extends BaseModel {
|
|
|
2368
2399
|
}
|
|
2369
2400
|
}
|
|
2370
2401
|
|
|
2402
|
+
class ShopConfigs extends BaseModel {
|
|
2403
|
+
static get identifiersFields() {
|
|
2404
|
+
return ['id'];
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
|
|
2371
2408
|
class ShopMenu extends BaseModel {
|
|
2372
2409
|
static get identifiersFields() {
|
|
2373
2410
|
return ['id'];
|
|
@@ -2389,14 +2426,14 @@ class AdyenBlockedOrderHelper {
|
|
|
2389
2426
|
limiteRange: 'day',
|
|
2390
2427
|
card: params.card,
|
|
2391
2428
|
});
|
|
2392
|
-
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', {
|
|
2429
|
+
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', exports.ErrorsCode.paymentError, {
|
|
2393
2430
|
checkoutId: params.checkout.id,
|
|
2394
2431
|
userEmail: params.checkout.user.email,
|
|
2395
2432
|
info: params.adyenResponse,
|
|
2396
2433
|
});
|
|
2397
2434
|
}
|
|
2398
2435
|
static createPaymentError(checkout, errorInfo) {
|
|
2399
|
-
return 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', {
|
|
2436
|
+
return 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', exports.ErrorsCode.paymentError, {
|
|
2400
2437
|
checkoutId: checkout.id,
|
|
2401
2438
|
userEmail: checkout.user.email,
|
|
2402
2439
|
info: errorInfo,
|
|
@@ -5157,6 +5194,18 @@ class HomeFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
5157
5194
|
}
|
|
5158
5195
|
}
|
|
5159
5196
|
|
|
5197
|
+
class ShopConfigsFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5198
|
+
constructor({ firestore, interceptors, cache, }) {
|
|
5199
|
+
super({
|
|
5200
|
+
firestore,
|
|
5201
|
+
collectionName: 'shopConfigs',
|
|
5202
|
+
model: ShopConfigs,
|
|
5203
|
+
interceptors,
|
|
5204
|
+
cache,
|
|
5205
|
+
});
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
|
|
5160
5209
|
class ShopMenuFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
5161
5210
|
constructor({ firestore, interceptors, cache, }) {
|
|
5162
5211
|
super({
|
|
@@ -5350,6 +5399,7 @@ class OrderBlockedFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
5350
5399
|
card,
|
|
5351
5400
|
checkout,
|
|
5352
5401
|
date: new Date(),
|
|
5402
|
+
gatewayInfo: params.gatewayInfo || {},
|
|
5353
5403
|
}));
|
|
5354
5404
|
}
|
|
5355
5405
|
formatZip(zip) {
|
|
@@ -5974,9 +6024,6 @@ tslib.__decorate([
|
|
|
5974
6024
|
tslib.__metadata("design:type", Object)
|
|
5975
6025
|
], ProductErrorsHasuraGraphQL.prototype, "product", void 0);
|
|
5976
6026
|
|
|
5977
|
-
class ProductStockEntryHasuraGraphQL extends ProductStockEntry {
|
|
5978
|
-
}
|
|
5979
|
-
|
|
5980
6027
|
class CategoryCollectionChildrenHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
5981
6028
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
5982
6029
|
super({
|
|
@@ -7695,6 +7742,31 @@ class ProductErrorsHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHas
|
|
|
7695
7742
|
}
|
|
7696
7743
|
}
|
|
7697
7744
|
|
|
7745
|
+
class ProductGroupHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
7746
|
+
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
7747
|
+
super({
|
|
7748
|
+
tableName: 'group',
|
|
7749
|
+
model: ProductGroup,
|
|
7750
|
+
endpoint,
|
|
7751
|
+
authOptions,
|
|
7752
|
+
interceptors,
|
|
7753
|
+
fields: [
|
|
7754
|
+
'id',
|
|
7755
|
+
'name',
|
|
7756
|
+
'description',
|
|
7757
|
+
{ markupMin: { columnName: 'markup_min' } },
|
|
7758
|
+
{ markupWithoutCompetitor: { columnName: 'markup_without_competitor' } },
|
|
7759
|
+
{ discountCompetitor: { columnName: 'discount_competitor' } },
|
|
7760
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
7761
|
+
{ automaticPriceAdjustment: { columnName: 'automatic_price_adjustment' } },
|
|
7762
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
7763
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
7764
|
+
],
|
|
7765
|
+
cache,
|
|
7766
|
+
});
|
|
7767
|
+
}
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7698
7770
|
const commonFields = [
|
|
7699
7771
|
{
|
|
7700
7772
|
id: {
|
|
@@ -8546,6 +8618,43 @@ tslib.__decorate([
|
|
|
8546
8618
|
tslib.__metadata("design:returntype", Promise)
|
|
8547
8619
|
], ProductHasuraGraphQLRepository.prototype, "findReviewsByProduct", null);
|
|
8548
8620
|
|
|
8621
|
+
class ProductPriceLogHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
8622
|
+
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
8623
|
+
super({
|
|
8624
|
+
tableName: 'product_price_log',
|
|
8625
|
+
model: ProductPriceLog,
|
|
8626
|
+
endpoint,
|
|
8627
|
+
authOptions,
|
|
8628
|
+
interceptors,
|
|
8629
|
+
fields: [
|
|
8630
|
+
'id',
|
|
8631
|
+
{ productId: { columnName: 'product_id' } },
|
|
8632
|
+
{ productEAN: { columnName: 'product_ean' } },
|
|
8633
|
+
{ productSKU: { columnName: 'product_sku' } },
|
|
8634
|
+
{ productName: { columnName: 'product_name' } },
|
|
8635
|
+
{ productCostPrice: { columnName: 'product_cost_price' } },
|
|
8636
|
+
{ productPrice: { columnName: 'product_price' } },
|
|
8637
|
+
{ productSubscriberPrice: { columnName: 'product_subscriber_price' } },
|
|
8638
|
+
{ productSubscriberDiscountPercentage: { columnName: 'product_subscriber_discount_percentage' } },
|
|
8639
|
+
{ markupMin: { columnName: 'markup_min' } },
|
|
8640
|
+
{ markupWithoutCompetitor: { columnName: 'markup_without_competitor' } },
|
|
8641
|
+
{ discountCompetitor: { columnName: 'discount_competitor' } },
|
|
8642
|
+
{ minViablePrice: { columnName: 'min_viable_price' } },
|
|
8643
|
+
{ targetPrice: { columnName: 'target_price' } },
|
|
8644
|
+
{ groupId: { columnName: 'group_id' } },
|
|
8645
|
+
{ competitorsAndPrices: { columnName: 'competitors_and_prices', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8646
|
+
{ competitorsPrices: { columnName: 'competitors_prices', type: HasuraGraphQLColumnType.Jsonb } },
|
|
8647
|
+
{ competitorsMinPrice: { columnName: 'competitors_min_price' } },
|
|
8648
|
+
{ competitorsSellerMinPrice: { columnName: 'competitors_seller_min_price' } },
|
|
8649
|
+
{ statusPrecificacao: { columnName: 'status_precificacao' } },
|
|
8650
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
8651
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
8652
|
+
],
|
|
8653
|
+
cache,
|
|
8654
|
+
});
|
|
8655
|
+
}
|
|
8656
|
+
}
|
|
8657
|
+
|
|
8549
8658
|
class ProductReviewHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
8550
8659
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
8551
8660
|
super({
|
|
@@ -8637,33 +8746,6 @@ tslib.__decorate([
|
|
|
8637
8746
|
tslib.__metadata("design:returntype", void 0)
|
|
8638
8747
|
], ProductReviewHasuraGraphQLRepository.prototype, "disaproveReview", null);
|
|
8639
8748
|
|
|
8640
|
-
class ProductStockEntryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
8641
|
-
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
8642
|
-
super({
|
|
8643
|
-
tableName: 'product_millenium_stock_entry',
|
|
8644
|
-
model: ProductStockEntry,
|
|
8645
|
-
endpoint,
|
|
8646
|
-
authOptions,
|
|
8647
|
-
interceptors,
|
|
8648
|
-
cache,
|
|
8649
|
-
fields: [
|
|
8650
|
-
'id',
|
|
8651
|
-
{ productId: { columnName: 'product_id' } },
|
|
8652
|
-
{ codProduct: { columnName: 'cod_product' } },
|
|
8653
|
-
{ productDescription: { columnName: 'product_description' } },
|
|
8654
|
-
{ eventDescription: { columnName: 'event_description' } },
|
|
8655
|
-
{ invoiceValue: { columnName: 'invoice_value' } },
|
|
8656
|
-
'price',
|
|
8657
|
-
'quantity',
|
|
8658
|
-
{ invoiceId: { columnName: 'invoice_id' } },
|
|
8659
|
-
{ nfeKey: { columnName: 'nfe_key' } },
|
|
8660
|
-
'batch',
|
|
8661
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
8662
|
-
],
|
|
8663
|
-
});
|
|
8664
|
-
}
|
|
8665
|
-
}
|
|
8666
|
-
|
|
8667
8749
|
class ProductStockNotificationHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
8668
8750
|
constructor({ endpoint, authOptions, interceptors, cache, }) {
|
|
8669
8751
|
super({
|
|
@@ -9377,6 +9459,47 @@ tslib.__decorate([
|
|
|
9377
9459
|
tslib.__metadata("design:returntype", Promise)
|
|
9378
9460
|
], WishlistHasuraGraphQLRepository.prototype, "findBfluOrGlamgirlWishlists", null);
|
|
9379
9461
|
|
|
9462
|
+
class MercadoPagoErrorHelper {
|
|
9463
|
+
static getErrorTypeFromResponse(errorCode) {
|
|
9464
|
+
switch (errorCode) {
|
|
9465
|
+
case 'bad_filled_card_data':
|
|
9466
|
+
case 'invalid_card_token':
|
|
9467
|
+
case 'card_disabled':
|
|
9468
|
+
case 'cc_rejected_card_disabled':
|
|
9469
|
+
case 'cc_rejected_bad_filled_card_number':
|
|
9470
|
+
case 'cc_rejected_bad_filled_date':
|
|
9471
|
+
case 'cc_rejected_bad_filled_other':
|
|
9472
|
+
case 'cc_rejected_bad_filled_security_code':
|
|
9473
|
+
return exports.ErrorsCode.invalidCardError;
|
|
9474
|
+
case 'high_risk':
|
|
9475
|
+
case 'rejected_high_risk':
|
|
9476
|
+
case 'cc_rejected_blacklist':
|
|
9477
|
+
case 'cc_rejected_call_for_authorize':
|
|
9478
|
+
case 'cc_rejected_high_risk':
|
|
9479
|
+
return exports.ErrorsCode.fraudPreventionExternal;
|
|
9480
|
+
case 'rejected_by_issuer':
|
|
9481
|
+
case 'rejected_by_bank':
|
|
9482
|
+
case 'cc_rejected_max_attempts':
|
|
9483
|
+
case 'required_call_for_authorize':
|
|
9484
|
+
case 'max_attempts_exceeded':
|
|
9485
|
+
return exports.ErrorsCode.paymentNotAuthorizedError;
|
|
9486
|
+
case 'insufficient_amount':
|
|
9487
|
+
case 'amount_limit_exceeded':
|
|
9488
|
+
case 'cc_rejected_insufficient_amount':
|
|
9489
|
+
return exports.ErrorsCode.insufficientFundsError;
|
|
9490
|
+
case 'processing_error':
|
|
9491
|
+
return exports.ErrorsCode.paymentError;
|
|
9492
|
+
case 'invalid_installments':
|
|
9493
|
+
case 'cc_rejected_invalid_installments':
|
|
9494
|
+
case 'cc_rejected_other_reason':
|
|
9495
|
+
case 'rejected_insufficient_data':
|
|
9496
|
+
return exports.ErrorsCode.businessError;
|
|
9497
|
+
default:
|
|
9498
|
+
return exports.ErrorsCode.paymentError;
|
|
9499
|
+
}
|
|
9500
|
+
}
|
|
9501
|
+
}
|
|
9502
|
+
|
|
9380
9503
|
class MercadoPagoRequestHelper {
|
|
9381
9504
|
static build(data) {
|
|
9382
9505
|
const { checkout, method, postback, card } = data;
|
|
@@ -9591,7 +9714,7 @@ class MercadoPagoBankSlipAxiosAdapter {
|
|
|
9591
9714
|
if (error instanceof axios.AxiosError) {
|
|
9592
9715
|
console.warn(JSON.stringify(error.response.data.message));
|
|
9593
9716
|
}
|
|
9594
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9717
|
+
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', exports.ErrorsCode.paymentError, {
|
|
9595
9718
|
checkoutId: checkout.id,
|
|
9596
9719
|
userEmail: checkout.user.email,
|
|
9597
9720
|
info: error.response.data?.message || error.message?.toString(),
|
|
@@ -9613,16 +9736,7 @@ class MercadoPagoCardAxiosAdapter {
|
|
|
9613
9736
|
try {
|
|
9614
9737
|
const payload = await this.getPaymentPayload(checkout, card);
|
|
9615
9738
|
console.warn('[MERCADO PAGO CARD DATA TO SEND]', JSON.stringify(payload));
|
|
9616
|
-
const
|
|
9617
|
-
method: 'POST',
|
|
9618
|
-
url: `${this.credentials.url}/v1/payments`,
|
|
9619
|
-
headers: {
|
|
9620
|
-
'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
|
|
9621
|
-
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
9622
|
-
'Content-Type': 'application/json',
|
|
9623
|
-
},
|
|
9624
|
-
data: payload,
|
|
9625
|
-
});
|
|
9739
|
+
const data = await this.requestPayment(checkout, payload);
|
|
9626
9740
|
console.warn('[MERCADO PAGO RESPONSE CARD DATA]', JSON.stringify(data));
|
|
9627
9741
|
if (data.status == exports.MercadoPagoStatusEnum.rejected) {
|
|
9628
9742
|
await this.orderBlockedRepository.createBlockedOrderOrPayment({
|
|
@@ -9631,8 +9745,13 @@ class MercadoPagoCardAxiosAdapter {
|
|
|
9631
9745
|
type: 'Card',
|
|
9632
9746
|
limiteRange: 'day',
|
|
9633
9747
|
card,
|
|
9748
|
+
gatewayInfo: {
|
|
9749
|
+
status: data.status,
|
|
9750
|
+
statusDetail: data.status_detail,
|
|
9751
|
+
},
|
|
9634
9752
|
});
|
|
9635
|
-
|
|
9753
|
+
const errorCode = MercadoPagoErrorHelper.getErrorTypeFromResponse(data.status_detail);
|
|
9754
|
+
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', errorCode, {
|
|
9636
9755
|
checkoutId: checkout.id,
|
|
9637
9756
|
userEmail: checkout.user.email,
|
|
9638
9757
|
info: data,
|
|
@@ -9643,15 +9762,29 @@ class MercadoPagoCardAxiosAdapter {
|
|
|
9643
9762
|
}
|
|
9644
9763
|
catch (error) {
|
|
9645
9764
|
if (error instanceof axios.AxiosError) {
|
|
9646
|
-
console.warn(JSON.stringify(error.response
|
|
9765
|
+
console.warn(JSON.stringify(error.response?.data?.message));
|
|
9766
|
+
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', exports.ErrorsCode.paymentError, {
|
|
9767
|
+
checkoutId: checkout.id,
|
|
9768
|
+
userEmail: checkout.user.email,
|
|
9769
|
+
info: error.response?.data?.message || error.message?.toString(),
|
|
9770
|
+
});
|
|
9647
9771
|
}
|
|
9648
|
-
throw
|
|
9649
|
-
checkoutId: checkout.id,
|
|
9650
|
-
userEmail: checkout.user.email,
|
|
9651
|
-
info: error.response.data?.message || error.message?.toString(),
|
|
9652
|
-
});
|
|
9772
|
+
throw error;
|
|
9653
9773
|
}
|
|
9654
9774
|
}
|
|
9775
|
+
async requestPayment(checkout, payload) {
|
|
9776
|
+
const { data } = await axios__default["default"]({
|
|
9777
|
+
method: 'POST',
|
|
9778
|
+
url: `${this.credentials.url}/v1/payments`,
|
|
9779
|
+
headers: {
|
|
9780
|
+
'X-Idempotency-Key': `${checkout.id}-${new Date().getTime()}`,
|
|
9781
|
+
Authorization: `Bearer ${this.credentials.api_key}`,
|
|
9782
|
+
'Content-Type': 'application/json',
|
|
9783
|
+
},
|
|
9784
|
+
data: payload,
|
|
9785
|
+
});
|
|
9786
|
+
return data;
|
|
9787
|
+
}
|
|
9655
9788
|
async getPaymentPayload(checkout, card) {
|
|
9656
9789
|
const cardResponse = await this.getCardByToken(card.customerId, card.cardId, card.cardCvv);
|
|
9657
9790
|
const payload = MercadoPagoRequestHelper.build({
|
|
@@ -9753,7 +9886,7 @@ class MercadoPagoPixAxiosAdapter {
|
|
|
9753
9886
|
if (error instanceof axios.AxiosError) {
|
|
9754
9887
|
console.warn(JSON.stringify(error.response.data.message));
|
|
9755
9888
|
}
|
|
9756
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
9889
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', exports.ErrorsCode.paymentError, {
|
|
9757
9890
|
checkoutId: checkout.id,
|
|
9758
9891
|
userEmail: checkout.user.email,
|
|
9759
9892
|
info: error.response.data?.message || error.message?.toString(),
|
|
@@ -9824,7 +9957,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
9824
9957
|
});
|
|
9825
9958
|
console.warn('[PAGARME BOLETO DATA TO SEND]', payload);
|
|
9826
9959
|
if (result.data.status !== exports.PagarmePaymentStatus['Em processamento']) {
|
|
9827
|
-
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9960
|
+
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', exports.ErrorsCode.paymentError, {
|
|
9828
9961
|
checkoutId: checkout.id,
|
|
9829
9962
|
userEmail: checkout.user.email,
|
|
9830
9963
|
info: result.data,
|
|
@@ -9842,7 +9975,7 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
9842
9975
|
return payment;
|
|
9843
9976
|
}
|
|
9844
9977
|
catch (error) {
|
|
9845
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
9978
|
+
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', exports.ErrorsCode.paymentError, {
|
|
9846
9979
|
checkoutId: checkout.id,
|
|
9847
9980
|
userEmail: checkout.user.email,
|
|
9848
9981
|
info: error.response.data,
|
|
@@ -9894,24 +10027,25 @@ class PagarmeBankSlipAxiosAdapter {
|
|
|
9894
10027
|
|
|
9895
10028
|
class PagarmeBlockedOrderHelper {
|
|
9896
10029
|
static async createBlockedOrderForUnauthorizedCard(params) {
|
|
9897
|
-
const { checkout, card, orderBlockedRepository } = params;
|
|
10030
|
+
const { checkout, card, orderBlockedRepository, gatewayInfo } = params;
|
|
9898
10031
|
await orderBlockedRepository.createBlockedOrderOrPayment({
|
|
9899
10032
|
checkout,
|
|
9900
10033
|
blockType: 'Card not authorized',
|
|
9901
10034
|
type: 'Card',
|
|
9902
10035
|
limiteRange: 'day',
|
|
9903
10036
|
card,
|
|
10037
|
+
gatewayInfo,
|
|
9904
10038
|
});
|
|
9905
10039
|
}
|
|
9906
|
-
static createPaymentError(checkout, resultData) {
|
|
9907
|
-
return 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', {
|
|
10040
|
+
static createPaymentError(checkout, errorType, resultData) {
|
|
10041
|
+
return 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', errorType, {
|
|
9908
10042
|
checkoutId: checkout.id,
|
|
9909
10043
|
userEmail: checkout.user.email,
|
|
9910
10044
|
info: resultData,
|
|
9911
10045
|
});
|
|
9912
10046
|
}
|
|
9913
|
-
static createGenericPaymentError(checkout, errorResponseData) {
|
|
9914
|
-
return 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', {
|
|
10047
|
+
static createGenericPaymentError(checkout, errorType, errorResponseData) {
|
|
10048
|
+
return 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', errorType, {
|
|
9915
10049
|
checkoutId: checkout.id,
|
|
9916
10050
|
userEmail: checkout.user.email,
|
|
9917
10051
|
info: errorResponseData,
|
|
@@ -9919,6 +10053,162 @@ class PagarmeBlockedOrderHelper {
|
|
|
9919
10053
|
}
|
|
9920
10054
|
}
|
|
9921
10055
|
|
|
10056
|
+
/* eslint-disable complexity */
|
|
10057
|
+
class PagarMeErrorHelper {
|
|
10058
|
+
static getErrorTypeFromResponse(errorCode) {
|
|
10059
|
+
switch (errorCode) {
|
|
10060
|
+
// Cartão inválido, vencido, bloqueado
|
|
10061
|
+
case '1000':
|
|
10062
|
+
case '1001':
|
|
10063
|
+
case '1011':
|
|
10064
|
+
case '1025':
|
|
10065
|
+
case '1032':
|
|
10066
|
+
case '1045':
|
|
10067
|
+
case '1068':
|
|
10068
|
+
case '1069':
|
|
10069
|
+
case '1070':
|
|
10070
|
+
case '2001':
|
|
10071
|
+
case '2004':
|
|
10072
|
+
return exports.ErrorsCode.invalidCardError;
|
|
10073
|
+
// Suspeita de fraude, prevenção do banco
|
|
10074
|
+
case '1002':
|
|
10075
|
+
case '1004':
|
|
10076
|
+
case '1019':
|
|
10077
|
+
case '2002':
|
|
10078
|
+
case '2005':
|
|
10079
|
+
case '2007':
|
|
10080
|
+
case '2008':
|
|
10081
|
+
case '2009':
|
|
10082
|
+
case '2010':
|
|
10083
|
+
return exports.ErrorsCode.fraudPreventionExternal;
|
|
10084
|
+
// Recusado pelo banco/emissor
|
|
10085
|
+
case '1007':
|
|
10086
|
+
case '1008':
|
|
10087
|
+
case '2000':
|
|
10088
|
+
case '5093':
|
|
10089
|
+
return exports.ErrorsCode.paymentNotAuthorizedError;
|
|
10090
|
+
// Saldo/limite insuficiente ou excedido
|
|
10091
|
+
case '1016':
|
|
10092
|
+
case '1021':
|
|
10093
|
+
case '1023':
|
|
10094
|
+
case '2011':
|
|
10095
|
+
case '2012':
|
|
10096
|
+
case '5051':
|
|
10097
|
+
case '5087':
|
|
10098
|
+
return exports.ErrorsCode.insufficientFundsError;
|
|
10099
|
+
// Valor solicitado inválido
|
|
10100
|
+
case '5016':
|
|
10101
|
+
case '5092':
|
|
10102
|
+
return exports.ErrorsCode.paymentError;
|
|
10103
|
+
// Código de segurança inválido ou não enviado
|
|
10104
|
+
case '5025':
|
|
10105
|
+
case '9124':
|
|
10106
|
+
return exports.ErrorsCode.paymentError;
|
|
10107
|
+
// Dados obrigatórios ausentes
|
|
10108
|
+
case '1044':
|
|
10109
|
+
case '5034':
|
|
10110
|
+
case '5047':
|
|
10111
|
+
case '5061':
|
|
10112
|
+
return exports.ErrorsCode.paymentError;
|
|
10113
|
+
// Erros internos ou genéricos
|
|
10114
|
+
case '5000':
|
|
10115
|
+
case '5001':
|
|
10116
|
+
case '5003':
|
|
10117
|
+
case '5004':
|
|
10118
|
+
case '5006':
|
|
10119
|
+
case '5008':
|
|
10120
|
+
case '5009':
|
|
10121
|
+
case '5010':
|
|
10122
|
+
case '5011':
|
|
10123
|
+
case '5012':
|
|
10124
|
+
case '5013':
|
|
10125
|
+
case '5014':
|
|
10126
|
+
case '5015':
|
|
10127
|
+
case '5017':
|
|
10128
|
+
case '5018':
|
|
10129
|
+
case '5019':
|
|
10130
|
+
case '5020':
|
|
10131
|
+
case '5021':
|
|
10132
|
+
case '5022':
|
|
10133
|
+
case '5023':
|
|
10134
|
+
case '5024':
|
|
10135
|
+
case '5026':
|
|
10136
|
+
case '5027':
|
|
10137
|
+
case '5028':
|
|
10138
|
+
case '5029':
|
|
10139
|
+
case '5030':
|
|
10140
|
+
case '5031':
|
|
10141
|
+
case '5032':
|
|
10142
|
+
case '5033':
|
|
10143
|
+
case '5035':
|
|
10144
|
+
case '5036':
|
|
10145
|
+
case '5037':
|
|
10146
|
+
case '5038':
|
|
10147
|
+
case '5039':
|
|
10148
|
+
case '5040':
|
|
10149
|
+
case '5041':
|
|
10150
|
+
case '5042':
|
|
10151
|
+
case '5043':
|
|
10152
|
+
case '5044':
|
|
10153
|
+
case '5045':
|
|
10154
|
+
case '5049':
|
|
10155
|
+
case '5050':
|
|
10156
|
+
case '5052':
|
|
10157
|
+
case '5053':
|
|
10158
|
+
case '5054':
|
|
10159
|
+
case '5055':
|
|
10160
|
+
case '5056':
|
|
10161
|
+
case '5057':
|
|
10162
|
+
case '5058':
|
|
10163
|
+
case '5059':
|
|
10164
|
+
case '5060':
|
|
10165
|
+
case '5062':
|
|
10166
|
+
case '5063':
|
|
10167
|
+
case '5064':
|
|
10168
|
+
case '5065':
|
|
10169
|
+
case '5066':
|
|
10170
|
+
case '5067':
|
|
10171
|
+
case '5068':
|
|
10172
|
+
case '5069':
|
|
10173
|
+
case '5070':
|
|
10174
|
+
case '5071':
|
|
10175
|
+
case '5072':
|
|
10176
|
+
case '5073':
|
|
10177
|
+
case '5074':
|
|
10178
|
+
case '5075':
|
|
10179
|
+
case '5076':
|
|
10180
|
+
case '5077':
|
|
10181
|
+
case '5078':
|
|
10182
|
+
case '5079':
|
|
10183
|
+
case '5080':
|
|
10184
|
+
case '5081':
|
|
10185
|
+
case '5082':
|
|
10186
|
+
case '5083':
|
|
10187
|
+
case '5084':
|
|
10188
|
+
case '5085':
|
|
10189
|
+
case '5089':
|
|
10190
|
+
case '5090':
|
|
10191
|
+
case '5095':
|
|
10192
|
+
case '5096':
|
|
10193
|
+
case '5097':
|
|
10194
|
+
return exports.ErrorsCode.paymentError;
|
|
10195
|
+
// Banco/emissor inválido ou não operante
|
|
10196
|
+
case '1049':
|
|
10197
|
+
case '1050':
|
|
10198
|
+
return exports.ErrorsCode.paymentError;
|
|
10199
|
+
// Transação não suportada para o banco/emissor
|
|
10200
|
+
case '1061':
|
|
10201
|
+
return exports.ErrorsCode.paymentError;
|
|
10202
|
+
case '5094':
|
|
10203
|
+
case '1010':
|
|
10204
|
+
case '1046':
|
|
10205
|
+
return exports.ErrorsCode.businessError;
|
|
10206
|
+
default:
|
|
10207
|
+
return exports.ErrorsCode.paymentError;
|
|
10208
|
+
}
|
|
10209
|
+
}
|
|
10210
|
+
}
|
|
10211
|
+
|
|
9922
10212
|
class PagarmePaymentFactoryHelper {
|
|
9923
10213
|
static async createSuccessfulPayment(params) {
|
|
9924
10214
|
const { checkout, resultData, paymentRepository } = params;
|
|
@@ -10174,7 +10464,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
10174
10464
|
card,
|
|
10175
10465
|
orderBlockedRepository: this.orderBlockedRepository,
|
|
10176
10466
|
});
|
|
10177
|
-
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, result.data);
|
|
10467
|
+
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, exports.ErrorsCode.paymentError, result.data);
|
|
10178
10468
|
}
|
|
10179
10469
|
return PagarmePaymentFactoryHelper.createSuccessfulPayment({
|
|
10180
10470
|
checkout,
|
|
@@ -10186,7 +10476,7 @@ class PagarmeCardAxiosAdapter {
|
|
|
10186
10476
|
if (error instanceof PaymentError) {
|
|
10187
10477
|
throw error;
|
|
10188
10478
|
}
|
|
10189
|
-
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, error.response?.data);
|
|
10479
|
+
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, exports.ErrorsCode.paymentError, error.response?.data);
|
|
10190
10480
|
}
|
|
10191
10481
|
}
|
|
10192
10482
|
async addCard(card) {
|
|
@@ -10343,7 +10633,7 @@ class PagarmePixAxiosAdapter {
|
|
|
10343
10633
|
return payment;
|
|
10344
10634
|
}
|
|
10345
10635
|
catch (error) {
|
|
10346
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
10636
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', exports.ErrorsCode.paymentError, {
|
|
10347
10637
|
checkoutId: checkout.id,
|
|
10348
10638
|
userEmail: checkout.user.email,
|
|
10349
10639
|
info: error.response?.data,
|
|
@@ -10398,7 +10688,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
10398
10688
|
data.charges.at(0).status === exports.PagarMeV5OrderStatus.Falha ||
|
|
10399
10689
|
(data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus.Gerado &&
|
|
10400
10690
|
data.charges.at(0).last_transaction.status !== exports.PagarMeV5PaymentStatus['Em processamento'])) {
|
|
10401
|
-
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
10691
|
+
return Promise.reject(new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', exports.ErrorsCode.paymentError, {
|
|
10402
10692
|
checkoutId: checkout.id,
|
|
10403
10693
|
userEmail: checkout.user.email,
|
|
10404
10694
|
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
@@ -10411,7 +10701,7 @@ class PagarmeV5BankSlipAxiosAdapter {
|
|
|
10411
10701
|
if (error instanceof axios.AxiosError) {
|
|
10412
10702
|
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
10413
10703
|
}
|
|
10414
|
-
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', {
|
|
10704
|
+
throw new PaymentError('Houve uma falha ao gerar o boleto. Tente novamente', exports.ErrorsCode.paymentError, {
|
|
10415
10705
|
checkoutId: checkout.id,
|
|
10416
10706
|
userEmail: checkout.user.email,
|
|
10417
10707
|
info: error.response?.data,
|
|
@@ -10462,27 +10752,31 @@ class PagarmeV5CardAxiosAdapter {
|
|
|
10462
10752
|
data: payload,
|
|
10463
10753
|
});
|
|
10464
10754
|
console.warn('[RESPONSE PAGARME CARD DATA]', JSON.stringify(data));
|
|
10755
|
+
const charge = data.charges.at(0);
|
|
10465
10756
|
if (data.status == exports.PagarMeV5OrderStatus.Falha ||
|
|
10466
|
-
|
|
10467
|
-
|
|
10757
|
+
charge.status !== exports.PagarMeV5OrderStatus.Pago ||
|
|
10758
|
+
charge.last_transaction.status !== exports.PagarMeV5PaymentStatus.Capturada) {
|
|
10468
10759
|
await PagarmeBlockedOrderHelper.createBlockedOrderForUnauthorizedCard({
|
|
10469
10760
|
checkout,
|
|
10470
10761
|
card,
|
|
10471
10762
|
orderBlockedRepository: this.orderBlockedRepository,
|
|
10763
|
+
gatewayInfo: {
|
|
10764
|
+
status: charge.status,
|
|
10765
|
+
statusDetail: charge.last_transaction?.status,
|
|
10766
|
+
},
|
|
10472
10767
|
});
|
|
10473
|
-
|
|
10768
|
+
const errorCode = PagarMeErrorHelper.getErrorTypeFromResponse(charge.last_transaction.acquirer_return_code);
|
|
10769
|
+
throw PagarmeBlockedOrderHelper.createPaymentError(checkout, errorCode, data);
|
|
10474
10770
|
}
|
|
10475
10771
|
const payment = await this.paymentRepository.create(PagarMeV5ResponseHelper.build(exports.TransactionPaymentMethods.CARD, checkout, data));
|
|
10476
10772
|
return payment;
|
|
10477
10773
|
}
|
|
10478
10774
|
catch (error) {
|
|
10479
|
-
if (error instanceof PaymentError) {
|
|
10480
|
-
throw error;
|
|
10481
|
-
}
|
|
10482
10775
|
if (error instanceof axios.AxiosError) {
|
|
10483
10776
|
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
10777
|
+
throw PagarmeBlockedOrderHelper.createGenericPaymentError(checkout, exports.ErrorsCode.paymentError, error.response?.data);
|
|
10484
10778
|
}
|
|
10485
|
-
throw
|
|
10779
|
+
throw error;
|
|
10486
10780
|
}
|
|
10487
10781
|
}
|
|
10488
10782
|
async addCard(card, customer) {
|
|
@@ -10628,7 +10922,7 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
10628
10922
|
});
|
|
10629
10923
|
console.warn('[RESPONSE PAGARME PIX DATA]', JSON.stringify(data));
|
|
10630
10924
|
if (data.status == exports.PagarMeV5OrderStatus.Falha || data.status == exports.PagarMeV5OrderStatus.Cancelado) {
|
|
10631
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
10925
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', exports.ErrorsCode.paymentError, {
|
|
10632
10926
|
checkoutId: checkout.id,
|
|
10633
10927
|
userEmail: checkout.user.email,
|
|
10634
10928
|
info: data.charges.at(0).last_transaction?.gateway_response,
|
|
@@ -10641,7 +10935,7 @@ class PagarmeV5PixAxiosAdapter {
|
|
|
10641
10935
|
if (error instanceof axios.AxiosError) {
|
|
10642
10936
|
console.error('error data: ', JSON.stringify(error.response?.data));
|
|
10643
10937
|
}
|
|
10644
|
-
throw new PaymentError('Houve uma falha ao processar pagamento com pix', {
|
|
10938
|
+
throw new PaymentError('Houve uma falha ao processar pagamento com pix', exports.ErrorsCode.paymentError, {
|
|
10645
10939
|
checkoutId: checkout.id,
|
|
10646
10940
|
userEmail: checkout.user.email,
|
|
10647
10941
|
info: error.response?.data,
|
|
@@ -10996,6 +11290,7 @@ exports.GroupFirestoreRepository = GroupFirestoreRepository;
|
|
|
10996
11290
|
exports.Home = Home;
|
|
10997
11291
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
10998
11292
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
11293
|
+
exports.InvalidCheckoutError = InvalidCheckoutError;
|
|
10999
11294
|
exports.KitProduct = KitProduct;
|
|
11000
11295
|
exports.KitProductHasuraGraphQL = KitProductHasuraGraphQL;
|
|
11001
11296
|
exports.Lead = Lead;
|
|
@@ -11008,6 +11303,7 @@ exports.LogFirestoreRepository = LogFirestoreRepository;
|
|
|
11008
11303
|
exports.Logger = Logger;
|
|
11009
11304
|
exports.MercadoPagoBankSlipAxiosAdapter = MercadoPagoBankSlipAxiosAdapter;
|
|
11010
11305
|
exports.MercadoPagoCardAxiosAdapter = MercadoPagoCardAxiosAdapter;
|
|
11306
|
+
exports.MercadoPagoErrorHelper = MercadoPagoErrorHelper;
|
|
11011
11307
|
exports.MercadoPagoPaymentMethodFactory = MercadoPagoPaymentMethodFactory;
|
|
11012
11308
|
exports.MercadoPagoPixAxiosAdapter = MercadoPagoPixAxiosAdapter;
|
|
11013
11309
|
exports.MercadoPagoRequestHelper = MercadoPagoRequestHelper;
|
|
@@ -11037,13 +11333,14 @@ exports.ProductErrors = ProductErrors;
|
|
|
11037
11333
|
exports.ProductErrorsHasuraGraphQL = ProductErrorsHasuraGraphQL;
|
|
11038
11334
|
exports.ProductErrorsHasuraGraphQLRepository = ProductErrorsHasuraGraphQLRepository;
|
|
11039
11335
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
11336
|
+
exports.ProductGroup = ProductGroup;
|
|
11337
|
+
exports.ProductGroupHasuraGraphQLRepository = ProductGroupHasuraGraphQLRepository;
|
|
11040
11338
|
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
11041
11339
|
exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
|
|
11340
|
+
exports.ProductPriceLog = ProductPriceLog;
|
|
11341
|
+
exports.ProductPriceLogHasuraGraphQLRepository = ProductPriceLogHasuraGraphQLRepository;
|
|
11042
11342
|
exports.ProductReview = ProductReview;
|
|
11043
11343
|
exports.ProductReviewHasuraGraphQLRepository = ProductReviewHasuraGraphQLRepository;
|
|
11044
|
-
exports.ProductStockEntry = ProductStockEntry;
|
|
11045
|
-
exports.ProductStockEntryHasuraGraphQL = ProductStockEntryHasuraGraphQL;
|
|
11046
|
-
exports.ProductStockEntryHasuraGraphQLRepository = ProductStockEntryHasuraGraphQLRepository;
|
|
11047
11344
|
exports.ProductStockNotification = ProductStockNotification;
|
|
11048
11345
|
exports.ProductStockNotificationHasuraGraphQLRepository = ProductStockNotificationHasuraGraphQLRepository;
|
|
11049
11346
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
@@ -11059,6 +11356,8 @@ exports.RoundProductPricesHelper = RoundProductPricesHelper;
|
|
|
11059
11356
|
exports.Sequence = Sequence;
|
|
11060
11357
|
exports.SequenceFirestoreRepository = SequenceFirestoreRepository;
|
|
11061
11358
|
exports.ShippingMethod = ShippingMethod;
|
|
11359
|
+
exports.ShopConfigs = ShopConfigs;
|
|
11360
|
+
exports.ShopConfigsFirestoreRepository = ShopConfigsFirestoreRepository;
|
|
11062
11361
|
exports.ShopMenu = ShopMenu;
|
|
11063
11362
|
exports.ShopMenuFirestoreRepository = ShopMenuFirestoreRepository;
|
|
11064
11363
|
exports.ShopSettings = ShopSettings;
|