@riocrypto/common-server 1.0.2118 → 1.0.2120

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.
@@ -10,7 +10,8 @@ declare class BitsoClient {
10
10
  createClabe(): Promise<string>;
11
11
  createReceivingAccount(user: User, bankAccount: BankAccount): Promise<string>;
12
12
  deleteReceivingAccount(bitsoReceivingAccountId: string): Promise<string>;
13
- createWithdraw(bitsoReceivingAccountId: string, amount: number, concept: string, idempotencyKey?: string, rfc?: string): Promise<Object>;
13
+ createMXNSPEIWithdraw(bitsoReceivingAccountId: string, amount: number, concept: string, idempotencyKey?: string): Promise<Object>;
14
+ createMXNBTWithdraw(bitsoReceivingAccountId: string, amount: number, concept: string, idempotencyKey?: string): Promise<Object>;
14
15
  getWithdrawal(withdrawalId: string): Promise<any>;
15
16
  createLimitOrder(asset: string, amount: number, price: number, side: "buy" | "sell"): Promise<{
16
17
  oid: string;
@@ -98,7 +98,7 @@ class BitsoClient {
98
98
  return data.payload;
99
99
  });
100
100
  }
101
- createWithdraw(bitsoReceivingAccountId, amount, concept, idempotencyKey, rfc) {
101
+ createMXNSPEIWithdraw(bitsoReceivingAccountId, amount, concept, idempotencyKey) {
102
102
  return __awaiter(this, void 0, void 0, function* () {
103
103
  if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
104
104
  throw new Error("Bitso withdraw not allowed in sandbox");
@@ -129,6 +129,37 @@ class BitsoClient {
129
129
  return data.payload;
130
130
  });
131
131
  }
132
+ createMXNBTWithdraw(bitsoReceivingAccountId, amount, concept, idempotencyKey) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ if ([common_1.RioEnv.Sandbox, common_1.RioEnv.Local, common_1.RioEnv.Test].includes(process.env.RIO_ENV)) {
135
+ throw new Error("Bitso withdraw not allowed in sandbox");
136
+ }
137
+ const requestConfig = {
138
+ method: "POST",
139
+ url: `${this.baseUrl}/api/v3/withdrawals`,
140
+ headers: {
141
+ "Content-Type": "application/json",
142
+ },
143
+ data: {
144
+ amount: amount.toFixed(2),
145
+ contact_id: bitsoReceivingAccountId,
146
+ notes_ref: concept,
147
+ protocol: "bt",
148
+ network: "spei",
149
+ method: "praxis",
150
+ currency: "mxn",
151
+ asset: "mxn",
152
+ origin_id: idempotencyKey,
153
+ },
154
+ };
155
+ const signedRequestConfig = this.signRequest(requestConfig);
156
+ const { data } = yield this.axiosClient(signedRequestConfig);
157
+ if (!data.success) {
158
+ throw new Error("Error creating Bitso withdraw");
159
+ }
160
+ return data.payload;
161
+ });
162
+ }
132
163
  getWithdrawal(withdrawalId) {
133
164
  return __awaiter(this, void 0, void 0, function* () {
134
165
  const requestConfig = {
@@ -7,7 +7,7 @@ interface CEPAttrs {
7
7
  senderCLABE: string;
8
8
  receiverCLABE: string;
9
9
  amount: number;
10
- sentAt: Date;
10
+ sentAt: string;
11
11
  status: CEPStatus;
12
12
  link?: string;
13
13
  failedAttempts: number;
@@ -19,7 +19,7 @@ interface CEPDoc extends Document {
19
19
  senderCLABE: string;
20
20
  receiverCLABE: string;
21
21
  amount: number;
22
- sentAt: Date;
22
+ sentAt: string;
23
23
  status: CEPStatus;
24
24
  link?: string;
25
25
  failedAttempts: number;
@@ -28,7 +28,7 @@ const buildCEP = (mongoose) => {
28
28
  required: true,
29
29
  },
30
30
  sentAt: {
31
- type: mongoose.Schema.Types.Date,
31
+ type: String,
32
32
  required: true,
33
33
  },
34
34
  status: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2118",
3
+ "version": "1.0.2120",
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.1893",
31
+ "@riocrypto/common": "^1.0.1895",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",