@riocrypto/common-server 1.0.1594 → 1.0.1596

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.
@@ -22,19 +22,14 @@ const getProcessorFees = (processor, amountFiat, conversionRateFromUSD, side, fi
22
22
  return amountFiat * 0.006;
23
23
  }
24
24
  else if (processor === common_1.Processor.Interbank) {
25
- if (side === common_1.Side.Buy) {
26
- return amountFiat * 0.005;
25
+ let baseFee = amountFiat * 0.0025;
26
+ if (fiat === common_1.Fiat.USD && side === common_1.Side.Buy) {
27
+ baseFee += 1.16;
27
28
  }
28
- else {
29
- let baseFee = amountFiat * 0.005;
30
- if (fiat === common_1.Fiat.PEN) {
31
- baseFee += 4.47;
32
- }
33
- else if (fiat === common_1.Fiat.USD) {
34
- baseFee += 1.16 * conversionRateFromUSD;
35
- }
36
- return baseFee;
29
+ else if (fiat === common_1.Fiat.PEN) {
30
+ baseFee += 20;
37
31
  }
32
+ return baseFee;
38
33
  }
39
34
  else if (processor === common_1.Processor.SWIFT) {
40
35
  return 25 * conversionRateFromUSD;
@@ -0,0 +1,2 @@
1
+ import { Country, Fiat, Processor, User } from "@riocrypto/common";
2
+ export declare const getTaxRate: (user: User, country: Country, fiat: Fiat, processor: Processor) => number;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTaxRate = void 0;
4
+ const common_1 = require("@riocrypto/common");
5
+ const getTaxRate = (user, country, fiat, processor) => {
6
+ var _a, _b, _c, _d;
7
+ let taxRate = 0;
8
+ if ((fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI) ||
9
+ (fiat === common_1.Fiat.MXN && processor === common_1.Processor.Bitso) ||
10
+ (fiat === common_1.Fiat.USD && processor === common_1.Processor.SPID)) {
11
+ if (country === common_1.Country.Mexico &&
12
+ ((_b = (_a = user === null || user === void 0 ? void 0 : user.onboarding[country]) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.country) === common_1.CountryOfOrigin.Mexico) {
13
+ taxRate = 0.16;
14
+ }
15
+ }
16
+ if (fiat === common_1.Fiat.PEN && processor === common_1.Processor.Interbank) {
17
+ if (((_d = (_c = user === null || user === void 0 ? void 0 : user.onboarding[country]) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d.country) === common_1.CountryOfOrigin.Peru) {
18
+ taxRate = 0.18;
19
+ }
20
+ }
21
+ return taxRate;
22
+ };
23
+ exports.getTaxRate = getTaxRate;
package/build/index.d.ts CHANGED
@@ -89,3 +89,4 @@ export * from "./helpers/sanitize-order-doc";
89
89
  export * from "./helpers/sanitize-chained-order-doc";
90
90
  export * from "./helpers/get-polygon-exchange-rates";
91
91
  export * from "./helpers/get-currency-api-exchange-rates";
92
+ export * from "./helpers/get-tax-rate";
package/build/index.js CHANGED
@@ -105,3 +105,4 @@ __exportStar(require("./helpers/sanitize-order-doc"), exports);
105
105
  __exportStar(require("./helpers/sanitize-chained-order-doc"), exports);
106
106
  __exportStar(require("./helpers/get-polygon-exchange-rates"), exports);
107
107
  __exportStar(require("./helpers/get-currency-api-exchange-rates"), exports);
108
+ __exportStar(require("./helpers/get-tax-rate"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1594",
3
+ "version": "1.0.1596",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
30
  "@hyperdx/node-opentelemetry": "^0.4.2",
31
- "@riocrypto/common": "^1.0.1426",
31
+ "@riocrypto/common": "^1.0.1433",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.6.0",
34
34
  "ccxt": "^3.0.30",