@riocrypto/common-server 1.0.797 → 1.0.799

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/checked-address";
28
28
  export * from "./models/rio-settings";
29
29
  export * from "./models/partner-auth";
30
30
  export * from "./models/bank-account";
31
+ export * from "./models/quote";
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/checked-address"), exports);
44
44
  __exportStar(require("./models/rio-settings"), exports);
45
45
  __exportStar(require("./models/partner-auth"), exports);
46
46
  __exportStar(require("./models/bank-account"), exports);
47
+ __exportStar(require("./models/quote"), 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,57 @@
1
+ import { Country, Fees, Fiat, LiquidityProvider, PaymentMethod, PayoutMethod, Processor, Side, USState, Crypto } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface QuoteAttrs {
4
+ userId?: string;
5
+ crypto: Crypto;
6
+ side: Side;
7
+ fiat: Fiat;
8
+ paymentMethod?: PaymentMethod;
9
+ payoutMethod?: PayoutMethod;
10
+ expiresAt: Date;
11
+ country: Country;
12
+ state: USState | string;
13
+ cryptoAddress: string;
14
+ amountFiat?: number;
15
+ amountCrypto?: number;
16
+ liquidityProvider: LiquidityProvider;
17
+ processor: Processor;
18
+ fees: Fees;
19
+ price: number;
20
+ partnerId?: string;
21
+ depositAddress?: string;
22
+ brokerId?: string;
23
+ conversionRateUSD?: number;
24
+ conversionRateUSDWithMarkups?: number;
25
+ discount?: number;
26
+ markup?: number;
27
+ }
28
+ interface QuoteDoc extends Document {
29
+ userId?: string;
30
+ crypto: Crypto;
31
+ side: Side;
32
+ fiat: Fiat;
33
+ paymentMethod?: PaymentMethod;
34
+ payoutMethod?: PayoutMethod;
35
+ expiresAt: Date;
36
+ country: Country;
37
+ state: USState | string;
38
+ cryptoAddress: string;
39
+ amountFiat?: number;
40
+ amountCrypto?: number;
41
+ liquidityProvider: LiquidityProvider;
42
+ processor: Processor;
43
+ fees: Fees;
44
+ price: number;
45
+ partnerId?: string;
46
+ depositAddress?: string;
47
+ brokerId?: string;
48
+ conversionRateUSD?: number;
49
+ conversionRateUSDWithMarkups?: number;
50
+ discount?: number;
51
+ markup?: number;
52
+ }
53
+ interface QuoteModel extends Model<QuoteDoc> {
54
+ build(attrs: QuoteAttrs): QuoteDoc;
55
+ }
56
+ declare const buildQuote: (mongoose: Mongoose) => QuoteModel;
57
+ export { buildQuote, QuoteDoc };
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildQuote = void 0;
4
+ const buildQuote = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.Quote) {
7
+ return mongoose.model("Quote");
8
+ }
9
+ const quoteSchema = new mongoose.Schema({
10
+ userId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ status: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ crypto: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ side: {
23
+ type: String,
24
+ required: true,
25
+ },
26
+ fiat: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+ paymentMethod: {
31
+ type: String,
32
+ },
33
+ payoutMethod: {
34
+ type: String,
35
+ },
36
+ expiresAt: {
37
+ type: mongoose.Schema.Types.Date,
38
+ required: true,
39
+ },
40
+ cryptoAddress: {
41
+ type: String,
42
+ required: true,
43
+ },
44
+ country: {
45
+ type: String,
46
+ required: true,
47
+ },
48
+ state: {
49
+ type: String,
50
+ },
51
+ amountFiat: {
52
+ type: Number,
53
+ },
54
+ amountCrypto: {
55
+ type: Number,
56
+ },
57
+ processor: {
58
+ type: String,
59
+ required: true,
60
+ },
61
+ liquidityProvider: {
62
+ type: String,
63
+ required: true,
64
+ },
65
+ depositAddress: {
66
+ type: String,
67
+ },
68
+ fees: {
69
+ processingFeeFiat: {
70
+ type: Number,
71
+ },
72
+ transferFeeFiat: {
73
+ type: Number,
74
+ },
75
+ platformFeeFiat: {
76
+ type: Number,
77
+ },
78
+ partnerFeeFiat: {
79
+ type: Number,
80
+ },
81
+ platformFeeFiatTax: {
82
+ type: Number,
83
+ },
84
+ },
85
+ price: {
86
+ type: Number,
87
+ },
88
+ partnerId: {
89
+ type: String,
90
+ },
91
+ brokerId: {
92
+ type: String,
93
+ },
94
+ conversionRateUSD: {
95
+ type: Number,
96
+ },
97
+ conversionRateUSDWithMarkups: {
98
+ type: Number,
99
+ },
100
+ discount: {
101
+ type: Number,
102
+ },
103
+ markup: {
104
+ type: Number,
105
+ },
106
+ }, {
107
+ toJSON: {
108
+ transform(doc, ret) {
109
+ ret.id = ret._id.valueOf();
110
+ delete ret._id;
111
+ delete ret.__v;
112
+ },
113
+ },
114
+ });
115
+ quoteSchema.statics.build = (attrs) => {
116
+ return new Quote(attrs);
117
+ };
118
+ const Quote = mongoose.model("Quote", quoteSchema);
119
+ return Quote;
120
+ };
121
+ exports.buildQuote = buildQuote;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.797",
3
+ "version": "1.0.799",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",