@riocrypto/common-server 1.0.2359 → 1.0.2361
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/helpers/get-bulk-payment-from-reference.d.ts +3 -0
- package/build/helpers/get-bulk-payment-from-reference.js +38 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/onboarding.d.ts +4 -4
- package/build/models/onboarding.js +2 -2
- package/build/models/user.d.ts +47 -84
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getBulkPaymentFromReference = void 0;
|
|
13
|
+
const common_1 = require("@riocrypto/common");
|
|
14
|
+
const bulk_bank_payment_1 = require("../models/bulk-bank-payment");
|
|
15
|
+
const getBulkPaymentFromReference = (reference, mongoose) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
// Ensure reference is defined and exactly 6 characters long
|
|
17
|
+
if (!reference || reference.length !== 8) {
|
|
18
|
+
throw new Error("Invalid reference. It must be exactly 8 characters long.");
|
|
19
|
+
}
|
|
20
|
+
// Convert reference to lowercase to ensure case-insensitive comparison
|
|
21
|
+
const bulkPaymentIdPart = reference.slice(2).toLowerCase();
|
|
22
|
+
const BulkBankPayment = (0, bulk_bank_payment_1.buildBulkBankPayment)(mongoose);
|
|
23
|
+
const bulkPayments = yield BulkBankPayment.find({
|
|
24
|
+
status: {
|
|
25
|
+
$in: [
|
|
26
|
+
common_1.BulkBankPaymentStatus.AwaitingPayment,
|
|
27
|
+
common_1.BulkBankPaymentStatus.ExcessAmountReceived,
|
|
28
|
+
common_1.BulkBankPaymentStatus.InsufficientAmountReceived,
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
const bulkPayment = bulkPayments.find((bulkPayment) => bulkPayment.id.toString().endsWith(bulkPaymentIdPart));
|
|
33
|
+
if (!bulkPayment) {
|
|
34
|
+
throw new Error("Bulk payment not found");
|
|
35
|
+
}
|
|
36
|
+
return bulkPayment;
|
|
37
|
+
});
|
|
38
|
+
exports.getBulkPaymentFromReference = getBulkPaymentFromReference;
|
package/build/index.d.ts
CHANGED
|
@@ -130,3 +130,4 @@ export * from "./helpers/generate-idempotency-key-from-mongo-id";
|
|
|
130
130
|
export * from "./helpers/generate-idempotency-key-from-order";
|
|
131
131
|
export * from "./helpers/get-is-fireblocks-signature-valid";
|
|
132
132
|
export * from "./helpers/get-processor";
|
|
133
|
+
export * from "./helpers/get-bulk-payment-from-reference";
|
package/build/index.js
CHANGED
|
@@ -146,3 +146,4 @@ __exportStar(require("./helpers/generate-idempotency-key-from-mongo-id"), export
|
|
|
146
146
|
__exportStar(require("./helpers/generate-idempotency-key-from-order"), exports);
|
|
147
147
|
__exportStar(require("./helpers/get-is-fireblocks-signature-valid"), exports);
|
|
148
148
|
__exportStar(require("./helpers/get-processor"), exports);
|
|
149
|
+
__exportStar(require("./helpers/get-bulk-payment-from-reference"), exports);
|
|
@@ -10,8 +10,8 @@ interface OnboardingAttrs {
|
|
|
10
10
|
userId?: string;
|
|
11
11
|
brokerId?: string;
|
|
12
12
|
authId?: string;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
aiPriseBusinessProfileId?: string;
|
|
14
|
+
aiPriseUserProfileId?: string;
|
|
15
15
|
bridgeId?: string;
|
|
16
16
|
bridgeCustomerId?: string;
|
|
17
17
|
referrerId?: string;
|
|
@@ -28,8 +28,8 @@ interface OnboardingDoc extends mongoose.Document {
|
|
|
28
28
|
userId?: string;
|
|
29
29
|
brokerId?: string;
|
|
30
30
|
authId?: string;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
aiPriseBusinessProfileId?: string;
|
|
32
|
+
aiPriseUserProfileId?: string;
|
|
33
33
|
bridgeId?: string;
|
|
34
34
|
bridgeCustomerId?: string;
|
|
35
35
|
referrerId?: string;
|
package/build/models/user.d.ts
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, RiskTier, ImmigrationStatus, Country, Fiat, Side, Crypto } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
|
+
interface OnboardingBase {
|
|
4
|
+
aipriseBusinessProfileId?: string;
|
|
5
|
+
aipriseUserProfileId?: string;
|
|
6
|
+
}
|
|
7
|
+
type OnboardingCountryData = {
|
|
8
|
+
[country in CountryOfOrigin]?: {
|
|
9
|
+
status?: OnboardingStatus;
|
|
10
|
+
hasAcceptedTerms?: boolean;
|
|
11
|
+
onboardingId?: string;
|
|
12
|
+
bridgeId?: string;
|
|
13
|
+
personalId?: string;
|
|
14
|
+
taxId?: string;
|
|
15
|
+
immigrationStatus?: ImmigrationStatus;
|
|
16
|
+
individualIdentityVerification?: {
|
|
17
|
+
status?: "passed" | "failed" | "review";
|
|
18
|
+
};
|
|
19
|
+
legalRepresentative?: {
|
|
20
|
+
firstName?: string;
|
|
21
|
+
middleName?: string;
|
|
22
|
+
lastName?: string;
|
|
23
|
+
secondLastName?: string;
|
|
24
|
+
verificationStatus?: "passed" | "failed" | "review";
|
|
25
|
+
email?: string;
|
|
26
|
+
};
|
|
27
|
+
files?: {
|
|
28
|
+
certificateOfIncorporation?: string;
|
|
29
|
+
KYCReport?: string;
|
|
30
|
+
taxTranscript?: string;
|
|
31
|
+
proofOfAddress?: string;
|
|
32
|
+
businessRegistration?: string;
|
|
33
|
+
taxIdentificationCertificate?: string;
|
|
34
|
+
legalRepresentativeIdPowerOfAttorney?: string;
|
|
35
|
+
personalIdentificationCertificate?: string;
|
|
36
|
+
extraFiles?: string[];
|
|
37
|
+
};
|
|
38
|
+
address?: {
|
|
39
|
+
street1?: string;
|
|
40
|
+
street2?: string;
|
|
41
|
+
city?: string;
|
|
42
|
+
state?: string;
|
|
43
|
+
postalCode?: string;
|
|
44
|
+
country?: CountryOfOrigin;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
3
48
|
interface UserAttrs {
|
|
4
49
|
createdAt: Date;
|
|
5
50
|
authIds?: string[];
|
|
@@ -69,48 +114,7 @@ interface UserAttrs {
|
|
|
69
114
|
};
|
|
70
115
|
};
|
|
71
116
|
authorizedPhoneNumbers?: string[];
|
|
72
|
-
onboarding?:
|
|
73
|
-
[country in CountryOfOrigin]?: {
|
|
74
|
-
status?: OnboardingStatus;
|
|
75
|
-
hasAcceptedTerms?: boolean;
|
|
76
|
-
onboardingId?: string;
|
|
77
|
-
aiPriseId?: string;
|
|
78
|
-
bridgeId?: string;
|
|
79
|
-
personalId?: string;
|
|
80
|
-
taxId?: string;
|
|
81
|
-
immigrationStatus?: ImmigrationStatus;
|
|
82
|
-
individualIdentityVerification?: {
|
|
83
|
-
status?: "passed" | "failed" | "review";
|
|
84
|
-
};
|
|
85
|
-
legalRepresentative?: {
|
|
86
|
-
firstName?: string;
|
|
87
|
-
middleName?: string;
|
|
88
|
-
lastName?: string;
|
|
89
|
-
secondLastName?: string;
|
|
90
|
-
verificationStatus?: "passed" | "failed" | "review";
|
|
91
|
-
email?: string;
|
|
92
|
-
};
|
|
93
|
-
files?: {
|
|
94
|
-
certificateOfIncorporation?: string;
|
|
95
|
-
KYCReport?: string;
|
|
96
|
-
taxTranscript?: string;
|
|
97
|
-
proofOfAddress?: string;
|
|
98
|
-
businessRegistration?: string;
|
|
99
|
-
taxIdentificationCertificate?: string;
|
|
100
|
-
legalRepresentativeIdPowerOfAttorney?: string;
|
|
101
|
-
personalIdentificationCertificate?: string;
|
|
102
|
-
extraFiles?: string[];
|
|
103
|
-
};
|
|
104
|
-
address?: {
|
|
105
|
-
street1?: string;
|
|
106
|
-
street2?: string;
|
|
107
|
-
city?: string;
|
|
108
|
-
state?: string;
|
|
109
|
-
postalCode?: string;
|
|
110
|
-
country?: CountryOfOrigin;
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
};
|
|
117
|
+
onboarding?: OnboardingBase & OnboardingCountryData;
|
|
114
118
|
invoicing?: {
|
|
115
119
|
MX: {
|
|
116
120
|
shouldInvoice: boolean;
|
|
@@ -206,48 +210,7 @@ interface UserDoc extends Document {
|
|
|
206
210
|
};
|
|
207
211
|
};
|
|
208
212
|
authorizedPhoneNumbers?: string[];
|
|
209
|
-
onboarding?:
|
|
210
|
-
[country in CountryOfOrigin]?: {
|
|
211
|
-
status?: OnboardingStatus;
|
|
212
|
-
hasAcceptedTerms?: boolean;
|
|
213
|
-
onboardingId?: string;
|
|
214
|
-
aiPriseId?: string;
|
|
215
|
-
bridgeId?: string;
|
|
216
|
-
personalId?: string;
|
|
217
|
-
taxId?: string;
|
|
218
|
-
immigrationStatus?: ImmigrationStatus;
|
|
219
|
-
individualIdentityVerification?: {
|
|
220
|
-
status?: "passed" | "failed" | "review";
|
|
221
|
-
};
|
|
222
|
-
legalRepresentative?: {
|
|
223
|
-
firstName?: string;
|
|
224
|
-
middleName?: string;
|
|
225
|
-
lastName?: string;
|
|
226
|
-
secondLastName?: string;
|
|
227
|
-
verificationStatus?: "passed" | "failed" | "review";
|
|
228
|
-
email?: string;
|
|
229
|
-
};
|
|
230
|
-
files?: {
|
|
231
|
-
certificateOfIncorporation?: string;
|
|
232
|
-
KYCReport?: string;
|
|
233
|
-
taxTranscript?: string;
|
|
234
|
-
proofOfAddress?: string;
|
|
235
|
-
businessRegistration?: string;
|
|
236
|
-
taxIdentificationCertificate?: string;
|
|
237
|
-
legalRepresentativeIdPowerOfAttorney?: string;
|
|
238
|
-
personalIdentificationCertificate?: string;
|
|
239
|
-
extraFiles?: string[];
|
|
240
|
-
};
|
|
241
|
-
address?: {
|
|
242
|
-
street1?: string;
|
|
243
|
-
street2?: string;
|
|
244
|
-
city?: string;
|
|
245
|
-
state?: string;
|
|
246
|
-
postalCode?: string;
|
|
247
|
-
country?: CountryOfOrigin;
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
};
|
|
213
|
+
onboarding?: OnboardingBase & OnboardingCountryData;
|
|
251
214
|
invoicing?: {
|
|
252
215
|
MX: {
|
|
253
216
|
shouldInvoice: boolean;
|