@beabee/beabee-common 0.21.1-alpha.0 → 0.21.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/beabee-common.js +29 -17
- package/dist/browser/beabee-common.js.map +3 -3
- package/dist/browser/beabee-common.min.js +1 -1
- package/dist/browser/index.js +29 -17
- package/dist/cjs/data/payment-method.cjs +2 -0
- package/dist/cjs/utils/payments.cjs +12 -2
- package/dist/esm/data/payment-method.js +2 -0
- package/dist/esm/utils/payments.js +12 -2
- package/dist/types/data/payment-method.d.ts +2 -0
- package/dist/types/types/get-callout-data-with.d.ts +5 -9
- package/package.json +1 -1
|
@@ -262,6 +262,8 @@
|
|
|
262
262
|
|
|
263
263
|
// src/data/payment-method.ts
|
|
264
264
|
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
265
|
+
PaymentMethod2["None"] = "none";
|
|
266
|
+
PaymentMethod2["Manual"] = "manual";
|
|
265
267
|
PaymentMethod2["StripeCard"] = "s_card";
|
|
266
268
|
PaymentMethod2["StripeSEPA"] = "s_sepa";
|
|
267
269
|
PaymentMethod2["StripeBACS"] = "s_bacs";
|
|
@@ -1720,7 +1722,7 @@
|
|
|
1720
1722
|
return Number(num) * Math.pow(1024, unitIndex);
|
|
1721
1723
|
};
|
|
1722
1724
|
|
|
1723
|
-
//
|
|
1725
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/toDate.mjs
|
|
1724
1726
|
function toDate(argument) {
|
|
1725
1727
|
const argStr = Object.prototype.toString.call(argument);
|
|
1726
1728
|
if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
|
|
@@ -1732,7 +1734,7 @@
|
|
|
1732
1734
|
}
|
|
1733
1735
|
}
|
|
1734
1736
|
|
|
1735
|
-
//
|
|
1737
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/constructFrom.mjs
|
|
1736
1738
|
function constructFrom(date, value) {
|
|
1737
1739
|
if (date instanceof Date) {
|
|
1738
1740
|
return new date.constructor(value);
|
|
@@ -1741,7 +1743,7 @@
|
|
|
1741
1743
|
}
|
|
1742
1744
|
}
|
|
1743
1745
|
|
|
1744
|
-
//
|
|
1746
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/addDays.mjs
|
|
1745
1747
|
function addDays(date, amount) {
|
|
1746
1748
|
const _date = toDate(date);
|
|
1747
1749
|
if (isNaN(amount))
|
|
@@ -1753,7 +1755,7 @@
|
|
|
1753
1755
|
return _date;
|
|
1754
1756
|
}
|
|
1755
1757
|
|
|
1756
|
-
//
|
|
1758
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/addMonths.mjs
|
|
1757
1759
|
function addMonths(date, amount) {
|
|
1758
1760
|
const _date = toDate(date);
|
|
1759
1761
|
if (isNaN(amount))
|
|
@@ -1777,7 +1779,7 @@
|
|
|
1777
1779
|
}
|
|
1778
1780
|
}
|
|
1779
1781
|
|
|
1780
|
-
//
|
|
1782
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/add.mjs
|
|
1781
1783
|
function add(date, duration) {
|
|
1782
1784
|
const {
|
|
1783
1785
|
years = 0,
|
|
@@ -1798,7 +1800,7 @@
|
|
|
1798
1800
|
return finalDate;
|
|
1799
1801
|
}
|
|
1800
1802
|
|
|
1801
|
-
//
|
|
1803
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/constants.mjs
|
|
1802
1804
|
var daysInYear = 365.2425;
|
|
1803
1805
|
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
|
|
1804
1806
|
var minTime = -maxTime;
|
|
@@ -1811,19 +1813,19 @@
|
|
|
1811
1813
|
var secondsInMonth = secondsInYear / 12;
|
|
1812
1814
|
var secondsInQuarter = secondsInMonth * 3;
|
|
1813
1815
|
|
|
1814
|
-
//
|
|
1816
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfDay.mjs
|
|
1815
1817
|
function startOfDay(date) {
|
|
1816
1818
|
const _date = toDate(date);
|
|
1817
1819
|
_date.setHours(0, 0, 0, 0);
|
|
1818
1820
|
return _date;
|
|
1819
1821
|
}
|
|
1820
1822
|
|
|
1821
|
-
//
|
|
1823
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/isDate.mjs
|
|
1822
1824
|
function isDate(value) {
|
|
1823
1825
|
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
1824
1826
|
}
|
|
1825
1827
|
|
|
1826
|
-
//
|
|
1828
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/isValid.mjs
|
|
1827
1829
|
function isValid(date) {
|
|
1828
1830
|
if (!isDate(date) && typeof date !== "number") {
|
|
1829
1831
|
return false;
|
|
@@ -1832,14 +1834,14 @@
|
|
|
1832
1834
|
return !isNaN(Number(_date));
|
|
1833
1835
|
}
|
|
1834
1836
|
|
|
1835
|
-
//
|
|
1837
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfMinute.mjs
|
|
1836
1838
|
function startOfMinute(date) {
|
|
1837
1839
|
const _date = toDate(date);
|
|
1838
1840
|
_date.setSeconds(0, 0);
|
|
1839
1841
|
return _date;
|
|
1840
1842
|
}
|
|
1841
1843
|
|
|
1842
|
-
//
|
|
1844
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfMonth.mjs
|
|
1843
1845
|
function startOfMonth(date) {
|
|
1844
1846
|
const _date = toDate(date);
|
|
1845
1847
|
_date.setDate(1);
|
|
@@ -1847,7 +1849,7 @@
|
|
|
1847
1849
|
return _date;
|
|
1848
1850
|
}
|
|
1849
1851
|
|
|
1850
|
-
//
|
|
1852
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfYear.mjs
|
|
1851
1853
|
function startOfYear(date) {
|
|
1852
1854
|
const cleanDate = toDate(date);
|
|
1853
1855
|
const _date = constructFrom(date, 0);
|
|
@@ -1856,21 +1858,21 @@
|
|
|
1856
1858
|
return _date;
|
|
1857
1859
|
}
|
|
1858
1860
|
|
|
1859
|
-
//
|
|
1861
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfHour.mjs
|
|
1860
1862
|
function startOfHour(date) {
|
|
1861
1863
|
const _date = toDate(date);
|
|
1862
1864
|
_date.setMinutes(0, 0, 0);
|
|
1863
1865
|
return _date;
|
|
1864
1866
|
}
|
|
1865
1867
|
|
|
1866
|
-
//
|
|
1868
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/startOfSecond.mjs
|
|
1867
1869
|
function startOfSecond(date) {
|
|
1868
1870
|
const _date = toDate(date);
|
|
1869
1871
|
_date.setMilliseconds(0);
|
|
1870
1872
|
return _date;
|
|
1871
1873
|
}
|
|
1872
1874
|
|
|
1873
|
-
//
|
|
1875
|
+
// ../../../.cache/deno/deno_esbuild/date-fns@3.6.0/node_modules/date-fns/parseISO.mjs
|
|
1874
1876
|
function parseISO(argument, options) {
|
|
1875
1877
|
const additionalDigits = options?.additionalDigits ?? 2;
|
|
1876
1878
|
const dateStrings = splitDateString(argument);
|
|
@@ -2152,8 +2154,18 @@
|
|
|
2152
2154
|
};
|
|
2153
2155
|
var gcFee = (amount) => 0.2 + amount * 0.01;
|
|
2154
2156
|
function calcPaymentFee(feeable, country) {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
+
if (feeable.period === "annually" /* Annually */) {
|
|
2158
|
+
return 0;
|
|
2159
|
+
}
|
|
2160
|
+
switch (feeable.paymentMethod) {
|
|
2161
|
+
case "none" /* None */:
|
|
2162
|
+
case "manual" /* Manual */:
|
|
2163
|
+
return 0;
|
|
2164
|
+
case "gc_direct-debit" /* GoCardlessDirectDebit */:
|
|
2165
|
+
return gcFee(feeable.amount);
|
|
2166
|
+
default:
|
|
2167
|
+
return stripeFees[country][feeable.paymentMethod](feeable.amount);
|
|
2168
|
+
}
|
|
2157
2169
|
}
|
|
2158
2170
|
|
|
2159
2171
|
// src/utils/rules.ts
|