@riocrypto/common-server 1.0.655 → 1.0.657

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/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from "./models/kyc";
28
28
  export * from "./models/checked-address";
29
29
  export * from "./models/rio-settings";
30
30
  export * from "./models/partner-auth";
31
+ export * from "./models/bank-account";
31
32
  export * from "./clients/bitstamp-client";
32
33
  export * from "./clients/ccxt-client";
33
34
  export * from "./clients/kushki-client";
package/build/index.js CHANGED
@@ -44,6 +44,7 @@ __exportStar(require("./models/kyc"), exports);
44
44
  __exportStar(require("./models/checked-address"), exports);
45
45
  __exportStar(require("./models/rio-settings"), exports);
46
46
  __exportStar(require("./models/partner-auth"), exports);
47
+ __exportStar(require("./models/bank-account"), exports);
47
48
  __exportStar(require("./clients/bitstamp-client"), exports);
48
49
  __exportStar(require("./clients/ccxt-client"), exports);
49
50
  __exportStar(require("./clients/kushki-client"), exports);
@@ -0,0 +1,23 @@
1
+ import { Country, Fiat } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface BankAccountAttrs {
4
+ userId: string;
5
+ country: Country;
6
+ fiat: Fiat;
7
+ accountNumber: string;
8
+ approved: boolean;
9
+ swiftCode?: string;
10
+ }
11
+ interface BankAccountDoc extends Document {
12
+ userId: string;
13
+ country: Country;
14
+ fiat: Fiat;
15
+ accountNumber: string;
16
+ approved: boolean;
17
+ swiftCode?: string;
18
+ }
19
+ interface BankPayoutModel extends Model<BankAccountDoc> {
20
+ build(attrs: BankAccountAttrs): BankAccountDoc;
21
+ }
22
+ declare const buildBankAccount: (mongoose: Mongoose) => BankPayoutModel;
23
+ export { buildBankAccount, BankAccountDoc };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBankAccount = void 0;
4
+ const buildBankAccount = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.BankPayout) {
7
+ return mongoose.model("BankPayout");
8
+ }
9
+ const BankAccountSchema = new mongoose.Schema({
10
+ userId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ country: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ fiat: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ accountNumber: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ swiftCode: {
27
+ type: String,
28
+ },
29
+ approved: {
30
+ type: Boolean,
31
+ required: true,
32
+ },
33
+ }, {
34
+ toJSON: {
35
+ transform(doc, ret) {
36
+ ret.id = ret._id.valueOf();
37
+ delete ret._id;
38
+ delete ret.__v;
39
+ },
40
+ },
41
+ });
42
+ BankAccountSchema.statics.build = (attrs) => {
43
+ return new BankPayout(attrs);
44
+ };
45
+ const BankPayout = mongoose.model("BankAccount", BankAccountSchema);
46
+ return BankPayout;
47
+ };
48
+ exports.buildBankAccount = buildBankAccount;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.655",
3
+ "version": "1.0.657",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@aws-sdk/client-s3": "^3.297.0",
25
25
  "@everapi/currencyapi-js": "^1.0.6",
26
26
  "@google-cloud/storage": "^6.9.5",
27
- "@riocrypto/common": "^1.0.597",
27
+ "@riocrypto/common": "^1.0.599",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",