@riocrypto/common-server 1.0.790 → 1.0.791

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.
@@ -1,6 +1,6 @@
1
1
  import { Country, Fiat, Processor, User } from "@riocrypto/common";
2
2
  import { Mongoose } from "mongoose";
3
- export declare const getPlatformAndPartnerFees: (mongoose: Mongoose, amountFiat: number, fiat: Fiat, processor: Processor, country: Country, partnerId?: string, brokerId?: string, user?: User, markup?: number, discount?: number) => Promise<{
3
+ export declare const getPlatformAndPartnerFees: (mongoose: Mongoose, conversionRateToUSD: number, amountFiat: number, fiat: Fiat, processor: Processor, country: Country, partnerId?: string, brokerId?: string, user?: User, markup?: number, discount?: number) => Promise<{
4
4
  platformFeeFiat: number;
5
5
  platformFeeFiatTax: number;
6
6
  partnerFeeFiat: number;
@@ -12,19 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getPlatformAndPartnerFees = void 0;
13
13
  const rio_settings_1 = require("../models/rio-settings");
14
14
  const common_1 = require("@riocrypto/common");
15
- const kapstar_client_1 = require("../clients/kapstar-client");
16
- const currency_api_client_1 = require("../clients/currency-api-client");
17
15
  const partner_1 = require("../models/partner");
18
16
  const user_1 = require("../models/user");
19
17
  const calculate_aggregate_volume_1 = require("./calculate-aggregate-volume");
20
- const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, country, partnerId, brokerId, user, markup, discount) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const getPlatformAndPartnerFees = (mongoose, conversionRateToUSD, amountFiat, fiat, processor, country, partnerId, brokerId, user, markup, discount) => __awaiter(void 0, void 0, void 0, function* () {
21
19
  var _a, _b;
22
20
  let platformFeeFiat;
23
21
  let platformFeeFiatTax = 0;
24
22
  let partnerFeeFiat = 0;
25
23
  let feesComped = false;
26
24
  let amountUSD;
27
- let conversionRateToUSD = 0;
28
25
  const RioSettings = (0, rio_settings_1.buildRioSettings)(mongoose);
29
26
  const rioSettings = yield RioSettings.findOne();
30
27
  if (!rioSettings) {
@@ -33,17 +30,6 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
33
30
  if (discount && markup) {
34
31
  throw new Error("Cannot specify markup and discount");
35
32
  }
36
- if (processor === common_1.Processor.Kapstar) {
37
- const kapstarClient = yield (0, kapstar_client_1.buildKapstarClient)();
38
- conversionRateToUSD = yield kapstarClient.getBRLExchangeRateUSD();
39
- }
40
- else if (fiat !== common_1.Fiat.USD) {
41
- const currencyAPIClient = yield (0, currency_api_client_1.buildCurrencyAPIClient)();
42
- conversionRateToUSD = yield currencyAPIClient.convert(fiat, common_1.Fiat.USD);
43
- }
44
- else if (fiat === common_1.Fiat.USD) {
45
- conversionRateToUSD = 1;
46
- }
47
33
  amountUSD = amountFiat * conversionRateToUSD;
48
34
  if (!amountUSD) {
49
35
  throw new Error("Could not convert amount to USD");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.790",
3
+ "version": "1.0.791",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",