@riocrypto/common-server 1.0.804 → 1.0.806

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.
@@ -1,6 +1,7 @@
1
- import { Country, Fees, Fiat, LiquidityProvider, OrderStatus, PaymentMethod, PayoutMethod, Processor, Side, USState, Crypto } from "@riocrypto/common";
1
+ import { Country, Fees, Fiat, LiquidityProvider, OrderStatus, PaymentMethod, PayoutMethod, Processor, Side, Crypto } from "@riocrypto/common";
2
2
  import { Mongoose, Model, Document } from "mongoose";
3
3
  interface OrderAttrs {
4
+ quoteId: string;
4
5
  userId: string;
5
6
  crypto: Crypto;
6
7
  side: Side;
@@ -11,27 +12,27 @@ interface OrderAttrs {
11
12
  status: OrderStatus;
12
13
  cryptoAddress: string;
13
14
  country: Country;
14
- state: USState | string;
15
+ state?: string;
15
16
  amountFiat?: number;
16
17
  amountCrypto?: number;
17
- liquidityProvider?: LiquidityProvider;
18
- processor?: Processor;
19
- fees?: Fees;
20
- price?: number;
18
+ liquidityProvider: LiquidityProvider;
19
+ processor: Processor;
20
+ fees: Fees;
21
+ price: number;
21
22
  partnerId?: string;
22
23
  depositAddress?: string;
23
24
  depositTxId?: string;
24
25
  withdrawalTxId?: string;
25
26
  brokerId?: string;
26
- conversionRateUSD?: number;
27
+ conversionRateUSD: number;
28
+ conversionRateUSDWithMarkups: number;
27
29
  actualConversionRateUSD?: number;
28
30
  notes?: string;
29
31
  discount?: number;
30
32
  markup?: number;
31
- invoiceUrl?: string;
32
- quoteId?: string;
33
33
  }
34
34
  interface OrderDoc extends Document {
35
+ quoteId: string;
35
36
  userId: string;
36
37
  status: OrderStatus;
37
38
  crypto: Crypto;
@@ -41,25 +42,25 @@ interface OrderDoc extends Document {
41
42
  payoutMethod?: PayoutMethod;
42
43
  createdAt: Date;
43
44
  country: Country;
44
- state: USState | string;
45
+ state?: string;
45
46
  cryptoAddress: string;
46
47
  amountFiat?: number;
47
48
  amountCrypto?: number;
48
- liquidityProvider?: LiquidityProvider;
49
- processor?: Processor;
50
- fees?: Fees;
51
- price?: number;
49
+ liquidityProvider: LiquidityProvider;
50
+ processor: Processor;
51
+ fees: Fees;
52
+ price: number;
52
53
  partnerId?: string;
53
54
  depositAddress?: string;
54
55
  depositTxId?: string;
55
56
  withdrawalTxId?: string;
56
57
  brokerId?: string;
57
- conversionRateUSD?: number;
58
+ conversionRateUSD: number;
59
+ conversionRateUSDWithMarkups: number;
58
60
  actualConversionRateUSD?: number;
59
61
  notes?: string;
60
62
  discount?: number;
61
63
  markup?: number;
62
- quoteId?: string;
63
64
  }
64
65
  interface OrderModel extends Model<OrderDoc> {
65
66
  build(attrs: OrderAttrs): OrderDoc;
@@ -7,6 +7,10 @@ const buildOrder = (mongoose) => {
7
7
  return mongoose.model("Order");
8
8
  }
9
9
  const orderSchema = new mongoose.Schema({
10
+ quoteId: {
11
+ type: Number,
12
+ required: true,
13
+ },
10
14
  userId: {
11
15
  type: String,
12
16
  required: true,
@@ -47,7 +51,6 @@ const buildOrder = (mongoose) => {
47
51
  },
48
52
  state: {
49
53
  type: String,
50
- required: true,
51
54
  },
52
55
  amountFiat: {
53
56
  type: Number,
@@ -57,9 +60,11 @@ const buildOrder = (mongoose) => {
57
60
  },
58
61
  processor: {
59
62
  type: String,
63
+ required: true,
60
64
  },
61
65
  liquidityProvider: {
62
66
  type: String,
67
+ required: true,
63
68
  },
64
69
  depositTxId: {
65
70
  type: String,
@@ -89,6 +94,7 @@ const buildOrder = (mongoose) => {
89
94
  },
90
95
  price: {
91
96
  type: Number,
97
+ required: true,
92
98
  },
93
99
  partnerId: {
94
100
  type: String,
@@ -98,9 +104,15 @@ const buildOrder = (mongoose) => {
98
104
  },
99
105
  conversionRateUSD: {
100
106
  type: Number,
107
+ required: true,
108
+ },
109
+ conversionRateUSDWithMarkups: {
110
+ type: Number,
111
+ required: true,
101
112
  },
102
113
  actualConversionRateUSD: {
103
114
  type: Number,
115
+ required: true,
104
116
  },
105
117
  notes: {
106
118
  type: String,
@@ -111,9 +123,6 @@ const buildOrder = (mongoose) => {
111
123
  markup: {
112
124
  type: Number,
113
125
  },
114
- quoteId: {
115
- type: Number,
116
- },
117
126
  }, {
118
127
  toJSON: {
119
128
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.804",
3
+ "version": "1.0.806",
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.696",
27
+ "@riocrypto/common": "^1.0.698",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",