@riocrypto/common-server 1.0.2831 → 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.
@@ -197,9 +197,9 @@ declare class ClusterClient {
197
197
  }>;
198
198
  generateAlfinVirtualCci(userId: string): Promise<{
199
199
  CCIV: string;
200
- codigoPagoCciv?: string;
200
+ codigoPagoCCIV?: string;
201
201
  }>;
202
- createAlfinPENTreasuryWithdrawal(amount: number, cci: string, internalTransferId?: string): Promise<{
202
+ createAlfinPENTreasuryWithdrawal(amount: number, CCI: string, internalTransferId?: string): Promise<{
203
203
  movimientoUId: number;
204
204
  transferenciaId: string;
205
205
  mpe001IDL: number;
@@ -689,9 +689,9 @@ class ClusterClient {
689
689
  return response.data;
690
690
  });
691
691
  }
692
- createAlfinPENTreasuryWithdrawal(amount, cci, internalTransferId) {
692
+ createAlfinPENTreasuryWithdrawal(amount, CCI, internalTransferId) {
693
693
  return __awaiter(this, void 0, void 0, function* () {
694
- const response = yield this.axios.post(`${this.baseUrl}/api/bank/accounts/alfin/PEN/treasury-withdrawal`, { amount, cci, internalTransferId }, { headers: { "x-cluster-api-key": this.clusterApiKey } });
694
+ const response = yield this.axios.post(`${this.baseUrl}/api/bank/accounts/alfin/PEN/treasury-withdrawal`, { amount, CCI, internalTransferId }, { headers: { "x-cluster-api-key": this.clusterApiKey } });
695
695
  return response.data;
696
696
  });
697
697
  }
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);
@@ -1,9 +1,17 @@
1
1
  import mongoose, { HydratedDocument } from "mongoose";
2
2
  interface AlfinSettingsAttrs {
3
3
  payinCodeOffset: number;
4
+ treasuryCCIV?: string;
5
+ treasuryCodigoPagoCCIV?: string;
6
+ treasuryCCIVUSD?: string;
7
+ treasuryCodigoPagoCCIVUSD?: string;
4
8
  }
5
9
  interface AlfinSettingsDoc extends mongoose.Document {
6
10
  payinCodeOffset: number;
11
+ treasuryCCIV?: string;
12
+ treasuryCodigoPagoCCIV?: string;
13
+ treasuryCCIVUSD?: string;
14
+ treasuryCodigoPagoCCIVUSD?: string;
7
15
  }
8
16
  interface AlfinSettingsModel extends mongoose.Model<AlfinSettingsDoc> {
9
17
  build(attrs: AlfinSettingsAttrs): HydratedDocument<AlfinSettingsDoc>;
@@ -10,6 +10,18 @@ const buildAlfinSettings = (mongoose) => {
10
10
  type: Number,
11
11
  required: true,
12
12
  },
13
+ treasuryCCIV: {
14
+ type: String,
15
+ },
16
+ treasuryCodigoPagoCCIV: {
17
+ type: String,
18
+ },
19
+ treasuryCCIVUSD: {
20
+ type: String,
21
+ },
22
+ treasuryCodigoPagoCCIVUSD: {
23
+ type: String,
24
+ },
13
25
  }, {
14
26
  toJSON: {
15
27
  transform(doc, ret) {
@@ -1,18 +1,21 @@
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";
4
5
  interface AlfinVirtualCciAttrs {
5
- cci: string;
6
- cciv: string;
7
- codigoPagoCciv?: string;
6
+ CCI: string;
7
+ CCIV: string;
8
+ codigoPagoCCIV?: string;
9
+ fiat: Fiat;
8
10
  userId: string;
9
11
  type: AlfinVirtualCciType;
10
12
  status?: AlfinVirtualCciStatus;
11
13
  }
12
14
  interface AlfinVirtualCciDoc extends Document {
13
- cci: string;
14
- cciv: string;
15
- codigoPagoCciv?: string;
15
+ CCI: string;
16
+ CCIV: string;
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.
@@ -9,19 +10,25 @@ const buildAlfinVirtualCci = (mongoose) => {
9
10
  return mongoose.model("AlfinVirtualCci");
10
11
  }
11
12
  const AlfinVirtualCciSchema = new mongoose.Schema({
12
- cci: {
13
+ CCI: {
13
14
  type: String,
14
15
  required: true,
15
16
  },
16
- cciv: {
17
+ CCIV: {
17
18
  type: String,
18
19
  required: true,
19
20
  unique: true,
20
21
  },
21
- codigoPagoCciv: {
22
+ codigoPagoCCIV: {
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.2831",
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.2629",
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",