@riocrypto/common-server 1.0.1238 → 1.0.1240

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.
@@ -9,6 +9,7 @@ declare class BitsoClient {
9
9
  createClabe(): Promise<string>;
10
10
  createReceivingAccount(user: User, bankAccount: BankAccount, bitsoBankAccountCode: string): Promise<string>;
11
11
  createWithdraw(bitsoReceivingAccountId: string, amount: number, concept: string, rfc?: string): Promise<string>;
12
+ getWithdrawal(withdrawalId: string): Promise<any>;
12
13
  createLimitOrder(asset: string, amount: number, price: number, side: "buy" | "sell"): Promise<{
13
14
  oid: string;
14
15
  }>;
@@ -104,6 +104,23 @@ class BitsoClient {
104
104
  return data.payload;
105
105
  });
106
106
  }
107
+ getWithdrawal(withdrawalId) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ const requestConfig = {
110
+ method: "GET",
111
+ url: `${this.baseUrl}/api/v3/withdrawals/${withdrawalId}`,
112
+ headers: {
113
+ "Content-Type": "application/json",
114
+ },
115
+ };
116
+ const signedRequestConfig = this.signRequest(requestConfig);
117
+ const { data } = yield (0, axios_1.default)(signedRequestConfig);
118
+ if (!data.success || !data.payload.length) {
119
+ throw new Error("Error getting Bitso order");
120
+ }
121
+ return data.payload[0];
122
+ });
123
+ }
107
124
  createLimitOrder(asset, amount, price, side) {
108
125
  return __awaiter(this, void 0, void 0, function* () {
109
126
  const major = amount / price;
@@ -4,13 +4,21 @@ interface BankPayoutAttrs {
4
4
  orderId: string;
5
5
  bankAccountId: string;
6
6
  originBank: Processor;
7
- status: string;
7
+ status: "created" | "processing" | "complete" | "failed" | "cancelled";
8
+ transferDetails?: {
9
+ speiTrackingNumber?: string;
10
+ reference?: string;
11
+ };
8
12
  }
9
13
  interface BankPayoutDoc extends Document {
10
14
  orderId: string;
11
15
  bankAccountId: string;
12
16
  originBank: Processor;
13
- status: string;
17
+ status: "created" | "processing" | "complete" | "failed" | "cancelled";
18
+ transferDetails?: {
19
+ speiTrackingNumber?: string;
20
+ reference?: string;
21
+ };
14
22
  }
15
23
  interface BankPayoutModel extends Model<BankPayoutDoc> {
16
24
  build(attrs: BankPayoutAttrs): BankPayoutDoc;
@@ -23,6 +23,14 @@ const buildBankPayout = (mongoose) => {
23
23
  type: String,
24
24
  required: true,
25
25
  },
26
+ transferDetails: {
27
+ speiTrackingNumber: {
28
+ type: String,
29
+ },
30
+ reference: {
31
+ type: String,
32
+ },
33
+ },
26
34
  }, {
27
35
  toJSON: {
28
36
  transform(doc, ret) {
@@ -2,12 +2,12 @@ import mongoose from "mongoose";
2
2
  interface BitsoReceivingAccountAttrs {
3
3
  userId: string;
4
4
  bankAccountId: string;
5
- BitsoReceivingAccountId: string;
5
+ bitsoReceivingAccountId: string;
6
6
  }
7
7
  interface BitsoReceivingAccountDoc extends mongoose.Document {
8
8
  userId: string;
9
9
  bankAccountId: string;
10
- BitsoReceivingAccountId: string;
10
+ bitsoReceivingAccountId: string;
11
11
  }
12
12
  interface BitsoReceivingAccountModel extends mongoose.Model<BitsoReceivingAccountDoc> {
13
13
  build(attrs: BitsoReceivingAccountAttrs): BitsoReceivingAccountDoc;
@@ -15,7 +15,7 @@ const buildBitsoReceivingAccount = (mongoose) => {
15
15
  type: String,
16
16
  required: true,
17
17
  },
18
- BitsoReceivingAccountId: {
18
+ bitsoReceivingAccountId: {
19
19
  type: String,
20
20
  required: true,
21
21
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1238",
3
+ "version": "1.0.1240",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "@everapi/currencyapi-js": "^1.0.6",
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
- "@riocrypto/common": "^1.0.1123",
30
+ "@riocrypto/common": "^1.0.1124",
31
31
  "@types/express": "^4.17.13",
32
32
  "axios": "^0.27.2",
33
33
  "ccxt": "^3.0.30",