@riocrypto/common-server 1.0.2832 → 1.0.2833

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
@@ -89,7 +89,7 @@ export * from "./models/STP-deposit-CLABE";
89
89
  export * from "./models/STP-settings";
90
90
  export * from "./models/alfin-virtual-cci";
91
91
  export * from "./models/alfin-settings";
92
- export * from "./models/alfin-pen-withdrawal";
92
+ export * from "./models/alfin-withdrawal";
93
93
  export * from "./models/dashboard-push-notification-subscription";
94
94
  export * from "./models/webauthn-credential";
95
95
  export * from "./models/admin-webauthn-credential";
package/build/index.js CHANGED
@@ -105,7 +105,7 @@ __exportStar(require("./models/STP-deposit-CLABE"), exports);
105
105
  __exportStar(require("./models/STP-settings"), exports);
106
106
  __exportStar(require("./models/alfin-virtual-cci"), exports);
107
107
  __exportStar(require("./models/alfin-settings"), exports);
108
- __exportStar(require("./models/alfin-pen-withdrawal"), exports);
108
+ __exportStar(require("./models/alfin-withdrawal"), exports);
109
109
  __exportStar(require("./models/dashboard-push-notification-subscription"), exports);
110
110
  __exportStar(require("./models/webauthn-credential"), exports);
111
111
  __exportStar(require("./models/admin-webauthn-credential"), exports);
@@ -3,11 +3,15 @@ interface AlfinSettingsAttrs {
3
3
  payinCodeOffset: number;
4
4
  treasuryCCIV?: string;
5
5
  treasuryCodigoPagoCCIV?: string;
6
+ treasuryCCIVUSD?: string;
7
+ treasuryCodigoPagoCCIVUSD?: string;
6
8
  }
7
9
  interface AlfinSettingsDoc extends mongoose.Document {
8
10
  payinCodeOffset: number;
9
11
  treasuryCCIV?: string;
10
12
  treasuryCodigoPagoCCIV?: string;
13
+ treasuryCCIVUSD?: string;
14
+ treasuryCodigoPagoCCIVUSD?: string;
11
15
  }
12
16
  interface AlfinSettingsModel extends mongoose.Model<AlfinSettingsDoc> {
13
17
  build(attrs: AlfinSettingsAttrs): HydratedDocument<AlfinSettingsDoc>;
@@ -16,6 +16,12 @@ const buildAlfinSettings = (mongoose) => {
16
16
  treasuryCodigoPagoCCIV: {
17
17
  type: String,
18
18
  },
19
+ treasuryCCIVUSD: {
20
+ type: String,
21
+ },
22
+ treasuryCodigoPagoCCIVUSD: {
23
+ type: String,
24
+ },
19
25
  }, {
20
26
  toJSON: {
21
27
  transform(doc, ret) {
@@ -1,3 +1,4 @@
1
+ import { Fiat } from "@riocrypto/common";
1
2
  import { Mongoose, Model, Document, HydratedDocument } from "mongoose";
2
3
  type AlfinVirtualCciType = "UNICO" | "RECURRENTE";
3
4
  type AlfinVirtualCciStatus = "ACTIVO" | "BAJA" | "VENCIDO";
@@ -5,6 +6,7 @@ interface AlfinVirtualCciAttrs {
5
6
  CCI: string;
6
7
  CCIV: string;
7
8
  codigoPagoCCIV?: string;
9
+ fiat: Fiat;
8
10
  userId: string;
9
11
  type: AlfinVirtualCciType;
10
12
  status?: AlfinVirtualCciStatus;
@@ -13,6 +15,7 @@ interface AlfinVirtualCciDoc extends Document {
13
15
  CCI: string;
14
16
  CCIV: string;
15
17
  codigoPagoCCIV?: string;
18
+ fiat: Fiat;
16
19
  userId: string;
17
20
  type: AlfinVirtualCciType;
18
21
  status: AlfinVirtualCciStatus;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildAlfinVirtualCci = void 0;
4
+ const common_1 = require("@riocrypto/common");
4
5
  // Maps each virtual CCI (CCIV) we generate to the user it was issued to, so an
5
6
  // inbound payin notification can be resolved to a single user and matched only
6
7
  // against that user's orders / bulk payments.
@@ -22,6 +23,12 @@ const buildAlfinVirtualCci = (mongoose) => {
22
23
  type: String,
23
24
  index: true,
24
25
  },
26
+ fiat: {
27
+ type: String,
28
+ enum: Object.values(common_1.Fiat),
29
+ required: true,
30
+ default: common_1.Fiat.PEN,
31
+ },
25
32
  userId: {
26
33
  type: String,
27
34
  required: true,
@@ -47,6 +54,8 @@ const buildAlfinVirtualCci = (mongoose) => {
47
54
  },
48
55
  },
49
56
  });
57
+ // A user holds at most one virtual CCI per currency.
58
+ AlfinVirtualCciSchema.index({ userId: 1, fiat: 1 });
50
59
  AlfinVirtualCciSchema.statics.build = (attrs) => {
51
60
  return new AlfinVirtualCci(attrs);
52
61
  };
@@ -1,41 +1,43 @@
1
- import { AlfinPENWithdrawalStatus } from "@riocrypto/common";
1
+ import { AlfinWithdrawalStatus, Fiat } from "@riocrypto/common";
2
2
  import { Mongoose, Model, Document, HydratedDocument } from "mongoose";
3
- interface AlfinPENWithdrawalPart {
3
+ interface AlfinWithdrawalPart {
4
4
  uuid: string;
5
5
  partNumber: number;
6
6
  amount: number;
7
7
  reference: string;
8
- status: AlfinPENWithdrawalStatus;
8
+ status: AlfinWithdrawalStatus;
9
9
  cciBeneficiario?: string;
10
10
  beneficiaryName?: string;
11
11
  transferenciaId?: string;
12
12
  mpe001IDL?: number;
13
13
  movimientoUId?: number;
14
14
  }
15
- interface AlfinPENWithdrawalAttrs {
15
+ interface AlfinWithdrawalAttrs {
16
16
  createdAt: Date;
17
17
  type: "transaction" | "internalTransfer";
18
+ fiat?: Fiat;
18
19
  orderId?: string;
19
20
  bulkBankPayoutId?: string;
20
21
  internalTransferId?: string;
21
22
  numberOfParts?: number;
22
23
  partsCompleted?: number;
23
24
  orderVersion?: number;
24
- AlfinWithdrawals: AlfinPENWithdrawalPart[];
25
+ AlfinWithdrawals: AlfinWithdrawalPart[];
25
26
  }
26
- interface AlfinPENWithdrawalDoc extends Document {
27
+ interface AlfinWithdrawalDoc extends Document {
27
28
  createdAt: Date;
28
29
  type: "transaction" | "internalTransfer";
30
+ fiat?: Fiat;
29
31
  orderId?: string;
30
32
  bulkBankPayoutId?: string;
31
33
  internalTransferId?: string;
32
34
  numberOfParts?: number;
33
35
  partsCompleted?: number;
34
36
  orderVersion?: number;
35
- AlfinWithdrawals: AlfinPENWithdrawalPart[];
37
+ AlfinWithdrawals: AlfinWithdrawalPart[];
36
38
  }
37
- interface AlfinPENWithdrawalModel extends Model<AlfinPENWithdrawalDoc> {
38
- build(attrs: AlfinPENWithdrawalAttrs): HydratedDocument<AlfinPENWithdrawalDoc>;
39
+ interface AlfinWithdrawalModel extends Model<AlfinWithdrawalDoc> {
40
+ build(attrs: AlfinWithdrawalAttrs): HydratedDocument<AlfinWithdrawalDoc>;
39
41
  }
40
- declare const buildAlfinPENWithdrawal: (mongoose: Mongoose) => AlfinPENWithdrawalModel;
41
- export { buildAlfinPENWithdrawal, AlfinPENWithdrawalDoc, AlfinPENWithdrawalAttrs, AlfinPENWithdrawalPart, };
42
+ declare const buildAlfinWithdrawal: (mongoose: Mongoose) => AlfinWithdrawalModel;
43
+ export { buildAlfinWithdrawal, AlfinWithdrawalDoc, AlfinWithdrawalAttrs, AlfinWithdrawalPart, };
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildAlfinPENWithdrawal = void 0;
3
+ exports.buildAlfinWithdrawal = void 0;
4
4
  const common_1 = require("@riocrypto/common");
5
- const buildAlfinPENWithdrawal = (mongoose) => {
6
- if (mongoose.models.AlfinPENWithdrawal) {
7
- return mongoose.model("AlfinPENWithdrawal");
5
+ const buildAlfinWithdrawal = (mongoose) => {
6
+ if (mongoose.models.AlfinWithdrawal) {
7
+ return mongoose.model("AlfinWithdrawal");
8
8
  }
9
- const AlfinPENWithdrawalSchema = new mongoose.Schema({
9
+ const AlfinWithdrawalSchema = new mongoose.Schema({
10
10
  orderId: {
11
11
  type: String,
12
12
  },
@@ -26,6 +26,11 @@ const buildAlfinPENWithdrawal = (mongoose) => {
26
26
  type: String,
27
27
  required: true,
28
28
  },
29
+ fiat: {
30
+ type: String,
31
+ enum: Object.values(common_1.Fiat),
32
+ default: common_1.Fiat.PEN,
33
+ },
29
34
  createdAt: {
30
35
  type: mongoose.Schema.Types.Date,
31
36
  required: true,
@@ -37,7 +42,7 @@ const buildAlfinPENWithdrawal = (mongoose) => {
37
42
  amount: Number,
38
43
  status: {
39
44
  type: String,
40
- enum: Object.values(common_1.AlfinPENWithdrawalStatus),
45
+ enum: Object.values(common_1.AlfinWithdrawalStatus),
41
46
  },
42
47
  partNumber: Number,
43
48
  reference: String,
@@ -70,10 +75,10 @@ const buildAlfinPENWithdrawal = (mongoose) => {
70
75
  },
71
76
  },
72
77
  });
73
- AlfinPENWithdrawalSchema.statics.build = (attrs) => {
74
- return new AlfinPENWithdrawal(attrs);
78
+ AlfinWithdrawalSchema.statics.build = (attrs) => {
79
+ return new AlfinWithdrawal(attrs);
75
80
  };
76
- const AlfinPENWithdrawal = mongoose.model("AlfinPENWithdrawal", AlfinPENWithdrawalSchema);
77
- return AlfinPENWithdrawal;
81
+ const AlfinWithdrawal = mongoose.model("AlfinWithdrawal", AlfinWithdrawalSchema);
82
+ return AlfinWithdrawal;
78
83
  };
79
- exports.buildAlfinPENWithdrawal = buildAlfinPENWithdrawal;
84
+ exports.buildAlfinWithdrawal = buildAlfinWithdrawal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2832",
3
+ "version": "1.0.2833",
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.6.0",
29
29
  "@google-cloud/storage": "^7.19.0",
30
30
  "@hyperdx/node-opentelemetry": "^0.10.3",
31
- "@riocrypto/common": "1.0.2631",
31
+ "@riocrypto/common": "1.0.2632",
32
32
  "@slack/web-api": "^7.15.0",
33
33
  "@types/express": "^4.17.25",
34
34
  "axios": "1.16.0",