@infrab4a/connect 5.3.10-beta.1 → 5.3.10-beta.2

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.
Files changed (3) hide show
  1. package/index.cjs.js +13 -12
  2. package/index.esm.js +13 -12
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -1798,38 +1798,39 @@ class AntifraudCardService {
1798
1798
  subscriber: {
1799
1799
  cpf: 4,
1800
1800
  email: 4,
1801
- telefone: 4,
1801
+ phone: 4,
1802
1802
  card: 4,
1803
- cep: 4,
1803
+ zip: 4,
1804
1804
  },
1805
1805
  nonSubscriber: {
1806
1806
  cpf: 2,
1807
1807
  email: 2,
1808
- telefone: 2,
1808
+ phone: 2,
1809
1809
  card: 2,
1810
- cep: 2,
1810
+ zip: 2,
1811
1811
  },
1812
1812
  };
1813
1813
  this.LIMIT_ORDERS_WEEK = {
1814
1814
  subscriber: {
1815
1815
  cpf: 12,
1816
1816
  email: 12,
1817
- telefone: 12,
1817
+ phone: 12,
1818
1818
  card: 12,
1819
- cep: Infinity,
1819
+ zip: Infinity,
1820
1820
  },
1821
1821
  nonSubscriber: {
1822
1822
  cpf: 7,
1823
1823
  email: 7,
1824
- telefone: 7,
1824
+ phone: 7,
1825
1825
  card: 7,
1826
- cep: 7,
1826
+ zip: Infinity,
1827
1827
  },
1828
1828
  };
1829
1829
  this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1830
1830
  }
1831
- getLimitsByUserType(isSubscriber) {
1832
- return isSubscriber ? this.LIMIT_ORDERS_DAY['subscriber'] : this.LIMIT_ORDERS_DAY['nonSubscriber'];
1831
+ getLimitsByUserType(type, isSubscriber) {
1832
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1833
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1833
1834
  }
1834
1835
  async validateBlockedOrderAttempts(checkout, card) {
1835
1836
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
@@ -1988,7 +1989,7 @@ class AntifraudCardService {
1988
1989
  }
1989
1990
  async validateDayOrderLimits(checkout, params) {
1990
1991
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
1991
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1992
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1992
1993
  return this.checkOrderLimitsAndBlock({
1993
1994
  checkout,
1994
1995
  orderCounts: ordersPerDay,
@@ -1998,7 +1999,7 @@ class AntifraudCardService {
1998
1999
  }
1999
2000
  async validateWeekOrderLimits(checkout, params) {
2000
2001
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
2001
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
2002
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
2002
2003
  return this.checkOrderLimitsAndBlock({
2003
2004
  checkout,
2004
2005
  orderCounts: ordersPerWeek,
package/index.esm.js CHANGED
@@ -1774,38 +1774,39 @@ class AntifraudCardService {
1774
1774
  subscriber: {
1775
1775
  cpf: 4,
1776
1776
  email: 4,
1777
- telefone: 4,
1777
+ phone: 4,
1778
1778
  card: 4,
1779
- cep: 4,
1779
+ zip: 4,
1780
1780
  },
1781
1781
  nonSubscriber: {
1782
1782
  cpf: 2,
1783
1783
  email: 2,
1784
- telefone: 2,
1784
+ phone: 2,
1785
1785
  card: 2,
1786
- cep: 2,
1786
+ zip: 2,
1787
1787
  },
1788
1788
  };
1789
1789
  this.LIMIT_ORDERS_WEEK = {
1790
1790
  subscriber: {
1791
1791
  cpf: 12,
1792
1792
  email: 12,
1793
- telefone: 12,
1793
+ phone: 12,
1794
1794
  card: 12,
1795
- cep: Infinity,
1795
+ zip: Infinity,
1796
1796
  },
1797
1797
  nonSubscriber: {
1798
1798
  cpf: 7,
1799
1799
  email: 7,
1800
- telefone: 7,
1800
+ phone: 7,
1801
1801
  card: 7,
1802
- cep: 7,
1802
+ zip: Infinity,
1803
1803
  },
1804
1804
  };
1805
1805
  this.LIMIT_BLOCKED_ORDERS_DAY = isSubscriber ? 7 : 5;
1806
1806
  }
1807
- getLimitsByUserType(isSubscriber) {
1808
- return isSubscriber ? this.LIMIT_ORDERS_DAY['subscriber'] : this.LIMIT_ORDERS_DAY['nonSubscriber'];
1807
+ getLimitsByUserType(type, isSubscriber) {
1808
+ const limits = type === 'day' ? this.LIMIT_ORDERS_DAY : this.LIMIT_ORDERS_WEEK;
1809
+ return isSubscriber ? limits['subscriber'] : limits['nonSubscriber'];
1809
1810
  }
1810
1811
  async validateBlockedOrderAttempts(checkout, card) {
1811
1812
  const isValid = await this.verifyBlockedOrderAttempts(checkout, card);
@@ -1964,7 +1965,7 @@ class AntifraudCardService {
1964
1965
  }
1965
1966
  async validateDayOrderLimits(checkout, params) {
1966
1967
  const ordersPerDay = await this.validateOrdersByRange(params, this.getDateRange('day'));
1967
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1968
+ const limits = this.getLimitsByUserType('day', checkout.user.isSubscriber);
1968
1969
  return this.checkOrderLimitsAndBlock({
1969
1970
  checkout,
1970
1971
  orderCounts: ordersPerDay,
@@ -1974,7 +1975,7 @@ class AntifraudCardService {
1974
1975
  }
1975
1976
  async validateWeekOrderLimits(checkout, params) {
1976
1977
  const ordersPerWeek = await this.validateOrdersByRange(params, this.getDateRange('week'));
1977
- const limits = this.getLimitsByUserType(checkout.user.isSubscriber);
1978
+ const limits = this.getLimitsByUserType('week', checkout.user.isSubscriber);
1978
1979
  return this.checkOrderLimitsAndBlock({
1979
1980
  checkout,
1980
1981
  orderCounts: ordersPerWeek,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.3.10-beta.1",
3
+ "version": "5.3.10-beta.2",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },