@riocrypto/common-server 1.0.1438 → 1.0.1442
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/build/clients/invopop-client.js +3 -3
- package/build/helpers/{calculate-weekly-volume-and-revenue.d.ts → calculate-volume-and-revenue.d.ts} +1 -1
- package/build/helpers/{calculate-weekly-volume-and-revenue.js → calculate-volume-and-revenue.js} +4 -4
- package/build/helpers/get-exchange-rates.js +9 -14
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ class InvopopClient {
|
|
|
23
23
|
this.baseUrl = "https://api.invopop.com";
|
|
24
24
|
}
|
|
25
25
|
createJob(order, user) {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
28
|
const uuid = (0, uuid_1.v1)();
|
|
29
29
|
const operationDate = new Date(order.createdAt);
|
|
@@ -55,7 +55,7 @@ class InvopopClient {
|
|
|
55
55
|
customerName = (_h = user.invoicing) === null || _h === void 0 ? void 0 : _h.MX.fiscalName.toLocaleUpperCase();
|
|
56
56
|
postalCode = (_l = (_k = (_j = user.onboarding) === null || _j === void 0 ? void 0 : _j.MX) === null || _k === void 0 ? void 0 : _k.address) === null || _l === void 0 ? void 0 : _l.postalCode;
|
|
57
57
|
rfc = (_o = (_m = user.onboarding) === null || _m === void 0 ? void 0 : _m.MX) === null || _o === void 0 ? void 0 : _o.taxId;
|
|
58
|
-
fiscalRegimenCode = (_p = user.invoicing) === null || _p === void 0 ? void 0 : _p.MX.fiscalRegimenCode;
|
|
58
|
+
fiscalRegimenCode = (_q = (_p = user.invoicing) === null || _p === void 0 ? void 0 : _p.MX.fiscalRegimenCode) === null || _q === void 0 ? void 0 : _q.toString();
|
|
59
59
|
cfdiUseCode = "G03";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -129,7 +129,7 @@ class InvopopClient {
|
|
|
129
129
|
item: {
|
|
130
130
|
name: "Facilitación de Compra-Venta de Activos Virtuales",
|
|
131
131
|
identities: [{ key: "mx-cfdi-prod-serv", code: "80151500" }],
|
|
132
|
-
price: (
|
|
132
|
+
price: (_r = order.actualFees.platformFeeFiat) === null || _r === void 0 ? void 0 : _r.toFixed(2),
|
|
133
133
|
},
|
|
134
134
|
taxes: [
|
|
135
135
|
{
|
package/build/helpers/{calculate-weekly-volume-and-revenue.d.ts → calculate-volume-and-revenue.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { User } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose } from "mongoose";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const calculateVolumeAndRevenue: (mongoose: Mongoose, daysAgo: number, user?: User) => Promise<{
|
|
4
4
|
volume: number;
|
|
5
5
|
revenue: number;
|
|
6
6
|
}>;
|
package/build/helpers/{calculate-weekly-volume-and-revenue.js → calculate-volume-and-revenue.js}
RENAMED
|
@@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.calculateVolumeAndRevenue = void 0;
|
|
13
13
|
const common_1 = require("@riocrypto/common");
|
|
14
14
|
const order_1 = require("../models/order");
|
|
15
|
-
const
|
|
15
|
+
const calculateVolumeAndRevenue = (mongoose, daysAgo, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
var _a;
|
|
17
17
|
const startDate = new Date();
|
|
18
|
-
startDate.setDate(startDate.getDate() -
|
|
18
|
+
startDate.setDate(startDate.getDate() - daysAgo);
|
|
19
19
|
startDate.setHours(12, 0, 0, 0);
|
|
20
20
|
const Order = (0, order_1.buildOrder)(mongoose);
|
|
21
21
|
let orders;
|
|
@@ -66,4 +66,4 @@ const calculateWeeklyVolumeAndRevenue = (mongoose, user) => __awaiter(void 0, vo
|
|
|
66
66
|
const revenueResult = revenue || 0;
|
|
67
67
|
return { volume: volumeResult, revenue: revenueResult };
|
|
68
68
|
});
|
|
69
|
-
exports.
|
|
69
|
+
exports.calculateVolumeAndRevenue = calculateVolumeAndRevenue;
|
|
@@ -48,15 +48,16 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
48
48
|
const mexicoCityTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Mexico_City" }));
|
|
49
49
|
const hours = mexicoCityTime.getHours();
|
|
50
50
|
const minutes = mexicoCityTime.getMinutes();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(hours ===
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
let isAfterHours = false;
|
|
52
|
+
if ((hours >= 8 && hours < 15) ||
|
|
53
|
+
(hours === 15 && minutes <= 45) ||
|
|
54
|
+
(hours >= 19 && hours <= 22)) {
|
|
55
|
+
isAfterHours = true;
|
|
56
|
+
}
|
|
57
|
+
if (mexicoCityTime.getDay() === 0 || mexicoCityTime.getDay() === 6) {
|
|
58
|
+
isAfterHours = true;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
if (isAfterHours) {
|
|
60
61
|
conversionRateToUSDWithMarkups =
|
|
61
62
|
conversionRateToUSD * (1 - afterHoursExchangeRateMarkup);
|
|
62
63
|
conversionRateFromUSDWithMarkups =
|
|
@@ -71,9 +72,3 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
71
72
|
};
|
|
72
73
|
});
|
|
73
74
|
exports.getExchangeRates = getExchangeRates;
|
|
74
|
-
// function getDateRange(): { startDate: Date; endDate: Date } {
|
|
75
|
-
// const endDate = new Date(); // Current time
|
|
76
|
-
// // Subtract 10 minutes from the end_date
|
|
77
|
-
// const startDate = new Date(endDate.getTime() - 10 * 60 * 1000);
|
|
78
|
-
// return { startDate, endDate };
|
|
79
|
-
// }
|
package/build/index.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export * from "./helpers/get-user-helper";
|
|
|
66
66
|
export * from "./helpers/get-processor-fees";
|
|
67
67
|
export * from "./helpers/get-network-fees";
|
|
68
68
|
export * from "./helpers/calculate-aggregate-volume-and-revenue";
|
|
69
|
-
export * from "./helpers/calculate-
|
|
69
|
+
export * from "./helpers/calculate-volume-and-revenue";
|
|
70
70
|
export * from "./helpers/get-exchange-rates";
|
|
71
71
|
export * from "./helpers/get-user";
|
|
72
72
|
export * from "./helpers/unescape";
|
package/build/index.js
CHANGED
|
@@ -82,7 +82,7 @@ __exportStar(require("./helpers/get-user-helper"), exports);
|
|
|
82
82
|
__exportStar(require("./helpers/get-processor-fees"), exports);
|
|
83
83
|
__exportStar(require("./helpers/get-network-fees"), exports);
|
|
84
84
|
__exportStar(require("./helpers/calculate-aggregate-volume-and-revenue"), exports);
|
|
85
|
-
__exportStar(require("./helpers/calculate-
|
|
85
|
+
__exportStar(require("./helpers/calculate-volume-and-revenue"), exports);
|
|
86
86
|
__exportStar(require("./helpers/get-exchange-rates"), exports);
|
|
87
87
|
__exportStar(require("./helpers/get-user"), exports);
|
|
88
88
|
__exportStar(require("./helpers/unescape"), exports);
|