@riocrypto/common-server 1.0.2221 → 1.0.2226

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.
@@ -6,7 +6,8 @@ const getTaxRate = (user, country, fiat, processor) => {
6
6
  var _a, _b, _c, _d;
7
7
  let taxRate = 0;
8
8
  if ((fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI) ||
9
- (fiat === common_1.Fiat.MXN && processor === common_1.Processor.Bitso) ||
9
+ (fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI_NVIO) ||
10
+ (fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI_STP) ||
10
11
  (fiat === common_1.Fiat.USD && processor === common_1.Processor.SPID)) {
11
12
  if (country === common_1.Country.Mexico &&
12
13
  ((_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) {
package/build/index.d.ts CHANGED
@@ -85,6 +85,7 @@ export * from "./models/external-trade";
85
85
  export * from "./models/external-trading-algorithm";
86
86
  export * from "./models/auth-dashboard-settings";
87
87
  export * from "./models/admin-auth-dashboard-settings";
88
+ export * from "./models/STP-mxn-withdrawal";
88
89
  export * from "./clients/axios-with-logging";
89
90
  export * from "./clients/slack-client";
90
91
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -101,6 +101,7 @@ __exportStar(require("./models/external-trade"), exports);
101
101
  __exportStar(require("./models/external-trading-algorithm"), exports);
102
102
  __exportStar(require("./models/auth-dashboard-settings"), exports);
103
103
  __exportStar(require("./models/admin-auth-dashboard-settings"), exports);
104
+ __exportStar(require("./models/STP-mxn-withdrawal"), exports);
104
105
  __exportStar(require("./clients/axios-with-logging"), exports);
105
106
  __exportStar(require("./clients/slack-client"), exports);
106
107
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -22,11 +22,6 @@ const secret_manager_client_1 = require("../clients/secret-manager-client");
22
22
  const admin_auth_1 = require("../models/admin-auth");
23
23
  const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
24
24
  var _a, _b;
25
- // Early return for public routes
26
- if (authorizationTypes.includes(common_1.AuthorizationType.Public)) {
27
- next();
28
- return;
29
- }
30
25
  // Prepare promises for parallel execution
31
26
  const promises = [];
32
27
  // Check for cluster API key - only if needed
@@ -165,8 +160,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
165
160
  // Wait for all promises to complete
166
161
  yield Promise.all(promises);
167
162
  // Check authorization results and proceed if authorized
168
- if ((authorizationTypes.includes(common_1.AuthorizationType.Cluster) &&
169
- req.validClusterApiKey) ||
163
+ if (authorizationTypes.includes(common_1.AuthorizationType.Public) ||
164
+ (authorizationTypes.includes(common_1.AuthorizationType.Cluster) &&
165
+ req.validClusterApiKey) ||
170
166
  (authorizationTypes.includes(common_1.AuthorizationType.GenesisAdmin) &&
171
167
  req.validGenisisAdminKey) ||
172
168
  (authorizationTypes.includes(common_1.AuthorizationType.Auth) && req.auth) ||
@@ -37,7 +37,8 @@ const getOrder = (req, res, next, mongoose, onlyBankOrders) => __awaiter(void 0,
37
37
  common_1.Processor.SPEI,
38
38
  common_1.Processor.SWIFT,
39
39
  common_1.Processor.SPID,
40
- common_1.Processor.Bitso,
40
+ common_1.Processor.SPEI_NVIO,
41
+ common_1.Processor.SPEI_STP,
41
42
  ].includes(order.processor)) {
42
43
  req.order = order;
43
44
  }
@@ -0,0 +1,34 @@
1
+ import { Mongoose, Model, Document } from "mongoose";
2
+ interface STPMXNWithdrawalAttrs {
3
+ createdAt: Date;
4
+ type: "transaction" | "bankAccountVerification" | "liquidityOrder";
5
+ orderId?: string;
6
+ numberOfParts?: number;
7
+ partsCompleted?: number;
8
+ bankAccountVerificationId?: string;
9
+ multipartLiquidityOrderId?: string;
10
+ STPWithdrawals: {
11
+ id: string;
12
+ status: "processing" | "complete" | "failed";
13
+ }[];
14
+ orderVersion?: number;
15
+ }
16
+ interface STPMXNWithdrawalDoc extends Document {
17
+ createdAt: Date;
18
+ type: "transaction" | "bankAccountVerification" | "liquidityOrder";
19
+ orderId?: string;
20
+ bankAccountVerificationId?: string;
21
+ multipartLiquidityOrderId?: string;
22
+ numberOfParts?: number;
23
+ partsCompleted?: number;
24
+ orderVersion?: number;
25
+ STPWithdrawals: {
26
+ id: string;
27
+ status: "processing" | "complete" | "failed";
28
+ }[];
29
+ }
30
+ interface STPMXNWithdrawalModel extends Model<STPMXNWithdrawalDoc> {
31
+ build(attrs: STPMXNWithdrawalAttrs): STPMXNWithdrawalDoc;
32
+ }
33
+ declare const buildSTPMXNWithdrawal: (mongoose: Mongoose) => STPMXNWithdrawalModel;
34
+ export { buildSTPMXNWithdrawal, STPMXNWithdrawalDoc, STPMXNWithdrawalAttrs };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildSTPMXNWithdrawal = void 0;
4
+ const buildSTPMXNWithdrawal = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.STPMXNWithdrawal) {
7
+ return mongoose.model("STPMXNWithdrawal");
8
+ }
9
+ const STPMXNWithdrawalSchema = new mongoose.Schema({
10
+ orderId: {
11
+ type: String,
12
+ },
13
+ bankAccountVerificationId: {
14
+ type: String,
15
+ },
16
+ multipartLiquidityOrderId: {
17
+ type: String,
18
+ },
19
+ numberOfParts: {
20
+ type: Number,
21
+ },
22
+ partsCompleted: {
23
+ type: Number,
24
+ },
25
+ type: {
26
+ type: String,
27
+ required: true,
28
+ },
29
+ createdAt: {
30
+ type: mongoose.Schema.Types.Date,
31
+ required: true,
32
+ },
33
+ STPWithdrawals: {
34
+ type: [
35
+ {
36
+ id: String,
37
+ status: String,
38
+ },
39
+ ],
40
+ },
41
+ orderVersion: {
42
+ type: Number,
43
+ },
44
+ }, {
45
+ toJSON: {
46
+ transform(doc, ret) {
47
+ ret.id = ret._id.valueOf();
48
+ delete ret._id;
49
+ delete ret.__v;
50
+ },
51
+ },
52
+ });
53
+ STPMXNWithdrawalSchema.statics.build = (attrs) => {
54
+ return new STPMXNWithdrawal(attrs);
55
+ };
56
+ const STPMXNWithdrawal = mongoose.model("STPMXNWithdrawal", STPMXNWithdrawalSchema);
57
+ return STPMXNWithdrawal;
58
+ };
59
+ exports.buildSTPMXNWithdrawal = buildSTPMXNWithdrawal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2221",
3
+ "version": "1.0.2226",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.1951",
31
+ "@riocrypto/common": "^1.0.1957",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",