@cuenca-mx/cuenca-js 1.2.2-dev0 → 2.0.0-dev0
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/CHANGELOG.md +19 -0
- package/build/data-91da6d58.mjs +625 -0
- package/build/data-ca00ac2d.cjs +669 -0
- package/build/dts/client/client.d.ts +86 -0
- package/build/dts/client/index.d.ts +1 -0
- package/build/dts/errors.d.ts +25 -0
- package/build/dts/helpers/case.d.ts +5 -0
- package/build/dts/helpers/data.d.ts +3 -0
- package/build/dts/helpers/env.d.ts +7 -0
- package/build/dts/index.d.ts +52 -0
- package/build/dts/jwt.d.ts +8 -0
- package/build/dts/models/account.d.ts +12 -0
- package/build/dts/models/alert.d.ts +32 -0
- package/build/dts/models/apiKey.d.ts +13 -0
- package/build/dts/models/arpc.d.ts +10 -0
- package/build/dts/models/balanceEntry.d.ts +15 -0
- package/build/dts/models/baseUser.d.ts +23 -0
- package/build/dts/models/billPayment.d.ts +10 -0
- package/build/dts/models/bridgeAccount.d.ts +27 -0
- package/build/dts/models/bridgeBankAccount.d.ts +16 -0
- package/build/dts/models/bridgeClabe.d.ts +12 -0
- package/build/dts/models/bridgeTransaction.d.ts +32 -0
- package/build/dts/models/card.d.ts +19 -0
- package/build/dts/models/cardActivation.d.ts +12 -0
- package/build/dts/models/cardTransaction.d.ts +15 -0
- package/build/dts/models/cardValidation.d.ts +19 -0
- package/build/dts/models/commission.d.ts +9 -0
- package/build/dts/models/deposit.d.ts +11 -0
- package/build/dts/models/file.d.ts +10 -0
- package/build/dts/models/fraudFundsTransfer.d.ts +9 -0
- package/build/dts/models/index.d.ts +38 -0
- package/build/dts/models/kycValidations.d.ts +22 -0
- package/build/dts/models/loginToken.d.ts +7 -0
- package/build/dts/models/partner.d.ts +25 -0
- package/build/dts/models/postalCode.d.ts +14 -0
- package/build/dts/models/saving.d.ts +11 -0
- package/build/dts/models/serviceProvider.d.ts +10 -0
- package/build/dts/models/session.d.ts +14 -0
- package/build/dts/models/statement.d.ts +10 -0
- package/build/dts/models/transaction.d.ts +7 -0
- package/build/dts/models/transactionalProfile.d.ts +14 -0
- package/build/dts/models/transfer.d.ts +15 -0
- package/build/dts/models/user.d.ts +42 -0
- package/build/dts/models/userCredential.d.ts +10 -0
- package/build/dts/models/userLogin.d.ts +9 -0
- package/build/dts/models/userReport.d.ts +48 -0
- package/build/dts/models/userTosAgreement.d.ts +13 -0
- package/build/dts/models/verification.d.ts +12 -0
- package/build/dts/models/wallet.d.ts +8 -0
- package/build/dts/models/walletTransaction.d.ts +10 -0
- package/build/dts/models/whatsAppTransfer.d.ts +16 -0
- package/build/dts/requests/addressUpdateRequest.d.ts +17 -0
- package/build/dts/requests/alertRequest.d.ts +31 -0
- package/build/dts/requests/apiKeyRequest.d.ts +9 -0
- package/build/dts/requests/arpcRequest.d.ts +16 -0
- package/build/dts/requests/base.d.ts +2 -0
- package/build/dts/requests/cardActivationRequest.d.ts +11 -0
- package/build/dts/requests/cardRequest.d.ts +18 -0
- package/build/dts/requests/cardValidationRequest.d.ts +15 -0
- package/build/dts/requests/fileUploadRequest.d.ts +12 -0
- package/build/dts/requests/fraudFundsTransferRequest.d.ts +13 -0
- package/build/dts/requests/index.d.ts +24 -0
- package/build/dts/requests/kycValidationsRequest.d.ts +10 -0
- package/build/dts/requests/partnerUserRequest.d.ts +100 -0
- package/build/dts/requests/reportGenerateRequest.d.ts +8 -0
- package/build/dts/requests/savingRequest.d.ts +11 -0
- package/build/dts/requests/sessionRequest.d.ts +12 -0
- package/build/dts/requests/tosUpdateRequest.d.ts +11 -0
- package/build/dts/requests/transferRequest.d.ts +12 -0
- package/build/dts/requests/transferUpdateRequest.d.ts +8 -0
- package/build/dts/requests/userCredentialRequest.d.ts +15 -0
- package/build/dts/requests/userLoginRequest.d.ts +8 -0
- package/build/dts/requests/userReportCreateRequest.d.ts +9 -0
- package/build/dts/requests/userReportUpdateRequest.d.ts +28 -0
- package/build/dts/requests/userRequest.d.ts +39 -0
- package/build/dts/requests/verificationRequest.d.ts +17 -0
- package/build/dts/requests/walletTransactionRequest.d.ts +9 -0
- package/build/dts/resources/accounts.d.ts +33 -0
- package/build/dts/resources/alerts.d.ts +54 -0
- package/build/dts/resources/apiKeys.d.ts +63 -0
- package/build/dts/resources/arpc.d.ts +18 -0
- package/build/dts/resources/balanceEntries.d.ts +37 -0
- package/build/dts/resources/base.d.ts +135 -0
- package/build/dts/resources/billPayments.d.ts +34 -0
- package/build/dts/resources/bridgeAccounts.d.ts +49 -0
- package/build/dts/resources/bridgeBankAccounts.d.ts +33 -0
- package/build/dts/resources/bridgeClabes.d.ts +27 -0
- package/build/dts/resources/bridgeTransactions.d.ts +36 -0
- package/build/dts/resources/cardActivations.d.ts +19 -0
- package/build/dts/resources/cardTransactions.d.ts +34 -0
- package/build/dts/resources/cardValidations.d.ts +19 -0
- package/build/dts/resources/cards.d.ts +63 -0
- package/build/dts/resources/commissions.d.ts +34 -0
- package/build/dts/resources/deposits.d.ts +34 -0
- package/build/dts/resources/files.d.ts +30 -0
- package/build/dts/resources/fraudFundsTransfers.d.ts +18 -0
- package/build/dts/resources/index.d.ts +36 -0
- package/build/dts/resources/kycValidations.d.ts +53 -0
- package/build/dts/resources/loginTokens.d.ts +17 -0
- package/build/dts/resources/partners.d.ts +54 -0
- package/build/dts/resources/postalCodes.d.ts +24 -0
- package/build/dts/resources/reports.d.ts +8 -0
- package/build/dts/resources/savings.d.ts +62 -0
- package/build/dts/resources/serviceProviders.d.ts +32 -0
- package/build/dts/resources/sessions.d.ts +43 -0
- package/build/dts/resources/statements.d.ts +44 -0
- package/build/dts/resources/transfers.d.ts +64 -0
- package/build/dts/resources/userCredentials.d.ts +30 -0
- package/build/dts/resources/userLogins.d.ts +28 -0
- package/build/dts/resources/userReports.d.ts +54 -0
- package/build/dts/resources/users.d.ts +56 -0
- package/build/dts/resources/usersTosAgreements.d.ts +16 -0
- package/build/dts/resources/verifications.d.ts +31 -0
- package/build/dts/resources/walletTransactions.d.ts +48 -0
- package/build/dts/resources/whatsAppTransfers.d.ts +34 -0
- package/build/dts/types/enums.d.ts +579 -0
- package/build/dts/types/identities/address.d.ts +25 -0
- package/build/dts/types/identities/alertLog.d.ts +11 -0
- package/build/dts/types/identities/audit.d.ts +10 -0
- package/build/dts/types/identities/businessDetails.d.ts +9 -0
- package/build/dts/types/identities/externalAccount.d.ts +8 -0
- package/build/dts/types/identities/index.d.ts +17 -0
- package/build/dts/types/identities/kycFile.d.ts +14 -0
- package/build/dts/types/identities/legalRepresentatives.d.ts +12 -0
- package/build/dts/types/identities/license.d.ts +10 -0
- package/build/dts/types/identities/moralOperation.d.ts +8 -0
- package/build/dts/types/identities/physicalPerson.d.ts +12 -0
- package/build/dts/types/identities/shareholderMoral.d.ts +12 -0
- package/build/dts/types/identities/shareholderPhysical.d.ts +9 -0
- package/build/dts/types/identities/tosAgreements.d.ts +10 -0
- package/build/dts/types/identities/transactionalProfileServices.d.ts +10 -0
- package/build/dts/types/identities/verificationError.d.ts +10 -0
- package/build/dts/types/identities/vulnerableActivity.d.ts +10 -0
- package/build/dts/types/index.d.ts +3 -0
- package/build/dts/types/queries/accountQuery.d.ts +4 -0
- package/build/dts/types/queries/alertQuery.d.ts +12 -0
- package/build/dts/types/queries/apiKeyQuery.d.ts +4 -0
- package/build/dts/types/queries/balanceEntryQuery.d.ts +5 -0
- package/build/dts/types/queries/billPaymentQuery.d.ts +4 -0
- package/build/dts/types/queries/bridgeAccountQuery.d.ts +4 -0
- package/build/dts/types/queries/bridgeBankAccountQuery.d.ts +4 -0
- package/build/dts/types/queries/bridgeQuery.d.ts +7 -0
- package/build/dts/types/queries/bridgeTransactionQuery.d.ts +6 -0
- package/build/dts/types/queries/cardTransactionQuery.d.ts +4 -0
- package/build/dts/types/queries/cardsQuery.d.ts +4 -0
- package/build/dts/types/queries/depositQuery.d.ts +5 -0
- package/build/dts/types/queries/index.d.ts +26 -0
- package/build/dts/types/queries/partnerQuery.d.ts +4 -0
- package/build/dts/types/queries/postalCodeQuery.d.ts +4 -0
- package/build/dts/types/queries/queryParams.d.ts +15 -0
- package/build/dts/types/queries/statementQuery.d.ts +6 -0
- package/build/dts/types/queries/transactionQuery.d.ts +4 -0
- package/build/dts/types/queries/transferQuery.d.ts +7 -0
- package/build/dts/types/queries/userQuery.d.ts +11 -0
- package/build/dts/types/queries/userReportQuery.d.ts +4 -0
- package/build/dts/types/queries/walletQuery.d.ts +4 -0
- package/build/dts/types/queries/walletTransactionQuery.d.ts +4 -0
- package/build/errors/index.cjs +10 -0
- package/build/errors/index.mjs +10 -1
- package/build/index.cjs +1305 -2894
- package/build/index.mjs +1307 -2895
- package/build/jwt/index.cjs +11 -8
- package/build/jwt/index.mjs +11 -8
- package/build/requests/index.cjs +4 -22
- package/build/requests/index.mjs +2 -26
- package/build/types/index.cjs +18 -56
- package/build/types/index.mjs +9 -34
- package/build/umd/cuenca.umd.js +1 -1
- package/build/vulnerableActivity-61dc2846.mjs +278 -0
- package/build/vulnerableActivity-d5aed4a7.cjs +299 -0
- package/build/walletTransactionRequest-aab46c5e.cjs +461 -0
- package/build/walletTransactionRequest-dc11fc69.mjs +433 -0
- package/errors/index.d.ts +1 -0
- package/jwt/index.d.ts +1 -0
- package/package.json +26 -8
- package/requests/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/build/data-1fd00e5c.mjs +0 -1199
- package/build/data-72c37b60.cjs +0 -1240
- package/build/vulnerableActivity-7cc1734f.cjs +0 -867
- package/build/vulnerableActivity-bd344332.mjs +0 -831
- package/build/walletTransactionRequest-05d5305a.mjs +0 -1512
- package/build/walletTransactionRequest-c6a5c64d.cjs +0 -1539
package/build/index.cjs
CHANGED
|
@@ -2,17 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var axios = require('axios');
|
|
6
5
|
var Buffer = require('buffer');
|
|
7
6
|
var errors_index = require('./errors/index.cjs');
|
|
8
7
|
var jwt_index = require('./jwt/index.cjs');
|
|
9
|
-
var data = require('./data-
|
|
10
|
-
var vulnerableActivity = require('./vulnerableActivity-
|
|
11
|
-
var walletTransactionRequest = require('./walletTransactionRequest-
|
|
8
|
+
var data = require('./data-ca00ac2d.cjs');
|
|
9
|
+
var vulnerableActivity = require('./vulnerableActivity-d5aed4a7.cjs');
|
|
10
|
+
var walletTransactionRequest = require('./walletTransactionRequest-aab46c5e.cjs');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
13
|
|
|
15
|
-
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
16
14
|
var Buffer__default = /*#__PURE__*/_interopDefaultLegacy(Buffer);
|
|
17
15
|
|
|
18
16
|
/* global window */
|
|
@@ -26,7 +24,139 @@ const isNode =
|
|
|
26
24
|
|
|
27
25
|
const runtimeEnv = { isBrowser, isNode };
|
|
28
26
|
|
|
29
|
-
const name="@cuenca-mx/cuenca-js";const version="
|
|
27
|
+
const name="@cuenca-mx/cuenca-js";const version="2.0.0-dev0";const description="Cuenca client for JS";const main="./build/index.cjs";const module$1="./build/index.mjs";const browser="./build/umd/cuenca.umd.js";const types="./build/dts/index.d.ts";const sideEffects=false;const files=["build/**/*","errors/**/*","jwt/**/*","requests/**/*","types/**/*"];const exports$1={".":{types:"./build/dts/index.d.ts","import":"./build/index.mjs",require:"./build/index.cjs"},"./errors":{types:"./build/dts/errors.d.ts","import":"./build/errors/index.mjs",require:"./build/errors/index.cjs"},"./jwt":{types:"./build/dts/jwt.d.ts","import":"./build/jwt/index.mjs",require:"./build/jwt/index.cjs"},"./requests":{types:"./build/dts/requests/index.d.ts","import":"./build/requests/index.mjs",require:"./build/requests/index.cjs"},"./types":{types:"./build/dts/types/index.d.ts","import":"./build/types/index.mjs",require:"./build/types/index.cjs"}};const packageManager="yarn@3.2.0";const type="module";const repository={type:"git",url:"https://github.com/cuenca-mx/cuenca-js.git",directory:"packages/cuenca-js"};const keywords=["cuenca"];const license="MIT";const bugs={url:"https://github.com/cuenca-mx/cuenca-js/issues"};const homepage="https://cuenca.com";const engines={node:">=20"};const scripts={build:"rm -rf build/ tsconfig.tsbuildinfo && yarn rollup --config && yarn tsc -p tsconfig.json && yarn tsc-alias -p tsconfig.json --outDir build/dts",test:"vitest run --coverage",publish:"yarn build && yarn npm publish",dev:"rm -rf build/ && yarn rollup --config && yarn node ../example.cjs",example:"yarn node ../example.cjs"};const devDependencies={"@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.1","@rollup/plugin-typescript":"^11.1.6","@vitest/coverage-v8":"^1.6.0",rollup:"^2.61.1","rollup-plugin-terser":"^7.0.2","tsc-alias":"^1.8.10",typescript:"^4.9.5","vite-tsconfig-paths":"^4.3.2",vitest:"^1.6.0"};const dependencies={buffer:"^6.0.3"};var pkg = {name:name,version:version,description:description,main:main,module:module$1,browser:browser,types:types,sideEffects:sideEffects,files:files,exports:exports$1,packageManager:packageManager,type:type,repository:repository,keywords:keywords,license:license,bugs:bugs,homepage:homepage,engines:engines,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies};
|
|
28
|
+
|
|
29
|
+
/* global FormData */
|
|
30
|
+
|
|
31
|
+
const DEFAULT_TIMEOUT_MS = 45000;
|
|
32
|
+
|
|
33
|
+
const cloneAndSerializeDates = (value) => {
|
|
34
|
+
if (value instanceof Date) return value.toISOString();
|
|
35
|
+
if (Array.isArray(value)) return value.map(cloneAndSerializeDates);
|
|
36
|
+
if (
|
|
37
|
+
value !== null &&
|
|
38
|
+
typeof value === 'object' &&
|
|
39
|
+
value.constructor === Object
|
|
40
|
+
) {
|
|
41
|
+
const out = {};
|
|
42
|
+
Object.keys(value).forEach((key) => {
|
|
43
|
+
out[key] = cloneAndSerializeDates(value[key]);
|
|
44
|
+
});
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function buildUrl(baseURL, url, params) {
|
|
51
|
+
const target = new URL(url, baseURL);
|
|
52
|
+
if (params) {
|
|
53
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
54
|
+
if (value === null || value === undefined) return;
|
|
55
|
+
target.searchParams.append(key, value);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return target.toString();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function parseBody(response, responseType) {
|
|
62
|
+
if (responseType === 'arraybuffer') return response.arrayBuffer();
|
|
63
|
+
if (responseType === 'blob') return response.blob();
|
|
64
|
+
const contentType = response.headers.get('content-type') || '';
|
|
65
|
+
if (contentType.includes('application/json')) {
|
|
66
|
+
const text = await response.text();
|
|
67
|
+
return text ? JSON.parse(text) : {};
|
|
68
|
+
}
|
|
69
|
+
if (
|
|
70
|
+
contentType.includes('application/pdf') ||
|
|
71
|
+
contentType.includes('application/octet-stream')
|
|
72
|
+
) {
|
|
73
|
+
return response.arrayBuffer();
|
|
74
|
+
}
|
|
75
|
+
return response.text();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function fetchTransport({
|
|
79
|
+
baseURL,
|
|
80
|
+
url,
|
|
81
|
+
method = 'GET',
|
|
82
|
+
headers = {},
|
|
83
|
+
params,
|
|
84
|
+
data,
|
|
85
|
+
responseType,
|
|
86
|
+
timeout = DEFAULT_TIMEOUT_MS,
|
|
87
|
+
signal: externalSignal,
|
|
88
|
+
}) {
|
|
89
|
+
const fullUrl = buildUrl(baseURL, url, params);
|
|
90
|
+
const outgoingHeaders = { ...headers };
|
|
91
|
+
|
|
92
|
+
let body;
|
|
93
|
+
if (data !== null && data !== undefined) {
|
|
94
|
+
if (typeof FormData !== 'undefined' && data instanceof FormData) {
|
|
95
|
+
body = data;
|
|
96
|
+
Object.keys(outgoingHeaders)
|
|
97
|
+
.filter((key) => key.toLowerCase() === 'content-type')
|
|
98
|
+
.forEach((key) => delete outgoingHeaders[key]);
|
|
99
|
+
} else if (typeof data === 'string' || data instanceof ArrayBuffer) {
|
|
100
|
+
body = data;
|
|
101
|
+
} else {
|
|
102
|
+
body = JSON.stringify(data);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const controller = new AbortController();
|
|
107
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
108
|
+
if (externalSignal) {
|
|
109
|
+
if (externalSignal.aborted) controller.abort();
|
|
110
|
+
else
|
|
111
|
+
externalSignal.addEventListener('abort', () => controller.abort(), {
|
|
112
|
+
once: true,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let response;
|
|
117
|
+
try {
|
|
118
|
+
response = await fetch(fullUrl, {
|
|
119
|
+
method,
|
|
120
|
+
headers: outgoingHeaders,
|
|
121
|
+
body,
|
|
122
|
+
signal: controller.signal,
|
|
123
|
+
});
|
|
124
|
+
} catch (error) {
|
|
125
|
+
const err = new Error(error.message || 'Network error');
|
|
126
|
+
err.request = {};
|
|
127
|
+
err.errno = error.errno ?? error.cause?.errno;
|
|
128
|
+
err.code =
|
|
129
|
+
error.code ??
|
|
130
|
+
error.cause?.code ??
|
|
131
|
+
(error.name === 'AbortError' ? 'ETIMEDOUT' : undefined);
|
|
132
|
+
throw err;
|
|
133
|
+
} finally {
|
|
134
|
+
clearTimeout(timer);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
let errorData;
|
|
139
|
+
try {
|
|
140
|
+
errorData = await parseBody(response, responseType);
|
|
141
|
+
} catch (parseErr) {
|
|
142
|
+
errorData = await response.text().catch(() => null);
|
|
143
|
+
}
|
|
144
|
+
const err = new Error(`HTTP ${response.status}`);
|
|
145
|
+
err.response = {
|
|
146
|
+
data: errorData,
|
|
147
|
+
status: response.status,
|
|
148
|
+
headers: response.headers,
|
|
149
|
+
};
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const responseData = await parseBody(response, responseType);
|
|
154
|
+
return {
|
|
155
|
+
data: responseData,
|
|
156
|
+
status: response.status,
|
|
157
|
+
headers: response.headers,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
30
160
|
|
|
31
161
|
class Client {
|
|
32
162
|
constructor({
|
|
@@ -38,10 +168,10 @@ class Client {
|
|
|
38
168
|
this.phase = phase;
|
|
39
169
|
this.basicAuth = { apiKey, apiSecret };
|
|
40
170
|
this.jwtToken = null;
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
171
|
+
this._defaultHeaders = { 'Accept-Language': language };
|
|
172
|
+
this._sessionHeaders = {};
|
|
173
|
+
this._timeout = DEFAULT_TIMEOUT_MS;
|
|
174
|
+
this._session = { request: (config) => fetchTransport(config) };
|
|
45
175
|
}
|
|
46
176
|
|
|
47
177
|
get session() {
|
|
@@ -49,9 +179,16 @@ class Client {
|
|
|
49
179
|
}
|
|
50
180
|
|
|
51
181
|
get origin() {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
:
|
|
182
|
+
const hostByPhase = {
|
|
183
|
+
[data.Phase.Sandbox]: 'sandbox.cuenca.com',
|
|
184
|
+
[data.Phase.Stage]: 'api.stage.cuenca.com',
|
|
185
|
+
[data.Phase.Api]: 'api.cuenca.com',
|
|
186
|
+
};
|
|
187
|
+
const host = hostByPhase[this.phase];
|
|
188
|
+
if (!host) {
|
|
189
|
+
throw new errors_index.CuencaException(`Unsupported phase: ${this.phase}`);
|
|
190
|
+
}
|
|
191
|
+
return `https://${host}`;
|
|
55
192
|
}
|
|
56
193
|
|
|
57
194
|
get authHeader() {
|
|
@@ -64,44 +201,37 @@ class Client {
|
|
|
64
201
|
}
|
|
65
202
|
|
|
66
203
|
addHeadersToRequest(obj) {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
204
|
+
const previous = {};
|
|
205
|
+
Object.keys(obj).forEach((key) => {
|
|
206
|
+
previous[key] = Object.prototype.hasOwnProperty.call(
|
|
207
|
+
this._sessionHeaders,
|
|
208
|
+
key,
|
|
209
|
+
)
|
|
210
|
+
? this._sessionHeaders[key]
|
|
211
|
+
: undefined;
|
|
212
|
+
this._sessionHeaders[key] = obj[key];
|
|
74
213
|
});
|
|
75
214
|
return {
|
|
76
|
-
|
|
77
|
-
|
|
215
|
+
eject: () => {
|
|
216
|
+
Object.keys(previous).forEach((key) => {
|
|
217
|
+
if (previous[key] === undefined) delete this._sessionHeaders[key];
|
|
218
|
+
else this._sessionHeaders[key] = previous[key];
|
|
219
|
+
});
|
|
220
|
+
},
|
|
78
221
|
};
|
|
79
222
|
}
|
|
80
223
|
|
|
81
224
|
deleteRequestHeader(header) {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return currentConfig;
|
|
89
|
-
});
|
|
90
|
-
return {
|
|
91
|
-
interceptorId,
|
|
92
|
-
eject: () => this._session.interceptors.request.eject(interceptorId),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
addConfigToRequest(obj) {
|
|
97
|
-
const interceptorId = this._session.interceptors.request.use((config) => {
|
|
98
|
-
const currentConfig = config;
|
|
99
|
-
Object.keys(obj).forEach((k) => (currentConfig[k] = obj[k]));
|
|
100
|
-
return currentConfig;
|
|
101
|
-
});
|
|
225
|
+
const hadPrevious = Object.prototype.hasOwnProperty.call(
|
|
226
|
+
this._sessionHeaders,
|
|
227
|
+
header,
|
|
228
|
+
);
|
|
229
|
+
const previous = hadPrevious ? this._sessionHeaders[header] : undefined;
|
|
230
|
+
delete this._sessionHeaders[header];
|
|
102
231
|
return {
|
|
103
|
-
|
|
104
|
-
|
|
232
|
+
eject: () => {
|
|
233
|
+
if (hadPrevious) this._sessionHeaders[header] = previous;
|
|
234
|
+
},
|
|
105
235
|
};
|
|
106
236
|
}
|
|
107
237
|
|
|
@@ -131,20 +261,27 @@ class Client {
|
|
|
131
261
|
}
|
|
132
262
|
}
|
|
133
263
|
|
|
134
|
-
async get({ endpoint, format, params }) {
|
|
135
|
-
return this.request({ endpoint, format, params });
|
|
264
|
+
async get({ endpoint, format, params, headers, responseType }) {
|
|
265
|
+
return this.request({ endpoint, format, params, headers, responseType });
|
|
136
266
|
}
|
|
137
267
|
|
|
138
|
-
async post({ endpoint, data, multipart }) {
|
|
139
|
-
return this.request({
|
|
268
|
+
async post({ endpoint, data, multipart, headers, responseType }) {
|
|
269
|
+
return this.request({
|
|
270
|
+
method: 'POST',
|
|
271
|
+
endpoint,
|
|
272
|
+
data,
|
|
273
|
+
multipart,
|
|
274
|
+
headers,
|
|
275
|
+
responseType,
|
|
276
|
+
});
|
|
140
277
|
}
|
|
141
278
|
|
|
142
|
-
async patch({ endpoint, data }) {
|
|
143
|
-
return this.request({ method: 'PATCH', endpoint, data });
|
|
279
|
+
async patch({ endpoint, data, headers }) {
|
|
280
|
+
return this.request({ method: 'PATCH', endpoint, data, headers });
|
|
144
281
|
}
|
|
145
282
|
|
|
146
|
-
async delete({ endpoint, data }) {
|
|
147
|
-
return this.request({ method: 'DELETE', endpoint, data });
|
|
283
|
+
async delete({ endpoint, data, headers }) {
|
|
284
|
+
return this.request({ method: 'DELETE', endpoint, data, headers });
|
|
148
285
|
}
|
|
149
286
|
|
|
150
287
|
async request({
|
|
@@ -154,14 +291,21 @@ class Client {
|
|
|
154
291
|
method = 'GET',
|
|
155
292
|
multipart = false,
|
|
156
293
|
params = null,
|
|
294
|
+
headers: extraHeaders = null,
|
|
295
|
+
responseType,
|
|
296
|
+
timeout,
|
|
297
|
+
signal,
|
|
157
298
|
}) {
|
|
158
|
-
|
|
299
|
+
if (this.jwtToken && this.jwtToken.isExpired) {
|
|
300
|
+
this.jwtToken = await jwt_index.Jwt.create(this);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const headers = { ...this._defaultHeaders, ...this._sessionHeaders };
|
|
159
304
|
|
|
160
305
|
if (!multipart) {
|
|
161
|
-
headers =
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
};
|
|
306
|
+
headers['Content-Type'] = 'application/json';
|
|
307
|
+
// FileFormat is a string union (ADR #61 / enums #62) — not `{ value }`.
|
|
308
|
+
headers.Accept = format;
|
|
165
309
|
}
|
|
166
310
|
|
|
167
311
|
if (this.authHeader) {
|
|
@@ -177,32 +321,29 @@ class Client {
|
|
|
177
321
|
}
|
|
178
322
|
|
|
179
323
|
if (this.jwtToken) {
|
|
180
|
-
if (this.jwtToken.isExpired) {
|
|
181
|
-
this.jwtToken = await jwt_index.Jwt.create(this);
|
|
182
|
-
}
|
|
183
324
|
headers['X-Cuenca-Token'] = this.jwtToken.token;
|
|
184
325
|
}
|
|
185
|
-
const headersInterceptor = this.addHeadersToRequest(headers);
|
|
186
326
|
|
|
187
|
-
|
|
327
|
+
if (extraHeaders) Object.assign(headers, extraHeaders);
|
|
328
|
+
|
|
329
|
+
let modifiedData = data$1;
|
|
188
330
|
if (modifiedData && !multipart) {
|
|
189
|
-
|
|
190
|
-
if (modifiedData[k] instanceof Date) {
|
|
191
|
-
modifiedData[k] = modifiedData[k].toISOString();
|
|
192
|
-
}
|
|
193
|
-
});
|
|
331
|
+
modifiedData = cloneAndSerializeDates(data$1);
|
|
194
332
|
}
|
|
195
333
|
|
|
196
|
-
const configInterceptor = this.addConfigToRequest({
|
|
197
|
-
method,
|
|
198
|
-
params,
|
|
199
|
-
data: modifiedData,
|
|
200
|
-
url: endpoint,
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
let response;
|
|
204
334
|
try {
|
|
205
|
-
response = await this._session.request({
|
|
335
|
+
const response = await this._session.request({
|
|
336
|
+
baseURL: this.origin,
|
|
337
|
+
url: endpoint,
|
|
338
|
+
method,
|
|
339
|
+
headers,
|
|
340
|
+
params,
|
|
341
|
+
data: modifiedData,
|
|
342
|
+
responseType,
|
|
343
|
+
timeout: timeout ?? this._timeout,
|
|
344
|
+
signal,
|
|
345
|
+
});
|
|
346
|
+
return response.data;
|
|
206
347
|
} catch (error) {
|
|
207
348
|
if (error.response) {
|
|
208
349
|
throw new errors_index.CuencaResponseException(
|
|
@@ -210,2940 +351,1210 @@ class Client {
|
|
|
210
351
|
error.response.status,
|
|
211
352
|
);
|
|
212
353
|
} else if (error.request) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
);
|
|
354
|
+
const code = error.code ?? error.name ?? 'ENETWORK';
|
|
355
|
+
const errno = error.errno ?? 'unknown';
|
|
356
|
+
throw new errors_index.CuencaException(`No response received: ${errno}: ${code}`);
|
|
216
357
|
} else {
|
|
217
358
|
throw new errors_index.CuencaException(error.message);
|
|
218
359
|
}
|
|
219
|
-
} finally {
|
|
220
|
-
headersInterceptor.eject();
|
|
221
|
-
configInterceptor.eject();
|
|
222
360
|
}
|
|
223
|
-
|
|
224
|
-
return response.data;
|
|
225
361
|
}
|
|
226
362
|
}
|
|
227
363
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.institutionName = institutionName;
|
|
234
|
-
this.name = name;
|
|
235
|
-
this.userId = userId;
|
|
236
|
-
}
|
|
364
|
+
const Account = {
|
|
365
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
366
|
+
'createdAt',
|
|
367
|
+
]),
|
|
368
|
+
};
|
|
237
369
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
370
|
+
const Alert = {
|
|
371
|
+
fromObject: (obj) => {
|
|
372
|
+
const camelized = data.camelize(obj);
|
|
373
|
+
const changeLog = obj.change_log;
|
|
374
|
+
return data.coerceDatesWithDefaults({
|
|
375
|
+
...camelized,
|
|
376
|
+
changeLog: changeLog && Array.isArray(changeLog) && changeLog.length > 0
|
|
377
|
+
? changeLog.map(vulnerableActivity.AlertLog.fromObject)
|
|
378
|
+
: undefined,
|
|
379
|
+
}, ['createdAt', 'updatedAt', 'transactionDate', 'committeeMeetingDate']);
|
|
380
|
+
},
|
|
381
|
+
};
|
|
248
382
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
description,
|
|
262
|
-
hasQuestionnaire,
|
|
263
|
-
id,
|
|
264
|
-
institutionName,
|
|
265
|
-
level,
|
|
266
|
-
name,
|
|
267
|
-
period,
|
|
268
|
-
periodNumber,
|
|
269
|
-
status,
|
|
270
|
-
sourceType,
|
|
271
|
-
transactionDate,
|
|
272
|
-
type,
|
|
273
|
-
typeOfFilter,
|
|
274
|
-
userId,
|
|
275
|
-
updatedAt,
|
|
276
|
-
}) {
|
|
277
|
-
this.accountNumber = accountNumber;
|
|
278
|
-
this.actualPeriodCount = actualPeriodCount;
|
|
279
|
-
this.actualPeriodSum = actualPeriodSum;
|
|
280
|
-
this.agent = agent;
|
|
281
|
-
this.aggregationType = aggregationType;
|
|
282
|
-
this.comments = comments;
|
|
283
|
-
this.committeeMeetingDate = data.dateToUTC(committeeMeetingDate);
|
|
284
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
285
|
-
this.questionnaireId = questionnaireId;
|
|
286
|
-
this.description = description;
|
|
287
|
-
this.hasQuestionnaire = hasQuestionnaire;
|
|
288
|
-
this.id = id;
|
|
289
|
-
this.institutionName = institutionName;
|
|
290
|
-
this.level = data.enumValueFromString(data.MLIndicatorLevel, level);
|
|
291
|
-
this.name = name;
|
|
292
|
-
this.period = data.enumValueFromString(data.MLIndicatorPeriod, period);
|
|
293
|
-
this.periodNumber = periodNumber;
|
|
294
|
-
this.status = data.enumValueFromString(data.AlertStatus, status);
|
|
295
|
-
this.sourceType = data.enumValueFromString(data.SourceAlertType, sourceType);
|
|
296
|
-
this.transactionDate = data.dateToUTC(transactionDate);
|
|
297
|
-
this.type = data.enumValueFromString(data.MLIndicatorType, type);
|
|
298
|
-
this.typeOfFilter = data.enumValueFromString(data.PLDFilterType, typeOfFilter);
|
|
299
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
300
|
-
this.userId = userId;
|
|
301
|
-
this.changeLog = changeLog;
|
|
302
|
-
}
|
|
383
|
+
const ApiKey = {
|
|
384
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
385
|
+
'createdAt',
|
|
386
|
+
'deactivatedAt',
|
|
387
|
+
'updatedAt',
|
|
388
|
+
]),
|
|
389
|
+
isActive: (apiKey) => {
|
|
390
|
+
const todayUTC = data.dateToUTC(Date.now());
|
|
391
|
+
return (!apiKey.deactivatedAt ||
|
|
392
|
+
apiKey.deactivatedAt.getTime() > todayUTC.getTime());
|
|
393
|
+
},
|
|
394
|
+
};
|
|
303
395
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
description,
|
|
308
|
-
id,
|
|
309
|
-
level,
|
|
310
|
-
name,
|
|
311
|
-
period,
|
|
312
|
-
status,
|
|
313
|
-
type,
|
|
314
|
-
...obj
|
|
315
|
-
}) =>
|
|
316
|
-
new Alert({
|
|
317
|
-
agent,
|
|
318
|
-
comments,
|
|
319
|
-
description,
|
|
320
|
-
id,
|
|
321
|
-
level,
|
|
322
|
-
name,
|
|
323
|
-
period,
|
|
324
|
-
status,
|
|
325
|
-
type,
|
|
326
|
-
accountNumber: obj.account_number,
|
|
327
|
-
actualPeriodCount: obj.actual_period_count,
|
|
328
|
-
actualPeriodSum: obj.actual_period_sum,
|
|
329
|
-
aggregationType: obj.aggregation_type,
|
|
330
|
-
changeLog: obj.change_log,
|
|
331
|
-
committeeMeetingDate: obj.committee_meeting_date,
|
|
332
|
-
createdAt: obj.created_at,
|
|
333
|
-
questionnaireId: obj.questionnaire_id,
|
|
334
|
-
hasQuestionnaire: obj.has_questionnaire,
|
|
335
|
-
institutionName: obj.institution_name,
|
|
336
|
-
periodNumber: obj.period_number,
|
|
337
|
-
sourceType: obj.source_type,
|
|
338
|
-
transactionDate: obj.transaction_date,
|
|
339
|
-
typeOfFilter: obj.type_of_filter,
|
|
340
|
-
updatedAt: obj.updated_at,
|
|
341
|
-
userId: obj.user_id,
|
|
342
|
-
});
|
|
396
|
+
const Arpc = {
|
|
397
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), ['createdAt']),
|
|
398
|
+
};
|
|
343
399
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
400
|
+
const BalanceEntry = {
|
|
401
|
+
// The wire calls this field `type`; the model calls it `entryType`.
|
|
402
|
+
fromObject: (obj) => {
|
|
403
|
+
const { type, ...rest } = obj;
|
|
404
|
+
const camelized = data.camelize(rest);
|
|
405
|
+
return data.coerceDatesWithDefaults({ ...camelized, entryType: type }, [
|
|
406
|
+
'createdAt',
|
|
407
|
+
]);
|
|
408
|
+
},
|
|
409
|
+
};
|
|
347
410
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
411
|
+
const BillPayment = {
|
|
412
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
413
|
+
'createdAt',
|
|
414
|
+
]),
|
|
415
|
+
};
|
|
353
416
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
417
|
+
// Empty objects (`{}`) are treated the same as absent — mirrors the old
|
|
418
|
+
// setters' `Object.keys(value).length === 0` guard.
|
|
419
|
+
const nonEmpty = (value) => value && typeof value === 'object' && Object.keys(value).length > 0
|
|
420
|
+
? value
|
|
421
|
+
: undefined;
|
|
422
|
+
const BridgeAccount = {
|
|
423
|
+
fromObject: (obj) => {
|
|
424
|
+
const camelized = data.camelize(obj);
|
|
425
|
+
const address = nonEmpty(obj.address);
|
|
426
|
+
const govtId = nonEmpty(obj.govt_id);
|
|
427
|
+
const proofOfAddress = nonEmpty(obj.proof_of_address);
|
|
428
|
+
const termsOfService = nonEmpty(obj.terms_of_service);
|
|
429
|
+
return data.coerceDatesWithDefaults({
|
|
430
|
+
...camelized,
|
|
431
|
+
address: address ? vulnerableActivity.Address.fromObject(address) : undefined,
|
|
432
|
+
govtId: govtId ? vulnerableActivity.KYCFile.fromObject(govtId) : undefined,
|
|
433
|
+
proofOfAddress: proofOfAddress
|
|
434
|
+
? vulnerableActivity.KYCFile.fromObject(proofOfAddress)
|
|
435
|
+
: undefined,
|
|
436
|
+
termsOfService: termsOfService
|
|
437
|
+
? vulnerableActivity.TOSAgreements.fromObject(termsOfService)
|
|
438
|
+
: undefined,
|
|
439
|
+
}, ['createdAt', 'updatedAt']);
|
|
440
|
+
},
|
|
441
|
+
};
|
|
363
442
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
deactivatedAt: obj.deactivated_at,
|
|
370
|
-
userId: obj.user_id,
|
|
371
|
-
updatedAt: obj.updated_at,
|
|
372
|
-
});
|
|
443
|
+
const BridgeBankAccount = {
|
|
444
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
445
|
+
'createdAt',
|
|
446
|
+
]),
|
|
447
|
+
};
|
|
373
448
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
449
|
+
const BridgeClabe = {
|
|
450
|
+
// `account` is derived from `account_uri` (`/accounts/AC01` -> `AC01`),
|
|
451
|
+
// not a straight rename.
|
|
452
|
+
fromObject: (obj) => {
|
|
453
|
+
const { account_uri: accountUri, ...rest } = obj;
|
|
454
|
+
const camelized = data.camelize(rest);
|
|
455
|
+
return {
|
|
456
|
+
...camelized,
|
|
457
|
+
account: typeof accountUri === 'string' ? accountUri.split('/')[2] : undefined,
|
|
458
|
+
};
|
|
459
|
+
},
|
|
460
|
+
};
|
|
381
461
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
this.isValidArqc = isValidArqc;
|
|
388
|
-
}
|
|
462
|
+
const BridgeTransaction = {
|
|
463
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
464
|
+
'createdAt',
|
|
465
|
+
]),
|
|
466
|
+
};
|
|
389
467
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
});
|
|
397
|
-
}
|
|
468
|
+
const Card = {
|
|
469
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
470
|
+
'createdAt',
|
|
471
|
+
'updatedAt',
|
|
472
|
+
]),
|
|
473
|
+
};
|
|
398
474
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
entryType,
|
|
405
|
-
fundingInstrumentUri,
|
|
406
|
-
id,
|
|
407
|
-
name,
|
|
408
|
-
relatedTransactionUri,
|
|
409
|
-
rollingBalance,
|
|
410
|
-
}) {
|
|
411
|
-
this.amount = amount;
|
|
412
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
413
|
-
this.descriptor = descriptor;
|
|
414
|
-
this.entryType = data.enumValueFromString(data.EntryType, entryType);
|
|
415
|
-
this.fundingInstrumentUri = fundingInstrumentUri;
|
|
416
|
-
this.id = id;
|
|
417
|
-
this.name = name;
|
|
418
|
-
this.relatedTransactionUri = relatedTransactionUri;
|
|
419
|
-
this.rollingBalance = rollingBalance;
|
|
420
|
-
}
|
|
475
|
+
const CardActivation = {
|
|
476
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
477
|
+
'createdAt',
|
|
478
|
+
]),
|
|
479
|
+
};
|
|
421
480
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
481
|
+
const CardTransaction = {
|
|
482
|
+
// Three wire keys don't follow the usual snake_case rename:
|
|
483
|
+
// `error_type` -> cardErrorType, `card_last4` -> cardLastFour,
|
|
484
|
+
// `related_card_transaction` -> relatedCardTransactionsUris. `metadata`
|
|
485
|
+
// is opaque passthrough data and must not be recursively camelized.
|
|
486
|
+
fromObject: (obj) => {
|
|
487
|
+
const { error_type: cardErrorType, card_last4: cardLastFour, related_card_transaction: relatedCardTransactionsUris, metadata, ...rest } = obj;
|
|
488
|
+
const camelized = data.camelize(rest);
|
|
489
|
+
return data.coerceDatesWithDefaults({
|
|
490
|
+
...camelized,
|
|
491
|
+
cardErrorType,
|
|
492
|
+
cardLastFour,
|
|
493
|
+
relatedCardTransactionsUris,
|
|
494
|
+
metadata,
|
|
495
|
+
}, ['createdAt']);
|
|
496
|
+
},
|
|
497
|
+
};
|
|
435
498
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
this.userId = userId;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
499
|
+
const CardValidation = {
|
|
500
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
501
|
+
'createdAt',
|
|
502
|
+
]),
|
|
503
|
+
isActive: (validation) => validation.cardStatus === data.CardStatus.Active,
|
|
504
|
+
};
|
|
445
505
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
descriptor,
|
|
452
|
-
id,
|
|
453
|
-
providerUri,
|
|
454
|
-
status,
|
|
455
|
-
userId,
|
|
456
|
-
}) {
|
|
457
|
-
super({
|
|
458
|
-
amount,
|
|
459
|
-
createdAt,
|
|
460
|
-
descriptor,
|
|
461
|
-
status,
|
|
462
|
-
userId,
|
|
463
|
-
});
|
|
464
|
-
this.accountNumber = accountNumber;
|
|
465
|
-
this.id = id;
|
|
466
|
-
this.providerUri = providerUri;
|
|
467
|
-
}
|
|
506
|
+
const Commission = {
|
|
507
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
508
|
+
'createdAt',
|
|
509
|
+
]),
|
|
510
|
+
};
|
|
468
511
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
status,
|
|
475
|
-
accountNumber: obj.account_number,
|
|
476
|
-
createdAt: obj.created_at,
|
|
477
|
-
providerUri: obj.provider_uri,
|
|
478
|
-
userId: obj.user_id,
|
|
479
|
-
});
|
|
480
|
-
}
|
|
512
|
+
const Deposit = {
|
|
513
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
514
|
+
'createdAt',
|
|
515
|
+
]),
|
|
516
|
+
};
|
|
481
517
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
createdAt,
|
|
486
|
-
updatedAt,
|
|
487
|
-
names,
|
|
488
|
-
firstSurname,
|
|
489
|
-
secondSurname,
|
|
490
|
-
dateOfBirth,
|
|
491
|
-
countryOfBirth,
|
|
492
|
-
rfc,
|
|
493
|
-
curp,
|
|
494
|
-
userId,
|
|
495
|
-
gender,
|
|
496
|
-
phoneNumber,
|
|
497
|
-
emailAddress,
|
|
498
|
-
clientClabe,
|
|
499
|
-
govtId,
|
|
500
|
-
proofOfAddress,
|
|
501
|
-
status,
|
|
502
|
-
termsOfService,
|
|
503
|
-
address,
|
|
504
|
-
}) {
|
|
505
|
-
this.id = id;
|
|
506
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
507
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
508
|
-
this.emailAddress = emailAddress;
|
|
509
|
-
this.clientClabe = clientClabe;
|
|
510
|
-
this.govtId = govtId;
|
|
511
|
-
this.names = names;
|
|
512
|
-
this.firstSurname = firstSurname;
|
|
513
|
-
this.secondSurname = secondSurname;
|
|
514
|
-
this.dateOfBirth = dateOfBirth;
|
|
515
|
-
this.countryOfBirth = countryOfBirth;
|
|
516
|
-
this.rfc = rfc;
|
|
517
|
-
this.curp = curp;
|
|
518
|
-
this.userId = userId;
|
|
519
|
-
this.gender = gender;
|
|
520
|
-
this.phoneNumber = phoneNumber;
|
|
521
|
-
this.proofOfAddress = proofOfAddress;
|
|
522
|
-
this.status = data.enumValueFromString(data.BridgeAccountStatus, status);
|
|
523
|
-
this.termsOfService = termsOfService;
|
|
524
|
-
this.address = address;
|
|
525
|
-
}
|
|
518
|
+
const File = {
|
|
519
|
+
fromObject: (obj) => data.camelize(obj),
|
|
520
|
+
};
|
|
526
521
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
status,
|
|
531
|
-
id: obj.id,
|
|
532
|
-
createdAt: obj.created_at,
|
|
533
|
-
updatedAt: obj.updated_at,
|
|
534
|
-
clientClabe: obj.client_clabe,
|
|
535
|
-
names: obj.names,
|
|
536
|
-
firstSurname: obj.first_surname,
|
|
537
|
-
secondSurname: obj.second_surname,
|
|
538
|
-
dateOfBirth: obj.date_of_birth,
|
|
539
|
-
countryOfBirth: obj.country_of_birth,
|
|
540
|
-
rfc: obj.rfc,
|
|
541
|
-
curp: obj.curp,
|
|
542
|
-
userId: obj.user_id,
|
|
543
|
-
gender: obj.gender,
|
|
544
|
-
govtId: obj.govt_id,
|
|
545
|
-
emailAddress: obj.email_address,
|
|
546
|
-
phoneNumber: obj.phone_number,
|
|
547
|
-
proofOfAddress: obj.proof_of_address,
|
|
548
|
-
termsOfService: obj.terms_of_service,
|
|
549
|
-
});
|
|
522
|
+
const FraudFundsTransfer = {
|
|
523
|
+
fromObject: (obj) => data.camelize(obj),
|
|
524
|
+
};
|
|
550
525
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
526
|
+
const KYCValidations = {
|
|
527
|
+
fromObject: (obj) => {
|
|
528
|
+
const camelized = data.camelize(obj);
|
|
529
|
+
return data.coerceDatesWithDefaults({ ...camelized, filesUri: camelized.filesUri || [] }, ['createdAt', 'updatedAt', 'deactivatedAt']);
|
|
530
|
+
},
|
|
531
|
+
};
|
|
554
532
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
533
|
+
const LoginToken = {
|
|
534
|
+
fromObject: (obj) => ({
|
|
535
|
+
id: obj.id,
|
|
536
|
+
}),
|
|
537
|
+
};
|
|
559
538
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
539
|
+
const BaseUser = {
|
|
540
|
+
fromObject: (obj) => {
|
|
541
|
+
const camelized = data.camelize(obj);
|
|
542
|
+
return data.coerceDatesWithDefaults({
|
|
543
|
+
...camelized,
|
|
544
|
+
address: obj.address
|
|
545
|
+
? vulnerableActivity.Address.fromObject(obj.address)
|
|
546
|
+
: undefined,
|
|
547
|
+
}, ['createdAt', 'updatedAt']);
|
|
548
|
+
},
|
|
549
|
+
};
|
|
563
550
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
551
|
+
const TransactionalProfile = {
|
|
552
|
+
fromObject: (obj) => {
|
|
553
|
+
const camelized = data.camelize(obj);
|
|
554
|
+
return {
|
|
555
|
+
...camelized,
|
|
556
|
+
deposits: obj.deposits
|
|
557
|
+
? vulnerableActivity.TransactionalProfileServices.fromObject(obj.deposits)
|
|
558
|
+
: undefined,
|
|
559
|
+
withdrawal: obj.withdrawal
|
|
560
|
+
? vulnerableActivity.TransactionalProfileServices.fromObject(obj.withdrawal)
|
|
561
|
+
: undefined,
|
|
562
|
+
};
|
|
563
|
+
},
|
|
564
|
+
};
|
|
568
565
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
566
|
+
const toLegalRepresentatives = (obj) => {
|
|
567
|
+
const value = obj.legal_representatives;
|
|
568
|
+
return value ? value.map(vulnerableActivity.LegalRepresentatives.fromObject) : undefined;
|
|
569
|
+
};
|
|
570
|
+
const toTransactionalProfile = (obj) => {
|
|
571
|
+
const value = obj.transactional_profile;
|
|
572
|
+
return value ? TransactionalProfile.fromObject(value) : undefined;
|
|
573
|
+
};
|
|
574
|
+
const Partner = {
|
|
575
|
+
fromObject: (obj) => {
|
|
576
|
+
const base = BaseUser.fromObject(obj);
|
|
577
|
+
const camelized = data.camelize(obj);
|
|
578
|
+
return data.coerceDatesWithDefaults({
|
|
579
|
+
...camelized,
|
|
580
|
+
...base,
|
|
581
|
+
audit: obj.audit
|
|
582
|
+
? vulnerableActivity.Audit.fromObject(obj.audit)
|
|
583
|
+
: undefined,
|
|
584
|
+
businessDetails: obj.business_details
|
|
585
|
+
? vulnerableActivity.BusinessDetails.fromObject(obj.business_details)
|
|
586
|
+
: undefined,
|
|
587
|
+
externalAccount: obj.external_account
|
|
588
|
+
? vulnerableActivity.ExternalAccount.fromObject(obj.external_account)
|
|
589
|
+
: undefined,
|
|
590
|
+
license: obj.license
|
|
591
|
+
? vulnerableActivity.License.fromObject(obj.license)
|
|
592
|
+
: undefined,
|
|
593
|
+
shareholders: obj.shareholders
|
|
594
|
+
? obj.shareholders.map(vulnerableActivity.ShareholderMoral.fromObject)
|
|
595
|
+
: undefined,
|
|
596
|
+
legalRepresentatives: toLegalRepresentatives(obj),
|
|
597
|
+
transactionalProfile: toTransactionalProfile(obj),
|
|
598
|
+
vulnerableActivity: obj.vulnerable_activity
|
|
599
|
+
? vulnerableActivity.VulnerableActivity.fromObject(obj.vulnerable_activity)
|
|
600
|
+
: undefined,
|
|
601
|
+
}, ['incorporationDate']);
|
|
602
|
+
},
|
|
603
|
+
};
|
|
572
604
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
605
|
+
const PostalCode = {
|
|
606
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
607
|
+
'createdAt',
|
|
608
|
+
'updatedAt',
|
|
609
|
+
]),
|
|
610
|
+
};
|
|
577
611
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
612
|
+
const Saving = {
|
|
613
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
614
|
+
'createdAt',
|
|
615
|
+
'deactivatedAt',
|
|
616
|
+
'goalDate',
|
|
617
|
+
'updatedAt',
|
|
618
|
+
]),
|
|
619
|
+
};
|
|
581
620
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
621
|
+
const ServiceProvider = {
|
|
622
|
+
fromObject: (obj) => {
|
|
623
|
+
const camelized = data.camelize(obj);
|
|
624
|
+
return {
|
|
625
|
+
...camelized,
|
|
626
|
+
categories: camelized.categories == null ? [] : camelized.categories,
|
|
627
|
+
};
|
|
628
|
+
},
|
|
629
|
+
};
|
|
587
630
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
firstName,
|
|
595
|
-
id,
|
|
596
|
-
names,
|
|
597
|
-
rfc,
|
|
598
|
-
secondSurname,
|
|
599
|
-
status,
|
|
600
|
-
}) {
|
|
601
|
-
this.clabe = clabe;
|
|
602
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
603
|
-
this.curp = curp;
|
|
604
|
-
this.error = error;
|
|
605
|
-
this.firstName = firstName;
|
|
606
|
-
this.id = id;
|
|
607
|
-
this.names = names;
|
|
608
|
-
this.rfc = rfc;
|
|
609
|
-
this.secondSurname = secondSurname;
|
|
610
|
-
this.status = data.enumValueFromString(data.BridgeBankAccountStatus, status);
|
|
611
|
-
}
|
|
631
|
+
const Session = {
|
|
632
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
633
|
+
'createdAt',
|
|
634
|
+
'expiresAt',
|
|
635
|
+
]),
|
|
636
|
+
};
|
|
612
637
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
names,
|
|
619
|
-
rfc,
|
|
620
|
-
status,
|
|
621
|
-
...obj
|
|
622
|
-
}) =>
|
|
623
|
-
new BridgeBankAccount({
|
|
624
|
-
clabe,
|
|
625
|
-
curp,
|
|
626
|
-
error,
|
|
627
|
-
id,
|
|
628
|
-
names,
|
|
629
|
-
rfc,
|
|
630
|
-
status,
|
|
631
|
-
createdAt: obj.created_at,
|
|
632
|
-
firstName: obj.first_name,
|
|
633
|
-
secondSurname: obj.second_surname,
|
|
634
|
-
});
|
|
635
|
-
}
|
|
638
|
+
const Statement = {
|
|
639
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
640
|
+
'createdAt',
|
|
641
|
+
]),
|
|
642
|
+
};
|
|
636
643
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
this.network = data.enumValueFromString(data.Network, network);
|
|
644
|
-
this.platformId = platformId;
|
|
645
|
-
}
|
|
644
|
+
const Transfer = {
|
|
645
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
646
|
+
'createdAt',
|
|
647
|
+
'updatedAt',
|
|
648
|
+
]),
|
|
649
|
+
};
|
|
646
650
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
651
|
+
const wrapKycFile = (value) => value ? vulnerableActivity.KYCFile.fromObject(value) : undefined;
|
|
652
|
+
const User = {
|
|
653
|
+
fromObject: (obj) => {
|
|
654
|
+
const camelized = data.camelize(obj);
|
|
655
|
+
return data.coerceDatesWithDefaults({
|
|
656
|
+
...camelized,
|
|
657
|
+
address: obj.address
|
|
658
|
+
? vulnerableActivity.Address.fromObject(obj.address)
|
|
659
|
+
: undefined,
|
|
660
|
+
govtId: wrapKycFile(obj.govt_id),
|
|
661
|
+
proofOfAddress: wrapKycFile(obj.proof_of_address),
|
|
662
|
+
proofOfLife: wrapKycFile(obj.proof_of_life),
|
|
663
|
+
curpDocument: wrapKycFile(obj.curp_document),
|
|
664
|
+
termsOfService: obj.terms_of_service
|
|
665
|
+
? vulnerableActivity.TOSAgreements.fromObject(obj.terms_of_service)
|
|
666
|
+
: undefined,
|
|
667
|
+
}, ['createdAt', 'updatedAt']);
|
|
668
|
+
},
|
|
669
|
+
};
|
|
657
670
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
status,
|
|
665
|
-
accountUri,
|
|
666
|
-
quoteUri,
|
|
667
|
-
currency,
|
|
668
|
-
network,
|
|
669
|
-
sourceWallet,
|
|
670
|
-
destinationWallet,
|
|
671
|
-
bankAccountUri,
|
|
672
|
-
cuencaId,
|
|
673
|
-
cuentaOrdenante,
|
|
674
|
-
cuentaBeneficiario,
|
|
675
|
-
nombreOrdenante,
|
|
676
|
-
claveRastreo,
|
|
677
|
-
rfcCurpOrdenante,
|
|
678
|
-
concepto,
|
|
679
|
-
referenciaNumerica,
|
|
680
|
-
signature,
|
|
681
|
-
trackingLink,
|
|
682
|
-
fromCurrency,
|
|
683
|
-
toCurrency,
|
|
684
|
-
fromAmount,
|
|
685
|
-
toAmount,
|
|
686
|
-
}) {
|
|
687
|
-
this.id = id;
|
|
688
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
689
|
-
this.platformId = platformId;
|
|
690
|
-
this.type = data.enumValueFromString(data.BridgeTransactionType, type);
|
|
691
|
-
this.status = data.enumValueFromString(data.TransactionStatus, status);
|
|
692
|
-
this.accountUri = accountUri;
|
|
693
|
-
this.quoteUri = quoteUri;
|
|
694
|
-
this.currency = data.enumValueFromString(data.Currency, currency);
|
|
695
|
-
this.network = data.enumValueFromString(data.Network, network);
|
|
696
|
-
this.sourceWallet = sourceWallet;
|
|
697
|
-
this.destinationWallet = destinationWallet;
|
|
698
|
-
this.bankAccountUri = bankAccountUri;
|
|
699
|
-
this.cuencaId = cuencaId;
|
|
700
|
-
this.cuentaOrdenante = cuentaOrdenante;
|
|
701
|
-
this.cuentaBeneficiario = cuentaBeneficiario;
|
|
702
|
-
this.nombreOrdenante = nombreOrdenante;
|
|
703
|
-
this.claveRastreo = claveRastreo;
|
|
704
|
-
this.rfcCurpOrdenante = rfcCurpOrdenante;
|
|
705
|
-
this.concepto = concepto;
|
|
706
|
-
this.referenciaNumerica = referenciaNumerica;
|
|
707
|
-
this.signature = signature;
|
|
708
|
-
this.trackingLink = trackingLink;
|
|
709
|
-
this.fromCurrency = data.enumValueFromString(data.Currency, fromCurrency);
|
|
710
|
-
this.toCurrency = data.enumValueFromString(data.Currency, toCurrency);
|
|
711
|
-
this.fromAmount = fromAmount;
|
|
712
|
-
this.toAmount = toAmount;
|
|
713
|
-
}
|
|
671
|
+
const UserCredential = {
|
|
672
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
673
|
+
'createdAt',
|
|
674
|
+
'updatedAt',
|
|
675
|
+
]),
|
|
676
|
+
};
|
|
714
677
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
concepto,
|
|
721
|
-
signature,
|
|
722
|
-
...obj
|
|
723
|
-
}) =>
|
|
724
|
-
new BridgeTransaction({
|
|
725
|
-
id: obj.id,
|
|
726
|
-
createdAt: obj.created_at,
|
|
727
|
-
platformId: obj.platform_id,
|
|
728
|
-
accountUri: obj.account_uri,
|
|
729
|
-
quoteUri: obj.quote_uri,
|
|
730
|
-
sourceWallet: obj.source_wallet,
|
|
731
|
-
destinationWallet: obj.destination_wallet,
|
|
732
|
-
bankAccountUri: obj.bank_account_uri,
|
|
733
|
-
cuencaId: obj.cuenca_id,
|
|
734
|
-
cuentaOrdenante: obj.cuenta_ordenante,
|
|
735
|
-
cuentaBeneficiario: obj.cuenta_beneficiario,
|
|
736
|
-
nombreOrdenante: obj.nombre_ordenante,
|
|
737
|
-
claveRastreo: obj.clave_rastreo,
|
|
738
|
-
rfcCurpOrdenante: obj.rfc_curp_ordenante,
|
|
739
|
-
referenciaNumerica: obj.referencia_numerica,
|
|
740
|
-
trackingLink: obj.tracking_link,
|
|
741
|
-
fromCurrency: obj.from_currency,
|
|
742
|
-
toCurrency: obj.to_currency,
|
|
743
|
-
fromAmount: obj.from_amount,
|
|
744
|
-
toAmount: obj.to_amount,
|
|
745
|
-
type,
|
|
746
|
-
status,
|
|
747
|
-
currency,
|
|
748
|
-
network,
|
|
749
|
-
concepto,
|
|
750
|
-
signature,
|
|
751
|
-
});
|
|
752
|
-
}
|
|
678
|
+
const UserLogin = {
|
|
679
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
680
|
+
'lastLoginAt',
|
|
681
|
+
]),
|
|
682
|
+
};
|
|
753
683
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
cvv2,
|
|
758
|
-
expMonth,
|
|
759
|
-
expYear,
|
|
760
|
-
fundingType,
|
|
761
|
-
id,
|
|
762
|
-
issuer,
|
|
763
|
-
number,
|
|
764
|
-
pin,
|
|
765
|
-
status,
|
|
766
|
-
type,
|
|
767
|
-
updatedAt,
|
|
768
|
-
userId,
|
|
769
|
-
}) {
|
|
770
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
771
|
-
this.cvv2 = cvv2;
|
|
772
|
-
this.expMonth = expMonth;
|
|
773
|
-
this.expYear = expYear;
|
|
774
|
-
this.fundingType = data.enumValueFromString(data.CardFundingType, fundingType);
|
|
775
|
-
this.id = id;
|
|
776
|
-
this.issuer = data.enumValueFromString(data.CardIssuer, issuer);
|
|
777
|
-
this.number = number;
|
|
778
|
-
this.pin = pin;
|
|
779
|
-
this.status = data.enumValueFromString(data.CardStatus, status);
|
|
780
|
-
this.type = data.enumValueFromString(data.CardType, type);
|
|
781
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
782
|
-
this.userId = userId;
|
|
783
|
-
}
|
|
684
|
+
const UserReport = {
|
|
685
|
+
fromObject: (obj) => data.camelize(obj),
|
|
686
|
+
};
|
|
784
687
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
status,
|
|
792
|
-
type,
|
|
793
|
-
...obj
|
|
794
|
-
}) =>
|
|
795
|
-
new Card({
|
|
796
|
-
cvv2,
|
|
797
|
-
id,
|
|
798
|
-
issuer,
|
|
799
|
-
number,
|
|
800
|
-
pin,
|
|
801
|
-
status,
|
|
802
|
-
type,
|
|
803
|
-
createdAt: obj.created_at,
|
|
804
|
-
expMonth: obj.exp_month,
|
|
805
|
-
expYear: obj.exp_year,
|
|
806
|
-
fundingType: obj.funding_type,
|
|
807
|
-
updatedAt: obj.updated_at,
|
|
808
|
-
userId: obj.user_id,
|
|
809
|
-
});
|
|
810
|
-
}
|
|
688
|
+
const UserTosAgreement = {
|
|
689
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
690
|
+
'createdAt',
|
|
691
|
+
'updatedAt',
|
|
692
|
+
]),
|
|
693
|
+
};
|
|
811
694
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
this.success = success;
|
|
819
|
-
this.userId = userId;
|
|
820
|
-
}
|
|
695
|
+
const Verification = {
|
|
696
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
697
|
+
'createdAt',
|
|
698
|
+
'updatedAt',
|
|
699
|
+
]),
|
|
700
|
+
};
|
|
821
701
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
createdAt: obj.created_at,
|
|
828
|
-
ipAddress: obj.ip_address,
|
|
829
|
-
userId: obj.user_id,
|
|
830
|
-
});
|
|
831
|
-
}
|
|
702
|
+
const WalletTransaction = {
|
|
703
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
704
|
+
'createdAt',
|
|
705
|
+
]),
|
|
706
|
+
};
|
|
832
707
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
createdAt,
|
|
841
|
-
descriptor,
|
|
842
|
-
metadata,
|
|
843
|
-
network,
|
|
844
|
-
relatedCardTransactionsUris,
|
|
845
|
-
status,
|
|
846
|
-
type,
|
|
847
|
-
userId,
|
|
848
|
-
}) {
|
|
849
|
-
super({
|
|
850
|
-
amount,
|
|
851
|
-
createdAt,
|
|
852
|
-
descriptor,
|
|
853
|
-
status,
|
|
854
|
-
userId,
|
|
855
|
-
});
|
|
856
|
-
this.cardErrorType = data.enumValueFromString(data.CardErrorType, cardErrorType);
|
|
857
|
-
this.cardLastFour = cardLastFour;
|
|
858
|
-
this.cardType = data.enumValueFromString(data.CardType, cardType);
|
|
859
|
-
this.cardUri = cardUri;
|
|
860
|
-
this.metadata = metadata;
|
|
861
|
-
this.network = network;
|
|
862
|
-
this.relatedCardTransactionsUris = relatedCardTransactionsUris;
|
|
863
|
-
this.type = data.enumValueFromString(data.CardTransactionType, type);
|
|
864
|
-
}
|
|
708
|
+
const WhatsAppTransfer = {
|
|
709
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
710
|
+
'createdAt',
|
|
711
|
+
'expiresAt',
|
|
712
|
+
'updatedAt',
|
|
713
|
+
]),
|
|
714
|
+
};
|
|
865
715
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
cardErrorType: obj.error_type,
|
|
883
|
-
cardLastFour: obj.card_last4,
|
|
884
|
-
cardType: obj.card_type,
|
|
885
|
-
cardUri: obj.card_uri,
|
|
886
|
-
createdAt: obj.created_at,
|
|
887
|
-
relatedCardTransactionsUris: obj.related_card_transaction,
|
|
888
|
-
userId: obj.user_id,
|
|
889
|
-
});
|
|
716
|
+
const encodeCursor = (uri) => Buffer.Buffer.from(uri, 'utf8').toString('base64url');
|
|
717
|
+
const decodeCursor = (cursor) => Buffer.Buffer.from(cursor, 'base64url').toString('utf8');
|
|
718
|
+
class Resource {
|
|
719
|
+
constructor(client, path, fromObject) {
|
|
720
|
+
this.client = client;
|
|
721
|
+
this.path = path;
|
|
722
|
+
this.fromObject = fromObject;
|
|
723
|
+
}
|
|
724
|
+
// eslint-disable-next-line class-methods-use-this
|
|
725
|
+
toParams(query) {
|
|
726
|
+
return vulnerableActivity.toParams(query);
|
|
727
|
+
}
|
|
728
|
+
// eslint-disable-next-line class-methods-use-this
|
|
729
|
+
toQueryString(query) {
|
|
730
|
+
return vulnerableActivity.toQueryString(query);
|
|
731
|
+
}
|
|
890
732
|
}
|
|
891
|
-
|
|
892
|
-
class
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
isValidCvv2,
|
|
902
|
-
isValidExpDate,
|
|
903
|
-
isValidIcvv,
|
|
904
|
-
isValidPinBlock,
|
|
905
|
-
userId,
|
|
906
|
-
}) {
|
|
907
|
-
this.cardStatus = data.enumValueFromString(data.CardStatus, cardStatus);
|
|
908
|
-
this.cardType = data.enumValueFromString(data.CardType, cardType);
|
|
909
|
-
this.cardUri = cardUri;
|
|
910
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
911
|
-
this.isExpired = isExpired;
|
|
912
|
-
this.isPinAttemptsExceeded = isPinAttemptsExceeded;
|
|
913
|
-
this.isValidCvv = isValidCvv;
|
|
914
|
-
this.isValidCvv2 = isValidCvv2;
|
|
915
|
-
this.isValidExpDate = isValidExpDate;
|
|
916
|
-
this.isValidIcvv = isValidIcvv;
|
|
917
|
-
this.isValidPinBlock = isValidPinBlock;
|
|
918
|
-
this.userId = userId;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
static fromObject = ({ ...obj }) =>
|
|
922
|
-
new CardValidation({
|
|
923
|
-
cardStatus: obj.card_status,
|
|
924
|
-
cardType: obj.card_type,
|
|
925
|
-
cardUri: obj.card_uri,
|
|
926
|
-
createdAt: obj.created_at,
|
|
927
|
-
isExpired: obj.is_expired,
|
|
928
|
-
isPinAttemptsExceeded: obj.is_pin_attempts_exceeded,
|
|
929
|
-
isValidCvv: obj.is_valid_cvv,
|
|
930
|
-
isValidCvv2: obj.is_valid_cvv2,
|
|
931
|
-
isValidExpDate: obj.is_valid_exp_date,
|
|
932
|
-
isValidIcvv: obj.is_valid_icvv,
|
|
933
|
-
isValidPinBlock: obj.is_valid_pin_block,
|
|
934
|
-
userId: obj.user_id,
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
get isActive() {
|
|
938
|
-
return this.cardStatus === data.CardStatus.Active;
|
|
939
|
-
}
|
|
733
|
+
function Retrievable(Base) {
|
|
734
|
+
return class extends Base {
|
|
735
|
+
async retrieve(id) {
|
|
736
|
+
const response = await this.client.get({
|
|
737
|
+
endpoint: `/${this.path}/${id}`,
|
|
738
|
+
});
|
|
739
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
740
|
+
return this.fromObject(response);
|
|
741
|
+
}
|
|
742
|
+
};
|
|
940
743
|
}
|
|
941
|
-
|
|
942
|
-
class
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
744
|
+
function Creatable(Base) {
|
|
745
|
+
return class extends Base {
|
|
746
|
+
async _create(data) {
|
|
747
|
+
const response = await this.client.post({
|
|
748
|
+
endpoint: `/${this.path}`,
|
|
749
|
+
data,
|
|
750
|
+
});
|
|
751
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
752
|
+
return this.fromObject(response);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
function Updateable(Base) {
|
|
757
|
+
return class extends Base {
|
|
758
|
+
async _update(id, data) {
|
|
759
|
+
const response = await this.client.patch({
|
|
760
|
+
endpoint: `/${this.path}/${id}`,
|
|
761
|
+
data,
|
|
762
|
+
});
|
|
763
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
764
|
+
return this.fromObject(response);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function Uploadable(Base) {
|
|
769
|
+
return class extends Base {
|
|
770
|
+
async _upload(data) {
|
|
771
|
+
const response = await this.client.post({
|
|
772
|
+
endpoint: `/${this.path}`,
|
|
773
|
+
data,
|
|
774
|
+
multipart: true,
|
|
775
|
+
});
|
|
776
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
777
|
+
return this.fromObject(response);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function Deactivable(Base) {
|
|
782
|
+
return class extends Base {
|
|
783
|
+
async _deactivate(id, data = {}) {
|
|
784
|
+
const response = await this.client.delete({
|
|
785
|
+
endpoint: `/${this.path}/${id}`,
|
|
786
|
+
data,
|
|
787
|
+
});
|
|
788
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
789
|
+
return this.fromObject(response);
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function Downlodable(Base) {
|
|
794
|
+
return class extends Base {
|
|
795
|
+
async _download(id, format, responseType) {
|
|
796
|
+
const config = { endpoint: `/${this.path}/${id}` };
|
|
797
|
+
if (format !== undefined)
|
|
798
|
+
config.format = format;
|
|
799
|
+
if (responseType !== undefined)
|
|
800
|
+
config.responseType = responseType;
|
|
801
|
+
return this.client.get(config);
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
const MAX_PAGES = 10000;
|
|
806
|
+
function Queryable(Base) {
|
|
807
|
+
return class extends Base {
|
|
808
|
+
async one(query = {}) {
|
|
809
|
+
const { items } = (await this.client.get({
|
|
810
|
+
endpoint: `/${this.path}`,
|
|
811
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
812
|
+
params: this.toParams({
|
|
813
|
+
...query,
|
|
814
|
+
limit: 2,
|
|
815
|
+
}),
|
|
816
|
+
}));
|
|
817
|
+
if (!items || items.length === 0)
|
|
818
|
+
throw new errors_index.NoResultFound();
|
|
819
|
+
if (items.length > 1)
|
|
820
|
+
throw new errors_index.MultipleResultsFound();
|
|
821
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
822
|
+
return this.fromObject(items[0]);
|
|
823
|
+
}
|
|
824
|
+
async first(query = {}) {
|
|
825
|
+
const { items } = (await this.client.get({
|
|
826
|
+
endpoint: `/${this.path}`,
|
|
827
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
828
|
+
params: this.toParams({
|
|
829
|
+
...query,
|
|
830
|
+
limit: 1,
|
|
831
|
+
}),
|
|
832
|
+
}));
|
|
833
|
+
if (!items || items.length === 0)
|
|
834
|
+
return null;
|
|
835
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
836
|
+
return this.fromObject(items[0]);
|
|
837
|
+
}
|
|
838
|
+
async count(query = {}) {
|
|
839
|
+
const params = {
|
|
840
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
841
|
+
...this.toParams(query),
|
|
842
|
+
count: 1,
|
|
843
|
+
};
|
|
844
|
+
const { count } = (await this.client.get({
|
|
845
|
+
endpoint: `/${this.path}`,
|
|
846
|
+
params,
|
|
847
|
+
}));
|
|
848
|
+
return count ?? 0;
|
|
849
|
+
}
|
|
850
|
+
async page(query, cursor) {
|
|
851
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toQueryString — currently downcast to QueryParams.
|
|
852
|
+
const actualQuery = (query ?? {});
|
|
853
|
+
const normalized = cursor && cursor.length > 0 ? decodeCursor(cursor) : null;
|
|
854
|
+
const endpoint = normalized ?? `/${this.path}?${this.toQueryString(actualQuery)}`;
|
|
855
|
+
const response = (await this.client.get({ endpoint }));
|
|
856
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
857
|
+
const items = (response.items ?? []).map((item) => this.fromObject(item));
|
|
858
|
+
return {
|
|
859
|
+
items,
|
|
860
|
+
nextCursor: response.next_page_uri
|
|
861
|
+
? encodeCursor(response.next_page_uri)
|
|
862
|
+
: null,
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
async *all(query = {}) {
|
|
866
|
+
const seen = new Set();
|
|
867
|
+
let cursor;
|
|
868
|
+
let pageCount = 0;
|
|
869
|
+
while (true) {
|
|
870
|
+
/* v8 ignore next 5 */
|
|
871
|
+
if (pageCount >= MAX_PAGES) {
|
|
872
|
+
throw new errors_index.PaginationError(`Pagination exceeded ${MAX_PAGES} pages; aborting`);
|
|
873
|
+
}
|
|
874
|
+
pageCount += 1;
|
|
875
|
+
// eslint-disable-next-line no-await-in-loop
|
|
876
|
+
const { items, nextCursor } = await this.page(query, cursor);
|
|
877
|
+
if (nextCursor) {
|
|
878
|
+
if (nextCursor === cursor || seen.has(nextCursor)) {
|
|
879
|
+
throw new errors_index.PaginationError(`Repeated next_page_uri: ${nextCursor}`);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
883
|
+
for (const item of items)
|
|
884
|
+
yield item;
|
|
885
|
+
if (!nextCursor)
|
|
886
|
+
return;
|
|
887
|
+
seen.add(nextCursor);
|
|
888
|
+
cursor = nextCursor;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Extracts the top-level path segment(s) from a resource URI, supporting nested paths
|
|
895
|
+
* (e.g. `/bridge/accounts/AC123` → `bridge/accounts`).
|
|
896
|
+
*
|
|
897
|
+
* NOT supported: sub-resource URIs like `/accounts/AC1/refund` — these return
|
|
898
|
+
* `accounts/AC1` which is not a valid resource key. If the API introduces
|
|
899
|
+
* sub-resources, extend this helper.
|
|
900
|
+
*/
|
|
901
|
+
function getResourcePath(uri) {
|
|
902
|
+
if (!uri)
|
|
903
|
+
return null;
|
|
904
|
+
const match = uri.match(/^\/([^?]+)\/[^/?]+(?:\?.*)?$/);
|
|
905
|
+
if (!match)
|
|
906
|
+
return null;
|
|
907
|
+
return match[1];
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
class AccountResource extends Retrievable(Queryable(Resource)) {
|
|
911
|
+
constructor(client) {
|
|
912
|
+
super(client, 'accounts', Account.fromObject);
|
|
913
|
+
}
|
|
973
914
|
}
|
|
915
|
+
var AccountResource$1 = AccountResource;
|
|
974
916
|
|
|
975
|
-
class
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
super({
|
|
988
|
-
amount,
|
|
989
|
-
createdAt,
|
|
990
|
-
descriptor,
|
|
991
|
-
status,
|
|
992
|
-
userId,
|
|
993
|
-
});
|
|
994
|
-
this.id = id;
|
|
995
|
-
this.network = data.enumValueFromString(data.DepositNetwork, network);
|
|
996
|
-
this.sourceUri = sourceUri;
|
|
997
|
-
this.trackingKey = trackingKey;
|
|
998
|
-
}
|
|
917
|
+
class AlertResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
918
|
+
constructor(client) {
|
|
919
|
+
super(client, 'alerts', Alert.fromObject);
|
|
920
|
+
}
|
|
921
|
+
async create(req) {
|
|
922
|
+
return this._create(walletTransactionRequest.AlertUpdateRequest.toCleanObject(req));
|
|
923
|
+
}
|
|
924
|
+
async update(alertId, req) {
|
|
925
|
+
return this._update(alertId, walletTransactionRequest.AlertUpdateRequest.toCleanObject(req));
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
var AlertResource$1 = AlertResource;
|
|
999
929
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
930
|
+
class ApiKeyResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
931
|
+
constructor(client) {
|
|
932
|
+
super(client, 'api_keys', ApiKey.fromObject);
|
|
933
|
+
}
|
|
934
|
+
async create() {
|
|
935
|
+
return this._create({});
|
|
936
|
+
}
|
|
937
|
+
async deactivate(apiKeyId, minutes = 0) {
|
|
938
|
+
// Sends { minutes: 0 } as request body on DELETE. The cuenca backend interprets
|
|
939
|
+
// this as "revoke immediately". Previous implementation omitted the body entirely;
|
|
940
|
+
// if backend behavior differs, revisit this default (cuenca-js#64 review).
|
|
941
|
+
return this._deactivate(apiKeyId, { minutes });
|
|
942
|
+
}
|
|
943
|
+
async update(apiKeyId, metadata, userId = 'me') {
|
|
944
|
+
return this._update(apiKeyId, walletTransactionRequest.ApiKeyUpdateRequest.toCleanObject({ userId, metadata }));
|
|
945
|
+
}
|
|
1012
946
|
}
|
|
947
|
+
var ApiKeyResource$1 = ApiKeyResource;
|
|
1013
948
|
|
|
1014
|
-
class
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
949
|
+
class ArpcResource extends Creatable(Resource) {
|
|
950
|
+
constructor(client) {
|
|
951
|
+
super(client, 'arpc', Arpc.fromObject);
|
|
952
|
+
}
|
|
953
|
+
async create(req) {
|
|
954
|
+
return this._create(walletTransactionRequest.ArpcRequest.toObject(req));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
var ArpcResource$1 = ArpcResource;
|
|
958
|
+
|
|
959
|
+
const RELATED_TRANSACTION_FACTORIES$1 = {
|
|
960
|
+
bill_payments: BillPayment.fromObject,
|
|
961
|
+
card_transactions: CardTransaction.fromObject,
|
|
962
|
+
commissions: Commission.fromObject,
|
|
963
|
+
deposits: Deposit.fromObject,
|
|
964
|
+
savings: Saving.fromObject,
|
|
965
|
+
transfers: Transfer.fromObject,
|
|
966
|
+
wallet_transactions: WalletTransaction.fromObject,
|
|
967
|
+
whatsapp_transfers: WhatsAppTransfer.fromObject,
|
|
968
|
+
};
|
|
969
|
+
const FUNDING_INSTRUMENT_FACTORIES = {
|
|
970
|
+
...RELATED_TRANSACTION_FACTORIES$1,
|
|
971
|
+
accounts: Account.fromObject,
|
|
972
|
+
cards: Card.fromObject,
|
|
973
|
+
'bridge/accounts': BridgeAccount.fromObject,
|
|
974
|
+
};
|
|
975
|
+
class BalanceEntryResource extends Queryable(Retrievable(Resource)) {
|
|
976
|
+
constructor(client) {
|
|
977
|
+
super(client, 'balance_entries', BalanceEntry.fromObject);
|
|
978
|
+
}
|
|
979
|
+
async relatedTransaction(relatedTransactionUri) {
|
|
980
|
+
const path = getResourcePath(relatedTransactionUri);
|
|
981
|
+
if (!path)
|
|
982
|
+
return null;
|
|
983
|
+
const factory = RELATED_TRANSACTION_FACTORIES$1[path];
|
|
984
|
+
if (!factory)
|
|
985
|
+
return null;
|
|
986
|
+
const response = await this.client.get({ endpoint: relatedTransactionUri });
|
|
987
|
+
return factory(response);
|
|
988
|
+
}
|
|
989
|
+
async fundingInstrument(fundingInstrumentUri) {
|
|
990
|
+
const path = getResourcePath(fundingInstrumentUri);
|
|
991
|
+
if (!path)
|
|
992
|
+
return null;
|
|
993
|
+
const factory = FUNDING_INSTRUMENT_FACTORIES[path];
|
|
994
|
+
if (!factory)
|
|
995
|
+
return null;
|
|
996
|
+
const response = await this.client.get({ endpoint: fundingInstrumentUri });
|
|
997
|
+
return factory(response);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
var BalanceEntryResource$1 = BalanceEntryResource;
|
|
1021
1001
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1002
|
+
class BillPaymentResource extends Queryable(Retrievable(Resource)) {
|
|
1003
|
+
constructor(client) {
|
|
1004
|
+
super(client, 'bill_payments', BillPayment.fromObject);
|
|
1005
|
+
}
|
|
1006
|
+
async serviceProvider(providerUri) {
|
|
1007
|
+
if (!providerUri)
|
|
1008
|
+
return null;
|
|
1009
|
+
const response = await this.client.get({ endpoint: providerUri });
|
|
1010
|
+
return ServiceProvider.fromObject(response);
|
|
1011
|
+
}
|
|
1024
1012
|
}
|
|
1013
|
+
var BillPaymentResource$1 = BillPaymentResource;
|
|
1025
1014
|
|
|
1026
|
-
class
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1015
|
+
class BridgeAccountResource extends Queryable(Retrievable(Updateable(Resource))) {
|
|
1016
|
+
constructor(client) {
|
|
1017
|
+
super(client, 'bridge/accounts', BridgeAccount.fromObject);
|
|
1018
|
+
}
|
|
1019
|
+
async update({ userId = 'me', ...req }) {
|
|
1020
|
+
return this._update(userId, walletTransactionRequest.UserUpdateRequest.toCleanObject(req));
|
|
1021
|
+
}
|
|
1022
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1023
|
+
toParams(query) {
|
|
1024
|
+
return vulnerableActivity.toParams$1(query);
|
|
1025
|
+
}
|
|
1026
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1027
|
+
toQueryString(query) {
|
|
1028
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
var BridgeAccountResource$1 = BridgeAccountResource;
|
|
1032
1032
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
claveRastreo: obj.clave_rastreo,
|
|
1038
|
-
});
|
|
1033
|
+
class BridgeBankAccountResource extends Retrievable(Queryable(Resource)) {
|
|
1034
|
+
constructor(client) {
|
|
1035
|
+
super(client, 'bridge/bank_accounts', BridgeBankAccount.fromObject);
|
|
1036
|
+
}
|
|
1039
1037
|
}
|
|
1038
|
+
var BridgeBankAccountResource$1 = BridgeBankAccountResource;
|
|
1040
1039
|
|
|
1041
|
-
class
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
sourceType,
|
|
1056
|
-
flowId,
|
|
1057
|
-
status,
|
|
1058
|
-
providerUrl,
|
|
1059
|
-
}) {
|
|
1060
|
-
this.id = id;
|
|
1061
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1062
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1063
|
-
this.deactivatedAt = data.dateToUTC(deactivatedAt);
|
|
1064
|
-
this.platformId = platformId;
|
|
1065
|
-
this.filesUri = filesUri || [];
|
|
1066
|
-
this.userId = userId;
|
|
1067
|
-
this.verificationId = verificationId;
|
|
1068
|
-
this.identityId = identityId;
|
|
1069
|
-
this.govtIdStatus = data.enumValueFromString(data.VerificationStatus, govtIdStatus);
|
|
1070
|
-
this.proofOfAddressStatus = data.enumValueFromString(
|
|
1071
|
-
data.VerificationStatus,
|
|
1072
|
-
proofOfAddressStatus,
|
|
1073
|
-
);
|
|
1074
|
-
this.proofOfLifeStatus = data.enumValueFromString(
|
|
1075
|
-
data.VerificationStatus,
|
|
1076
|
-
proofOfLifeStatus,
|
|
1077
|
-
);
|
|
1078
|
-
this.sourceType = data.enumValueFromString(data.KYCValidationSource, sourceType);
|
|
1079
|
-
this.flowId = flowId;
|
|
1080
|
-
this.status = data.enumValueFromString(data.VerificationStatus, status);
|
|
1081
|
-
this.providerUrl = providerUrl;
|
|
1082
|
-
}
|
|
1040
|
+
class BridgeClabeResource extends Queryable(Resource) {
|
|
1041
|
+
constructor(client) {
|
|
1042
|
+
super(client, 'bridge/clabes', BridgeClabe.fromObject);
|
|
1043
|
+
}
|
|
1044
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1045
|
+
toParams(query) {
|
|
1046
|
+
return vulnerableActivity.toParams$1(query);
|
|
1047
|
+
}
|
|
1048
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1049
|
+
toQueryString(query) {
|
|
1050
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
var BridgeClabeResource$1 = BridgeClabeResource;
|
|
1083
1054
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
govtIdStatus: obj.govt_id_status,
|
|
1097
|
-
proofOfAddressStatus: obj.proof_of_address_status,
|
|
1098
|
-
proofOfLifeStatus: obj.proof_of_life_status,
|
|
1099
|
-
sourceType: obj.source_type,
|
|
1100
|
-
flowId: obj.flow_id,
|
|
1101
|
-
providerUrl: obj.provider_url,
|
|
1102
|
-
});
|
|
1055
|
+
class BridgeTransactionResource extends Retrievable(Queryable(Resource)) {
|
|
1056
|
+
constructor(client) {
|
|
1057
|
+
super(client, 'bridge/transactions', BridgeTransaction.fromObject);
|
|
1058
|
+
}
|
|
1059
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1060
|
+
toParams(query) {
|
|
1061
|
+
return vulnerableActivity.toParams$1(query);
|
|
1062
|
+
}
|
|
1063
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1064
|
+
toQueryString(query) {
|
|
1065
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1066
|
+
}
|
|
1103
1067
|
}
|
|
1068
|
+
var BridgeTransactionResource$1 = BridgeTransactionResource;
|
|
1104
1069
|
|
|
1105
|
-
class
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1070
|
+
class CardActivationResource extends Creatable(Resource) {
|
|
1071
|
+
constructor(client) {
|
|
1072
|
+
super(client, 'card_activations', CardActivation.fromObject);
|
|
1073
|
+
}
|
|
1074
|
+
async create(req) {
|
|
1075
|
+
return this._create(walletTransactionRequest.CardActivationRequest.toCleanObject(req));
|
|
1076
|
+
}
|
|
1077
|
+
async card(cardUri) {
|
|
1078
|
+
if (!cardUri)
|
|
1079
|
+
return null;
|
|
1080
|
+
const response = await this.client.get({ endpoint: cardUri });
|
|
1081
|
+
return Card.fromObject(response);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
var CardActivationResource$1 = CardActivationResource;
|
|
1109
1085
|
|
|
1110
|
-
|
|
1086
|
+
class CardResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
1087
|
+
constructor(client) {
|
|
1088
|
+
super(client, 'cards', Card.fromObject);
|
|
1089
|
+
}
|
|
1090
|
+
async create(userId, issuer, fundingType) {
|
|
1091
|
+
return this._create(walletTransactionRequest.CardRequest.toCleanObject({ userId, issuer, fundingType }));
|
|
1092
|
+
}
|
|
1093
|
+
async deactivate(cardId) {
|
|
1094
|
+
return this._deactivate(cardId, {});
|
|
1095
|
+
}
|
|
1096
|
+
async update(cardId, status, pinBlock) {
|
|
1097
|
+
return this._update(cardId, walletTransactionRequest.CardUpdateRequest.toCleanObject({
|
|
1098
|
+
status,
|
|
1099
|
+
...(pinBlock !== undefined ? { pinBlock } : {}),
|
|
1100
|
+
}));
|
|
1101
|
+
}
|
|
1111
1102
|
}
|
|
1103
|
+
var CardResource$1 = CardResource;
|
|
1112
1104
|
|
|
1113
|
-
class
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
this.monthlyAmount = monthlyAmount;
|
|
1124
|
-
|
|
1125
|
-
this.recipientsNum = recipientsNum;
|
|
1126
|
-
this.payersNum = payersNum;
|
|
1127
|
-
|
|
1128
|
-
this.deposits = deposits;
|
|
1129
|
-
this.withdrawal = withdrawal;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
get deposits() {
|
|
1133
|
-
return this._deposits;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
set deposits(value) {
|
|
1137
|
-
if (!value) return;
|
|
1138
|
-
this._deposits = vulnerableActivity.TransactionalProfileServices.fromObject(value);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
get withdrawal() {
|
|
1142
|
-
return this._withdrawal;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
set withdrawal(value) {
|
|
1146
|
-
if (!value) return;
|
|
1147
|
-
this._withdrawal = vulnerableActivity.TransactionalProfileServices.fromObject(value);
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
static fromObject = ({ currency, deposits, withdrawal, ...obj }) =>
|
|
1151
|
-
new TransactionalProfile({
|
|
1152
|
-
currency,
|
|
1153
|
-
deposits,
|
|
1154
|
-
withdrawal,
|
|
1155
|
-
payersNum: obj.payers_num,
|
|
1156
|
-
recipientsNum: obj.recipients_num,
|
|
1157
|
-
monthlyAmount: obj.monthly_amount,
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
|
-
class BaseUser {
|
|
1162
|
-
constructor({
|
|
1163
|
-
address,
|
|
1164
|
-
clabe,
|
|
1165
|
-
emailAddress,
|
|
1166
|
-
id,
|
|
1167
|
-
level,
|
|
1168
|
-
meta,
|
|
1169
|
-
nationality,
|
|
1170
|
-
platformId,
|
|
1171
|
-
phoneNumber,
|
|
1172
|
-
requiredLevel,
|
|
1173
|
-
rfc,
|
|
1174
|
-
status,
|
|
1175
|
-
createdAt,
|
|
1176
|
-
updatedAt,
|
|
1177
|
-
userType,
|
|
1178
|
-
}) {
|
|
1179
|
-
this.address = address;
|
|
1180
|
-
this.clabe = clabe;
|
|
1181
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1182
|
-
this.emailAddress = emailAddress;
|
|
1183
|
-
this.id = id;
|
|
1184
|
-
this.level = level;
|
|
1185
|
-
this.meta = meta;
|
|
1186
|
-
this.nationality = nationality;
|
|
1187
|
-
this.platformId = platformId;
|
|
1188
|
-
this.phoneNumber = phoneNumber;
|
|
1189
|
-
this.requiredLevel = requiredLevel;
|
|
1190
|
-
this.rfc = rfc;
|
|
1191
|
-
this.status = data.enumValueFromString(data.UserStatus, status);
|
|
1192
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1193
|
-
this.userType = userType;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
get address() {
|
|
1197
|
-
return this._address;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
set address(value) {
|
|
1201
|
-
if (!value) return;
|
|
1202
|
-
this._address = vulnerableActivity.Address.fromObject(value);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
static fromObject = ({
|
|
1206
|
-
address,
|
|
1207
|
-
clabe,
|
|
1208
|
-
id,
|
|
1209
|
-
level,
|
|
1210
|
-
nationality,
|
|
1211
|
-
rfc,
|
|
1212
|
-
status,
|
|
1213
|
-
...obj
|
|
1214
|
-
}) =>
|
|
1215
|
-
new BaseUser({
|
|
1216
|
-
address,
|
|
1217
|
-
clabe,
|
|
1218
|
-
id,
|
|
1219
|
-
level,
|
|
1220
|
-
meta: obj.meta,
|
|
1221
|
-
nationality,
|
|
1222
|
-
rfc,
|
|
1223
|
-
status,
|
|
1224
|
-
createdAt: obj.created_at,
|
|
1225
|
-
emailAddress: obj.email_address,
|
|
1226
|
-
phoneNumber: obj.phone_number,
|
|
1227
|
-
platformId: obj.platform_id,
|
|
1228
|
-
requiredLevel: obj.required_level,
|
|
1229
|
-
updatedAt: obj.updated_at,
|
|
1230
|
-
userType: obj.user_type,
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
class Partner extends BaseUser {
|
|
1235
|
-
constructor({
|
|
1236
|
-
address,
|
|
1237
|
-
audit,
|
|
1238
|
-
businessDetails,
|
|
1239
|
-
businessModel,
|
|
1240
|
-
businessName,
|
|
1241
|
-
clabe,
|
|
1242
|
-
createdAt,
|
|
1243
|
-
documentationUrl,
|
|
1244
|
-
emailAddress,
|
|
1245
|
-
externalAccount,
|
|
1246
|
-
folio,
|
|
1247
|
-
id,
|
|
1248
|
-
incorporationDate,
|
|
1249
|
-
legalName,
|
|
1250
|
-
legalRepresentatives,
|
|
1251
|
-
level,
|
|
1252
|
-
license,
|
|
1253
|
-
meta,
|
|
1254
|
-
nationality,
|
|
1255
|
-
phoneNumber,
|
|
1256
|
-
platformId,
|
|
1257
|
-
requiredLevel,
|
|
1258
|
-
rfc,
|
|
1259
|
-
shareholders,
|
|
1260
|
-
status,
|
|
1261
|
-
transactionalProfile,
|
|
1262
|
-
updatedAt,
|
|
1263
|
-
userId,
|
|
1264
|
-
userType,
|
|
1265
|
-
vulnerableActivity,
|
|
1266
|
-
webSite,
|
|
1267
|
-
}) {
|
|
1268
|
-
super({
|
|
1269
|
-
address,
|
|
1270
|
-
clabe,
|
|
1271
|
-
emailAddress,
|
|
1272
|
-
rfc,
|
|
1273
|
-
id,
|
|
1274
|
-
level,
|
|
1275
|
-
meta,
|
|
1276
|
-
nationality,
|
|
1277
|
-
platformId,
|
|
1278
|
-
phoneNumber,
|
|
1279
|
-
requiredLevel,
|
|
1280
|
-
status,
|
|
1281
|
-
createdAt,
|
|
1282
|
-
updatedAt,
|
|
1283
|
-
userType,
|
|
1284
|
-
});
|
|
1285
|
-
this.audit = audit;
|
|
1286
|
-
this.businessModel = businessModel;
|
|
1287
|
-
this.businessName = businessName;
|
|
1288
|
-
this.businessDetails = businessDetails;
|
|
1289
|
-
this.documentationUrl = documentationUrl;
|
|
1290
|
-
this.incorporationDate = data.dateToUTC(incorporationDate);
|
|
1291
|
-
this.externalAccount = externalAccount;
|
|
1292
|
-
this.folio = folio;
|
|
1293
|
-
this.legalName = legalName;
|
|
1294
|
-
this.license = license;
|
|
1295
|
-
this.shareholders = shareholders;
|
|
1296
|
-
this.legalRepresentatives = legalRepresentatives;
|
|
1297
|
-
this.transactionalProfile = transactionalProfile;
|
|
1298
|
-
this.userId = userId;
|
|
1299
|
-
this.vulnerableActivity = vulnerableActivity;
|
|
1300
|
-
this.webSite = webSite;
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
get shareholders() {
|
|
1304
|
-
return this._shareholders;
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
|
-
set shareholders(value) {
|
|
1308
|
-
if (!value) return;
|
|
1309
|
-
this._shareholders = value.map((sh) => vulnerableActivity.ShareholderMoral.fromObject(sh));
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
get legalRepresentatives() {
|
|
1313
|
-
return this._legalRepresentatives;
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
set legalRepresentatives(value) {
|
|
1317
|
-
if (!value) return;
|
|
1318
|
-
this._legalRepresentatives = value.map((lr) =>
|
|
1319
|
-
vulnerableActivity.LegalRepresentatives.fromObject(lr),
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
get externalAccount() {
|
|
1324
|
-
return this._externalAccount;
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
set externalAccount(value) {
|
|
1328
|
-
if (!value) return;
|
|
1329
|
-
this._externalAccount = vulnerableActivity.ExternalAccount.fromObject(value);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
get vulnerableActivity() {
|
|
1333
|
-
return this._vulnerableActivity;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
set vulnerableActivity(value) {
|
|
1337
|
-
if (!value) return;
|
|
1338
|
-
this._vulnerableActivity = vulnerableActivity.VulnerableActivity.fromObject(value);
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
get audit() {
|
|
1342
|
-
return this._audit;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
set audit(value) {
|
|
1346
|
-
if (!value) return;
|
|
1347
|
-
this._audit = vulnerableActivity.Audit.fromObject(value);
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
get license() {
|
|
1351
|
-
return this._license;
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
set license(value) {
|
|
1355
|
-
if (!value) return;
|
|
1356
|
-
this._license = vulnerableActivity.License.fromObject(value);
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
get transactionalProfile() {
|
|
1360
|
-
return this._transactionalProfile;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
set transactionalProfile(value) {
|
|
1364
|
-
if (!value) return;
|
|
1365
|
-
this._transactionalProfile = TransactionalProfile.fromObject(value);
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
get businessDetails() {
|
|
1369
|
-
return this._businessDetails;
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
set businessDetails(value) {
|
|
1373
|
-
if (!value) return;
|
|
1374
|
-
this._businessDetails = vulnerableActivity.BusinessDetails.fromObject(value);
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
static fromObject = ({
|
|
1378
|
-
audit,
|
|
1379
|
-
address,
|
|
1380
|
-
clabe,
|
|
1381
|
-
folio,
|
|
1382
|
-
id,
|
|
1383
|
-
level,
|
|
1384
|
-
license,
|
|
1385
|
-
nationality,
|
|
1386
|
-
rfc,
|
|
1387
|
-
status,
|
|
1388
|
-
shareholders,
|
|
1389
|
-
...obj
|
|
1390
|
-
}) =>
|
|
1391
|
-
new Partner({
|
|
1392
|
-
address,
|
|
1393
|
-
audit,
|
|
1394
|
-
clabe,
|
|
1395
|
-
folio,
|
|
1396
|
-
id,
|
|
1397
|
-
level,
|
|
1398
|
-
license,
|
|
1399
|
-
nationality,
|
|
1400
|
-
rfc,
|
|
1401
|
-
shareholders,
|
|
1402
|
-
status,
|
|
1403
|
-
legalName: obj.legal_name,
|
|
1404
|
-
legalRepresentatives: obj.legal_representatives,
|
|
1405
|
-
businessModel: obj.business_model,
|
|
1406
|
-
businessName: obj.business_name,
|
|
1407
|
-
businessDetails: obj.business_details,
|
|
1408
|
-
createdAt: obj.created_at,
|
|
1409
|
-
documentationUrl: obj.documentation_url,
|
|
1410
|
-
emailAddress: obj.email_address,
|
|
1411
|
-
externalAccount: obj.external_account,
|
|
1412
|
-
incorporationDate: obj.incorporation_date,
|
|
1413
|
-
meta: obj.meta,
|
|
1414
|
-
phoneNumber: obj.phone_number,
|
|
1415
|
-
platformId: obj.platform_id,
|
|
1416
|
-
requiredLevel: obj.required_level,
|
|
1417
|
-
transactionalProfile: obj.transactional_profile,
|
|
1418
|
-
updatedAt: obj.updated_at,
|
|
1419
|
-
userId: obj.user_id,
|
|
1420
|
-
userType: obj.user_type,
|
|
1421
|
-
vulnerableActivity: obj.vulnerable_activity,
|
|
1422
|
-
webSite: obj.web_site,
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
class PostalCode {
|
|
1427
|
-
constructor({
|
|
1428
|
-
id,
|
|
1429
|
-
postalCode,
|
|
1430
|
-
colonia,
|
|
1431
|
-
city,
|
|
1432
|
-
state,
|
|
1433
|
-
country,
|
|
1434
|
-
createdAt,
|
|
1435
|
-
updatedAt,
|
|
1436
|
-
}) {
|
|
1437
|
-
this.id = id;
|
|
1438
|
-
this.postalCode = postalCode;
|
|
1439
|
-
this.colonia = colonia;
|
|
1440
|
-
this.city = city;
|
|
1441
|
-
this.state = data.enumValueFromString(data.State, state);
|
|
1442
|
-
this.country = data.enumValueFromString(data.Country, country);
|
|
1443
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1444
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
static fromObject = ({ id, colonia, city, state, country, ...obj }) =>
|
|
1448
|
-
new PostalCode({
|
|
1449
|
-
id,
|
|
1450
|
-
colonia,
|
|
1451
|
-
city,
|
|
1452
|
-
state,
|
|
1453
|
-
country,
|
|
1454
|
-
postalCode: obj.postal_code,
|
|
1455
|
-
createdAt: obj.created_at,
|
|
1456
|
-
updatedAt: obj.updated_at,
|
|
1457
|
-
});
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
class Wallet {
|
|
1461
|
-
constructor({ balance, createdAt, deactivatedAt, id, userId, updatedAt }) {
|
|
1462
|
-
this.balance = balance;
|
|
1463
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1464
|
-
this.deactivatedAt = data.dateToUTC(deactivatedAt);
|
|
1465
|
-
this.id = id;
|
|
1466
|
-
this.userId = userId;
|
|
1467
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
class Saving extends Wallet {
|
|
1472
|
-
constructor({
|
|
1473
|
-
balance,
|
|
1474
|
-
category,
|
|
1475
|
-
createdAt,
|
|
1476
|
-
deactivatedAt,
|
|
1477
|
-
goalAmount,
|
|
1478
|
-
goalDate,
|
|
1479
|
-
id,
|
|
1480
|
-
name,
|
|
1481
|
-
userId,
|
|
1482
|
-
updatedAt,
|
|
1483
|
-
}) {
|
|
1484
|
-
super({
|
|
1485
|
-
balance,
|
|
1486
|
-
createdAt,
|
|
1487
|
-
deactivatedAt,
|
|
1488
|
-
id,
|
|
1489
|
-
userId,
|
|
1490
|
-
updatedAt,
|
|
1491
|
-
});
|
|
1492
|
-
this.category = data.enumValueFromString(data.SavingCategory, category);
|
|
1493
|
-
this.goalAmount = goalAmount;
|
|
1494
|
-
this.goalDate = data.dateToUTC(goalDate);
|
|
1495
|
-
this.name = name;
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
static fromObject = ({ balance, category, id, name, ...obj }) =>
|
|
1499
|
-
new Saving({
|
|
1500
|
-
balance,
|
|
1501
|
-
category,
|
|
1502
|
-
id,
|
|
1503
|
-
name,
|
|
1504
|
-
createdAt: obj.created_at,
|
|
1505
|
-
deactivatedAt: obj.deactivated_at,
|
|
1506
|
-
goalAmount: obj.goal_amount,
|
|
1507
|
-
goalDate: obj.goal_date,
|
|
1508
|
-
userId: obj.user_id,
|
|
1509
|
-
updatedAt: obj.updated_at,
|
|
1510
|
-
});
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
const categoriesFromString = (categoriesList) => {
|
|
1514
|
-
if (categoriesList == null) return [];
|
|
1515
|
-
return categoriesList.map((category) =>
|
|
1516
|
-
data.enumValueFromString(data.ServiceProviderCategory, category),
|
|
1517
|
-
);
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
class ServiceProvider {
|
|
1521
|
-
constructor({ categories, id, name, providerKey }) {
|
|
1522
|
-
this.categories = categoriesFromString(categories);
|
|
1523
|
-
this.id = id;
|
|
1524
|
-
this.name = name;
|
|
1525
|
-
this.providerKey = providerKey;
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
static fromObject = ({ categories, id, name, ...obj }) =>
|
|
1529
|
-
new ServiceProvider({
|
|
1530
|
-
categories,
|
|
1531
|
-
id,
|
|
1532
|
-
name,
|
|
1533
|
-
providerKey: obj.provider_key,
|
|
1534
|
-
});
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
class Session {
|
|
1538
|
-
constructor({
|
|
1539
|
-
createdAt,
|
|
1540
|
-
expiresAt,
|
|
1541
|
-
failureUrl,
|
|
1542
|
-
id,
|
|
1543
|
-
platformId,
|
|
1544
|
-
successUrl,
|
|
1545
|
-
type,
|
|
1546
|
-
userId,
|
|
1547
|
-
}) {
|
|
1548
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1549
|
-
this.expiresAt = data.dateToUTC(expiresAt);
|
|
1550
|
-
this.failureUrl = failureUrl;
|
|
1551
|
-
this.id = id;
|
|
1552
|
-
this.platformId = platformId;
|
|
1553
|
-
this.successUrl = successUrl;
|
|
1554
|
-
this.type = data.enumValueFromString(data.SessionType, type);
|
|
1555
|
-
this.userId = userId;
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
static fromObject = ({ id, type, ...obj }) =>
|
|
1559
|
-
new Session({
|
|
1560
|
-
id,
|
|
1561
|
-
type,
|
|
1562
|
-
createdAt: obj.created_at,
|
|
1563
|
-
expiresAt: obj.expires_at,
|
|
1564
|
-
failureUrl: obj.failure_url,
|
|
1565
|
-
platformId: obj.platform_id,
|
|
1566
|
-
successUrl: obj.success_url,
|
|
1567
|
-
userId: obj.user_id,
|
|
1568
|
-
});
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
class Statement {
|
|
1572
|
-
constructor({ createdAt, id, month, year }) {
|
|
1573
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1574
|
-
this.id = id;
|
|
1575
|
-
this.month = month;
|
|
1576
|
-
this.year = year;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
static fromObject = ({ id, month, year, ...obj }) =>
|
|
1580
|
-
new Statement({
|
|
1581
|
-
id,
|
|
1582
|
-
month,
|
|
1583
|
-
year,
|
|
1584
|
-
createdAt: obj.created_at,
|
|
1585
|
-
});
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
class Transfer extends Transaction {
|
|
1589
|
-
constructor({
|
|
1590
|
-
accountNumber,
|
|
1591
|
-
amount,
|
|
1592
|
-
createdAt,
|
|
1593
|
-
descriptor,
|
|
1594
|
-
destinationUri,
|
|
1595
|
-
id,
|
|
1596
|
-
idempotencyKey,
|
|
1597
|
-
network,
|
|
1598
|
-
recipientName,
|
|
1599
|
-
status,
|
|
1600
|
-
trackingKey,
|
|
1601
|
-
updatedAt,
|
|
1602
|
-
userId,
|
|
1603
|
-
}) {
|
|
1604
|
-
super({
|
|
1605
|
-
amount,
|
|
1606
|
-
createdAt,
|
|
1607
|
-
descriptor,
|
|
1608
|
-
status,
|
|
1609
|
-
userId,
|
|
1610
|
-
});
|
|
1611
|
-
this.accountNumber = accountNumber;
|
|
1612
|
-
this.destinationUri = destinationUri;
|
|
1613
|
-
this.id = id;
|
|
1614
|
-
this.idempotencyKey = idempotencyKey;
|
|
1615
|
-
this.network = data.enumValueFromString(data.TransferNetwork, network);
|
|
1616
|
-
this.recipientName = recipientName;
|
|
1617
|
-
this.trackingKey = trackingKey;
|
|
1618
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
static fromObject = ({ amount, descriptor, id, network, status, ...obj }) =>
|
|
1622
|
-
new Transfer({
|
|
1623
|
-
amount,
|
|
1624
|
-
descriptor,
|
|
1625
|
-
id,
|
|
1626
|
-
network,
|
|
1627
|
-
status,
|
|
1628
|
-
accountNumber: obj.account_number,
|
|
1629
|
-
createdAt: obj.created_at,
|
|
1630
|
-
destinationUri: obj.destination_uri,
|
|
1631
|
-
idempotencyKey: obj.idempotency_key,
|
|
1632
|
-
recipientName: obj.recipient_name,
|
|
1633
|
-
trackingKey: obj.tracking_key,
|
|
1634
|
-
updatedAt: obj.updated_at,
|
|
1635
|
-
userId: obj.user_id,
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
class User {
|
|
1640
|
-
constructor({
|
|
1641
|
-
address,
|
|
1642
|
-
blacklistValidationStatus,
|
|
1643
|
-
clabe,
|
|
1644
|
-
countryOfBirth,
|
|
1645
|
-
createdAt,
|
|
1646
|
-
curp,
|
|
1647
|
-
curpDocument,
|
|
1648
|
-
dateOfBirth,
|
|
1649
|
-
emailAddress,
|
|
1650
|
-
firstSurname,
|
|
1651
|
-
gender,
|
|
1652
|
-
govtId,
|
|
1653
|
-
id,
|
|
1654
|
-
isDormant,
|
|
1655
|
-
isFraud,
|
|
1656
|
-
isPldBlocked,
|
|
1657
|
-
isSecurityMode,
|
|
1658
|
-
level,
|
|
1659
|
-
names,
|
|
1660
|
-
nationality,
|
|
1661
|
-
phoneNumber,
|
|
1662
|
-
profession,
|
|
1663
|
-
proofOfAddress,
|
|
1664
|
-
proofOfLife,
|
|
1665
|
-
requiredLevel,
|
|
1666
|
-
rfc,
|
|
1667
|
-
secondSurname,
|
|
1668
|
-
stateOfBirth,
|
|
1669
|
-
status,
|
|
1670
|
-
termsOfService,
|
|
1671
|
-
updatedAt,
|
|
1672
|
-
userTosAgreementsId,
|
|
1673
|
-
userType,
|
|
1674
|
-
verificationId,
|
|
1675
|
-
fiscalRegimeCode,
|
|
1676
|
-
}) {
|
|
1677
|
-
this.address = address;
|
|
1678
|
-
this.blacklistValidationStatus = data.enumValueFromString(
|
|
1679
|
-
data.VerificationStatus,
|
|
1680
|
-
blacklistValidationStatus,
|
|
1681
|
-
);
|
|
1682
|
-
this.clabe = clabe;
|
|
1683
|
-
this.countryOfBirth = countryOfBirth;
|
|
1684
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1685
|
-
this.curp = curp;
|
|
1686
|
-
this.curpDocument = curpDocument;
|
|
1687
|
-
this.dateOfBirth = dateOfBirth;
|
|
1688
|
-
this.emailAddress = emailAddress;
|
|
1689
|
-
this.firstSurname = firstSurname;
|
|
1690
|
-
this.gender = gender;
|
|
1691
|
-
this.id = id;
|
|
1692
|
-
this.isDormant = isDormant;
|
|
1693
|
-
this.isFraud = isFraud;
|
|
1694
|
-
this.isPldBlocked = isPldBlocked;
|
|
1695
|
-
this.isSecurityMode = isSecurityMode;
|
|
1696
|
-
this.level = level;
|
|
1697
|
-
this.names = names;
|
|
1698
|
-
this.nationality = nationality;
|
|
1699
|
-
this.phoneNumber = phoneNumber;
|
|
1700
|
-
this.profession = profession;
|
|
1701
|
-
this.govtId = govtId;
|
|
1702
|
-
this.proofOfAddress = proofOfAddress;
|
|
1703
|
-
this.proofOfLife = proofOfLife;
|
|
1704
|
-
this.requiredLevel = requiredLevel;
|
|
1705
|
-
this.rfc = rfc;
|
|
1706
|
-
this.secondSurname = secondSurname;
|
|
1707
|
-
this.stateOfBirth = stateOfBirth;
|
|
1708
|
-
this.status = data.enumValueFromString(data.UserStatus, status);
|
|
1709
|
-
this.termsOfService = termsOfService;
|
|
1710
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1711
|
-
this.userTosAgreementsId = userTosAgreementsId;
|
|
1712
|
-
this.userType = userType;
|
|
1713
|
-
this.verificationId = verificationId;
|
|
1714
|
-
this.fiscalRegimeCode = data.enumValueFromString(
|
|
1715
|
-
data.SATRegimeCode,
|
|
1716
|
-
fiscalRegimeCode,
|
|
1717
|
-
);
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
get address() {
|
|
1721
|
-
return this._address;
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
set address(value) {
|
|
1725
|
-
if (!value) return;
|
|
1726
|
-
this._address = vulnerableActivity.Address.fromObject(value);
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
get proofOfAddress() {
|
|
1730
|
-
return this._proofOfAddress;
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
set proofOfAddress(value) {
|
|
1734
|
-
if (!value) return;
|
|
1735
|
-
this._proofOfAddress = vulnerableActivity.KYCFile.fromObject(value);
|
|
1736
|
-
}
|
|
1737
|
-
|
|
1738
|
-
get proofOfLife() {
|
|
1739
|
-
return this._proofOfLife;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
set proofOfLife(value) {
|
|
1743
|
-
if (!value) return;
|
|
1744
|
-
this._proofOfLife = vulnerableActivity.KYCFile.fromObject(value);
|
|
1745
|
-
}
|
|
1746
|
-
|
|
1747
|
-
get govtId() {
|
|
1748
|
-
return this._govtId;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
set govtId(value) {
|
|
1752
|
-
if (!value) return;
|
|
1753
|
-
this._govtId = vulnerableActivity.KYCFile.fromObject(value);
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
get termsOfService() {
|
|
1757
|
-
return this._termsOfService;
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
set termsOfService(value) {
|
|
1761
|
-
if (!value) return;
|
|
1762
|
-
this._termsOfService = vulnerableActivity.TOSAgreements.fromObject(value);
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
get curpDocument() {
|
|
1766
|
-
return this._curpDocument;
|
|
1767
|
-
}
|
|
1768
|
-
|
|
1769
|
-
set curpDocument(value) {
|
|
1770
|
-
if (!value) return;
|
|
1771
|
-
this._curpDocument = vulnerableActivity.KYCFile.fromObject(value);
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
static fromObject = ({
|
|
1775
|
-
address,
|
|
1776
|
-
clabe,
|
|
1777
|
-
curp,
|
|
1778
|
-
gender,
|
|
1779
|
-
id,
|
|
1780
|
-
level,
|
|
1781
|
-
names,
|
|
1782
|
-
nationality,
|
|
1783
|
-
profession,
|
|
1784
|
-
rfc,
|
|
1785
|
-
status,
|
|
1786
|
-
...obj
|
|
1787
|
-
}) =>
|
|
1788
|
-
new User({
|
|
1789
|
-
address,
|
|
1790
|
-
clabe,
|
|
1791
|
-
curp,
|
|
1792
|
-
gender,
|
|
1793
|
-
id,
|
|
1794
|
-
level,
|
|
1795
|
-
names,
|
|
1796
|
-
nationality,
|
|
1797
|
-
profession,
|
|
1798
|
-
rfc,
|
|
1799
|
-
status,
|
|
1800
|
-
blacklistValidationStatus: obj.blacklist_validation_status,
|
|
1801
|
-
countryOfBirth: obj.country_of_birth,
|
|
1802
|
-
createdAt: obj.created_at,
|
|
1803
|
-
curpDocument: obj.curp_document,
|
|
1804
|
-
dateOfBirth: obj.date_of_birth,
|
|
1805
|
-
emailAddress: obj.email_address,
|
|
1806
|
-
firstSurname: obj.first_surname,
|
|
1807
|
-
govtId: obj.govt_id,
|
|
1808
|
-
isDormant: obj.is_dormant,
|
|
1809
|
-
isFraud: obj.is_fraud,
|
|
1810
|
-
isPldBlocked: obj.is_pld_blocked,
|
|
1811
|
-
isSecurityMode: obj.is_security_mode,
|
|
1812
|
-
phoneNumber: obj.phone_number,
|
|
1813
|
-
proofOfAddress: obj.proof_of_address,
|
|
1814
|
-
proofOfLife: obj.proof_of_life,
|
|
1815
|
-
requiredLevel: obj.required_level,
|
|
1816
|
-
secondSurname: obj.second_surname,
|
|
1817
|
-
stateOfBirth: obj.state_of_birth,
|
|
1818
|
-
termsOfService: obj.terms_of_service,
|
|
1819
|
-
updatedAt: obj.updated_at,
|
|
1820
|
-
userTosAgreementsId: obj.user_tos_agreements_id,
|
|
1821
|
-
userType: obj.user_type,
|
|
1822
|
-
verificationId: obj.verification_id,
|
|
1823
|
-
fiscalRegimeCode: obj.fiscal_regime_code,
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
class UserCredential {
|
|
1828
|
-
constructor({ createdAt, id, isActive, updatedAt }) {
|
|
1829
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1830
|
-
this.id = id;
|
|
1831
|
-
this.isActive = isActive;
|
|
1832
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
static fromObject = ({ id, ...obj }) =>
|
|
1836
|
-
new UserCredential({
|
|
1837
|
-
id,
|
|
1838
|
-
createdAt: obj.created_at,
|
|
1839
|
-
isActive: obj.is_active,
|
|
1840
|
-
updatedAt: obj.updated_at,
|
|
1841
|
-
});
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
class UserLogin {
|
|
1845
|
-
constructor({ id, lastLoginAt, success }) {
|
|
1846
|
-
this.id = id;
|
|
1847
|
-
this.lastLoginAt = data.dateToUTC(lastLoginAt);
|
|
1848
|
-
this.success = success;
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
static fromObject = ({ id, success, ...obj }) =>
|
|
1852
|
-
new UserLogin({
|
|
1853
|
-
id,
|
|
1854
|
-
success,
|
|
1855
|
-
lastLoginAt: obj.last_login_at,
|
|
1856
|
-
});
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
class UserReport {
|
|
1860
|
-
constructor({
|
|
1861
|
-
actividadEconomica,
|
|
1862
|
-
apellidoMaterno,
|
|
1863
|
-
apellidoMaternoContraparte,
|
|
1864
|
-
apellidoPaterno,
|
|
1865
|
-
apellidoPaternoContraparte,
|
|
1866
|
-
calleDomicilio,
|
|
1867
|
-
ciudadPoblacion,
|
|
1868
|
-
codigoPostal,
|
|
1869
|
-
colonia,
|
|
1870
|
-
committeeMeetingDate,
|
|
1871
|
-
correoElectronico,
|
|
1872
|
-
cuentaClabeContraparte,
|
|
1873
|
-
curp,
|
|
1874
|
-
descripcionOperacion,
|
|
1875
|
-
entidadFederativaDomicilio,
|
|
1876
|
-
fechaNacimientoConstitucion,
|
|
1877
|
-
genero,
|
|
1878
|
-
id,
|
|
1879
|
-
institucionFinanciera,
|
|
1880
|
-
institucionFinancieraContraparte,
|
|
1881
|
-
instrumentoMonetario,
|
|
1882
|
-
isEditable,
|
|
1883
|
-
mainAlertId,
|
|
1884
|
-
mainAlertUri,
|
|
1885
|
-
nacionalidadCuentaAsociada,
|
|
1886
|
-
nacionalidadCuentaContraparte,
|
|
1887
|
-
nivelCuenta,
|
|
1888
|
-
nombre,
|
|
1889
|
-
nombreContraparte,
|
|
1890
|
-
numeroCuentaProyecto,
|
|
1891
|
-
paisNacionalidad,
|
|
1892
|
-
prioridadReporte,
|
|
1893
|
-
razonDenominacionContraparte,
|
|
1894
|
-
razonInusual,
|
|
1895
|
-
regimen,
|
|
1896
|
-
rfc,
|
|
1897
|
-
telefono,
|
|
1898
|
-
tipoOperacionItf,
|
|
1899
|
-
tipoOperacionPerfil,
|
|
1900
|
-
tipoPersona,
|
|
1901
|
-
tipoPersonaContraparte,
|
|
1902
|
-
userId,
|
|
1903
|
-
}) {
|
|
1904
|
-
this.actividadEconomica = actividadEconomica;
|
|
1905
|
-
this.apellidoMaterno = apellidoMaterno;
|
|
1906
|
-
this.apellidoMaternoContraparte = apellidoMaternoContraparte;
|
|
1907
|
-
this.apellidoPaterno = apellidoPaterno;
|
|
1908
|
-
this.apellidoPaternoContraparte = apellidoPaternoContraparte;
|
|
1909
|
-
this.calleDomicilio = calleDomicilio;
|
|
1910
|
-
this.ciudadPoblacion = ciudadPoblacion;
|
|
1911
|
-
this.codigoPostal = codigoPostal;
|
|
1912
|
-
this.colonia = colonia;
|
|
1913
|
-
this.committeeMeetingDate = committeeMeetingDate;
|
|
1914
|
-
this.correoElectronico = correoElectronico;
|
|
1915
|
-
this.cuentaClabeContraparte = cuentaClabeContraparte;
|
|
1916
|
-
this.curp = curp;
|
|
1917
|
-
this.descripcionOperacion = descripcionOperacion;
|
|
1918
|
-
this.entidadFederativaDomicilio = entidadFederativaDomicilio;
|
|
1919
|
-
this.fechaNacimientoConstitucion = fechaNacimientoConstitucion;
|
|
1920
|
-
this.genero = genero;
|
|
1921
|
-
this.id = id;
|
|
1922
|
-
this.institucionFinanciera = institucionFinanciera;
|
|
1923
|
-
this.institucionFinancieraContraparte = institucionFinancieraContraparte;
|
|
1924
|
-
this.instrumentoMonetario = instrumentoMonetario;
|
|
1925
|
-
this.isEditable = isEditable;
|
|
1926
|
-
this.mainAlertId = mainAlertId;
|
|
1927
|
-
this.mainAlertUri = mainAlertUri;
|
|
1928
|
-
this.nacionalidadCuentaAsociada = nacionalidadCuentaAsociada;
|
|
1929
|
-
this.nacionalidadCuentaContraparte = nacionalidadCuentaContraparte;
|
|
1930
|
-
this.nivelCuenta = nivelCuenta;
|
|
1931
|
-
this.nombre = nombre;
|
|
1932
|
-
this.nombreContraparte = nombreContraparte;
|
|
1933
|
-
this.numeroCuentaProyecto = numeroCuentaProyecto;
|
|
1934
|
-
this.paisNacionalidad = paisNacionalidad;
|
|
1935
|
-
this.prioridadReporte = prioridadReporte;
|
|
1936
|
-
this.razonDenominacionContraparte = razonDenominacionContraparte;
|
|
1937
|
-
this.razonInusual = razonInusual;
|
|
1938
|
-
this.regimen = regimen;
|
|
1939
|
-
this.rfc = rfc;
|
|
1940
|
-
this.telefono = telefono;
|
|
1941
|
-
this.tipoOperacionItf = tipoOperacionItf;
|
|
1942
|
-
this.tipoOperacionPerfil = tipoOperacionPerfil;
|
|
1943
|
-
this.tipoPersona = tipoPersona;
|
|
1944
|
-
this.tipoPersonaContraparte = tipoPersonaContraparte;
|
|
1945
|
-
this.userId = userId;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
static fromObject = ({ id, user_id: userId, ...obj }) =>
|
|
1949
|
-
new UserReport({
|
|
1950
|
-
id,
|
|
1951
|
-
userId,
|
|
1952
|
-
actividadEconomica: obj.actividad_economica,
|
|
1953
|
-
apellidoMaterno: obj.apellido_materno,
|
|
1954
|
-
apellidoMaternoContraparte: obj.apellido_materno_contraparte,
|
|
1955
|
-
apellidoPaterno: obj.apellido_paterno,
|
|
1956
|
-
apellidoPaternoContraparte: obj.apellido_paterno_contraparte,
|
|
1957
|
-
calleDomicilio: obj.calle_domicilio,
|
|
1958
|
-
ciudadPoblacion: obj.ciudad_poblacion,
|
|
1959
|
-
codigoPostal: obj.codigo_postal,
|
|
1960
|
-
colonia: obj.colonia,
|
|
1961
|
-
committeeMeetingDate: obj.committee_meeting_date,
|
|
1962
|
-
correoElectronico: obj.correo_electronico,
|
|
1963
|
-
cuentaClabeContraparte: obj.cuenta_clabe_contraparte,
|
|
1964
|
-
curp: obj.curp,
|
|
1965
|
-
descripcionOperacion: obj.descripcion_operacion,
|
|
1966
|
-
entidadFederativaDomicilio: obj.entidad_federativa_domicilio,
|
|
1967
|
-
fechaNacimientoConstitucion: obj.fecha_nacimiento_constitucion,
|
|
1968
|
-
genero: obj.genero,
|
|
1969
|
-
institucionFinanciera: obj.institucion_financiera,
|
|
1970
|
-
institucionFinancieraContraparte: obj.institucion_financiera_contraparte,
|
|
1971
|
-
instrumentoMonetario: obj.instrumento_monetario,
|
|
1972
|
-
isEditable: obj.is_editable,
|
|
1973
|
-
mainAlertId: obj.main_alert_id,
|
|
1974
|
-
mainAlertUri: obj.main_alert_uri,
|
|
1975
|
-
nacionalidadCuentaAsociada: obj.nacionalidad_cuenta_asociada,
|
|
1976
|
-
nacionalidadCuentaContraparte: obj.nacionalidad_cuenta_contraparte,
|
|
1977
|
-
nivelCuenta: obj.nivel_cuenta,
|
|
1978
|
-
nombre: obj.nombre,
|
|
1979
|
-
nombreContraparte: obj.nombre_contraparte,
|
|
1980
|
-
numeroCuentaProyecto: obj.numero_cuenta_proyecto,
|
|
1981
|
-
paisNacionalidad: obj.pais_nacionalidad,
|
|
1982
|
-
prioridadReporte: obj.prioridad_reporte,
|
|
1983
|
-
razonDenominacionContraparte: obj.razon_denominacion_contraparte,
|
|
1984
|
-
razonInusual: obj.razon_inusual,
|
|
1985
|
-
regimen: obj.regimen,
|
|
1986
|
-
rfc: obj.rfc,
|
|
1987
|
-
telefono: obj.telefono,
|
|
1988
|
-
tipoOperacionItf: obj.tipo_operacion_itf,
|
|
1989
|
-
tipoOperacionPerfil: obj.tipo_operacion_perfil,
|
|
1990
|
-
tipoPersona: obj.tipo_persona,
|
|
1991
|
-
tipoPersonaContraparte: obj.tipo_persona_contraparte,
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
|
|
1995
|
-
class UserTosAgreement {
|
|
1996
|
-
constructor({ createdAt, id, ip, location, type, updatedAt, version }) {
|
|
1997
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
1998
|
-
this.id = id;
|
|
1999
|
-
this.ip = ip;
|
|
2000
|
-
this.location = location;
|
|
2001
|
-
this.type = type;
|
|
2002
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
2003
|
-
this.version = version;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
static fromObject = ({ id, ip, location, type, version, ...obj }) =>
|
|
2007
|
-
new UserTosAgreement({
|
|
2008
|
-
id,
|
|
2009
|
-
ip,
|
|
2010
|
-
location,
|
|
2011
|
-
type,
|
|
2012
|
-
version,
|
|
2013
|
-
createdAt: obj.created_at,
|
|
2014
|
-
updatedAt: obj.updated_at,
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
class Verification {
|
|
2019
|
-
constructor({ createdAt, id, platformId, recipient, type, updatedAt }) {
|
|
2020
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
2021
|
-
this.id = id;
|
|
2022
|
-
this.platformId = platformId;
|
|
2023
|
-
this.recipient = recipient;
|
|
2024
|
-
this.type = data.enumValueFromString(data.VerificationType, type);
|
|
2025
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
static fromObject = ({ id, recipient, type, ...obj }) =>
|
|
2029
|
-
new Verification({
|
|
2030
|
-
id,
|
|
2031
|
-
recipient,
|
|
2032
|
-
type,
|
|
2033
|
-
createdAt: obj.created_at,
|
|
2034
|
-
platformId: obj.platform_id,
|
|
2035
|
-
updatedAt: obj.updated_at,
|
|
2036
|
-
});
|
|
2037
|
-
}
|
|
2038
|
-
|
|
2039
|
-
class WalletTransaction extends Transaction {
|
|
2040
|
-
constructor({
|
|
2041
|
-
amount,
|
|
2042
|
-
createdAt,
|
|
2043
|
-
descriptor,
|
|
2044
|
-
id,
|
|
2045
|
-
status,
|
|
2046
|
-
transactionType,
|
|
2047
|
-
userId,
|
|
2048
|
-
walletUri,
|
|
2049
|
-
}) {
|
|
2050
|
-
super({
|
|
2051
|
-
amount,
|
|
2052
|
-
createdAt,
|
|
2053
|
-
descriptor,
|
|
2054
|
-
status,
|
|
2055
|
-
userId,
|
|
2056
|
-
});
|
|
2057
|
-
this.id = id;
|
|
2058
|
-
this.transactionType = data.enumValueFromString(
|
|
2059
|
-
data.WalletTransactionType,
|
|
2060
|
-
transactionType,
|
|
2061
|
-
);
|
|
2062
|
-
this.walletUri = walletUri;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
static fromObject = ({ amount, descriptor, id, status, ...obj }) =>
|
|
2066
|
-
new WalletTransaction({
|
|
2067
|
-
amount,
|
|
2068
|
-
descriptor,
|
|
2069
|
-
id,
|
|
2070
|
-
status,
|
|
2071
|
-
createdAt: obj.created_at,
|
|
2072
|
-
transactionType: obj.transaction_type,
|
|
2073
|
-
userId: obj.user_id,
|
|
2074
|
-
walletUri: obj.wallet_uri,
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
class WhatsAppTransfer extends Transaction {
|
|
2079
|
-
constructor({
|
|
2080
|
-
amount,
|
|
2081
|
-
claimUrl,
|
|
2082
|
-
createdAt,
|
|
2083
|
-
descriptor,
|
|
2084
|
-
destinationUri,
|
|
2085
|
-
expiresAt,
|
|
2086
|
-
id,
|
|
2087
|
-
network,
|
|
2088
|
-
phoneNumber,
|
|
2089
|
-
recipientName,
|
|
2090
|
-
status,
|
|
2091
|
-
trackingKey,
|
|
2092
|
-
updatedAt,
|
|
2093
|
-
userId,
|
|
2094
|
-
}) {
|
|
2095
|
-
super({
|
|
2096
|
-
amount,
|
|
2097
|
-
createdAt,
|
|
2098
|
-
descriptor,
|
|
2099
|
-
status,
|
|
2100
|
-
userId,
|
|
2101
|
-
});
|
|
2102
|
-
this.claimUrl = claimUrl;
|
|
2103
|
-
this.destinationUri = destinationUri;
|
|
2104
|
-
this.id = id;
|
|
2105
|
-
this.expiresAt = data.dateToUTC(expiresAt);
|
|
2106
|
-
this.network = data.enumValueFromString(data.TransferNetwork, network);
|
|
2107
|
-
this.phoneNumber = phoneNumber;
|
|
2108
|
-
this.recipientName = recipientName;
|
|
2109
|
-
this.trackingKey = trackingKey;
|
|
2110
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
2111
|
-
}
|
|
2112
|
-
|
|
2113
|
-
static fromObject = ({ amount, descriptor, id, network, status, ...obj }) =>
|
|
2114
|
-
new WhatsAppTransfer({
|
|
2115
|
-
amount,
|
|
2116
|
-
descriptor,
|
|
2117
|
-
id,
|
|
2118
|
-
network,
|
|
2119
|
-
status,
|
|
2120
|
-
createdAt: obj.created_at,
|
|
2121
|
-
claimUrl: obj.claim_url,
|
|
2122
|
-
destinationUri: obj.destination_uri,
|
|
2123
|
-
expiresAt: obj.expires_at,
|
|
2124
|
-
phoneNumber: obj.phone_number,
|
|
2125
|
-
recipientName: obj.recipient_name,
|
|
2126
|
-
trackingKey: obj.tracking_key,
|
|
2127
|
-
updatedAt: obj.updated_at,
|
|
2128
|
-
userId: obj.user_id,
|
|
2129
|
-
});
|
|
2130
|
-
}
|
|
2131
|
-
|
|
2132
|
-
class MixinBuilder {
|
|
2133
|
-
constructor(superclass) {
|
|
2134
|
-
this.superclass = superclass;
|
|
2135
|
-
}
|
|
2136
|
-
|
|
2137
|
-
with(...mixins) {
|
|
2138
|
-
return mixins.reduce((c, mixin) => mixin(c), this.superclass);
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
|
|
2142
|
-
const mix = (superclass) => new MixinBuilder(superclass);
|
|
2143
|
-
|
|
2144
|
-
const getModelFromPath = (path, obj) => {
|
|
2145
|
-
const mapper = {
|
|
2146
|
-
accounts: () => Account.fromObject(obj),
|
|
2147
|
-
alerts: () => Alert.fromObject(obj),
|
|
2148
|
-
api_keys: () => ApiKey.fromObject(obj),
|
|
2149
|
-
arpc: () => Arpc.fromObject(obj),
|
|
2150
|
-
balance_entries: () => BalanceEntry.fromObject(obj),
|
|
2151
|
-
bill_payments: () => BillPayment.fromObject(obj),
|
|
2152
|
-
'bridge/accounts': () => BridgeAccount.fromObject(obj),
|
|
2153
|
-
'bridge/bank_accounts': () => BridgeBankAccount.fromObject(obj),
|
|
2154
|
-
'bridge/clabes': () => BridgeClabe.fromObject(obj),
|
|
2155
|
-
'bridge/kyc_validations': () => KYCValidations.fromObject(obj),
|
|
2156
|
-
'bridge/sessions': () => Session.fromObject(obj),
|
|
2157
|
-
'bridge/transactions': () => BridgeTransaction.fromObject(obj),
|
|
2158
|
-
cards: () => Card.fromObject(obj),
|
|
2159
|
-
card_activations: () => CardActivation.fromObject(obj),
|
|
2160
|
-
card_transactions: () => CardTransaction.fromObject(obj),
|
|
2161
|
-
card_validations: () => CardValidation.fromObject(obj),
|
|
2162
|
-
commissions: () => Commission.fromObject(obj),
|
|
2163
|
-
deposits: () => Deposit.fromObject(obj),
|
|
2164
|
-
files: () => File.fromObject(obj),
|
|
2165
|
-
'support/transfer_fraud_funds': () => FraudFundsTransfer.fromObject(obj),
|
|
2166
|
-
kyc_validations: () => KYCValidations.fromObject(obj),
|
|
2167
|
-
login_tokens: () => LoginToken.fromObject(obj),
|
|
2168
|
-
partners: () => Partner.fromObject(obj),
|
|
2169
|
-
postal_codes: () => PostalCode.fromObject(obj),
|
|
2170
|
-
savings: () => Saving.fromObject(obj),
|
|
2171
|
-
service_providers: () => ServiceProvider.fromObject(obj),
|
|
2172
|
-
sessions: () => Session.fromObject(obj),
|
|
2173
|
-
statements: () => Statement.fromObject(obj),
|
|
2174
|
-
transfers: () => Transfer.fromObject(obj),
|
|
2175
|
-
users: () => User.fromObject(obj),
|
|
2176
|
-
user_credentials: () => UserCredential.fromObject(obj),
|
|
2177
|
-
user_logins: () => UserLogin.fromObject(obj),
|
|
2178
|
-
user_reports: () => UserReport.fromObject(obj),
|
|
2179
|
-
users_tos_agreements: () => UserTosAgreement.fromObject(obj),
|
|
2180
|
-
verifications: () => Verification.fromObject(obj),
|
|
2181
|
-
wallet_transactions: () => WalletTransaction.fromObject(obj),
|
|
2182
|
-
whatsapp_transfers: () => WhatsAppTransfer.fromObject(obj),
|
|
2183
|
-
};
|
|
2184
|
-
|
|
2185
|
-
return mapper[path]();
|
|
2186
|
-
};
|
|
2187
|
-
|
|
2188
|
-
const getResource = (uri) => {
|
|
2189
|
-
if (uri === null || uri === '') return null;
|
|
2190
|
-
const regExp = '/(.*?)/';
|
|
2191
|
-
const matches = uri.match(regExp);
|
|
2192
|
-
if (matches === null) return null;
|
|
2193
|
-
return matches[0].replaceAll('/', '');
|
|
2194
|
-
};
|
|
2195
|
-
|
|
2196
|
-
class Resource {
|
|
2197
|
-
constructor(path, QueryParams, client) {
|
|
2198
|
-
this.path = path;
|
|
2199
|
-
this.QueryParams = QueryParams;
|
|
2200
|
-
this.client = client;
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
|
|
2204
|
-
const Retrievable = (SuperClass) =>
|
|
2205
|
-
class Retrievable extends SuperClass {
|
|
2206
|
-
async retrieve(id) {
|
|
2207
|
-
const response = await this.client.get({
|
|
2208
|
-
endpoint: `/${this.path}/${id}`,
|
|
2209
|
-
});
|
|
2210
|
-
return getModelFromPath(this.path, response);
|
|
2211
|
-
}
|
|
2212
|
-
};
|
|
2213
|
-
|
|
2214
|
-
const Creatable = (SuperClass) =>
|
|
2215
|
-
class Creatable extends SuperClass {
|
|
2216
|
-
async _create(data) {
|
|
2217
|
-
const response = await this.client.post({
|
|
2218
|
-
endpoint: `/${this.path}`,
|
|
2219
|
-
data,
|
|
2220
|
-
});
|
|
2221
|
-
return getModelFromPath(this.path, response);
|
|
2222
|
-
}
|
|
2223
|
-
};
|
|
2224
|
-
|
|
2225
|
-
const Updateable = (SuperClass) =>
|
|
2226
|
-
class Updateable extends SuperClass {
|
|
2227
|
-
async _update(id, data) {
|
|
2228
|
-
const response = await this.client.patch({
|
|
2229
|
-
endpoint: `/${this.path}/${id}`,
|
|
2230
|
-
data,
|
|
2231
|
-
});
|
|
2232
|
-
const model = getModelFromPath(this.path, response);
|
|
2233
|
-
return model;
|
|
2234
|
-
}
|
|
2235
|
-
};
|
|
2236
|
-
|
|
2237
|
-
const Uploadable = (SuperClass) =>
|
|
2238
|
-
class Uploadable extends SuperClass {
|
|
2239
|
-
async _upload(data) {
|
|
2240
|
-
const response = await this.client.post({
|
|
2241
|
-
endpoint: `/${this.path}`,
|
|
2242
|
-
data,
|
|
2243
|
-
multipart: true,
|
|
2244
|
-
});
|
|
2245
|
-
const model = getModelFromPath(this.path, response);
|
|
2246
|
-
return model;
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
const Deactivable = (SuperClass) =>
|
|
2251
|
-
class Deactivable extends SuperClass {
|
|
2252
|
-
async _deactivate(id, data) {
|
|
2253
|
-
const response = await this.client.delete({
|
|
2254
|
-
endpoint: `/${this.path}/${id}`,
|
|
2255
|
-
data,
|
|
2256
|
-
});
|
|
2257
|
-
const model = getModelFromPath(this.path, response);
|
|
2258
|
-
return model;
|
|
2259
|
-
}
|
|
2260
|
-
};
|
|
2261
|
-
|
|
2262
|
-
const Downlodable = (SuperClass) =>
|
|
2263
|
-
class Downlodable extends SuperClass {
|
|
2264
|
-
async _download(id, format) {
|
|
2265
|
-
const byteString = await this.client.get({
|
|
2266
|
-
endpoint: `/${this.path}/${id}`,
|
|
2267
|
-
format,
|
|
2268
|
-
});
|
|
2269
|
-
return byteString;
|
|
2270
|
-
}
|
|
2271
|
-
};
|
|
2272
|
-
|
|
2273
|
-
const Queryable = (SuperClass) =>
|
|
2274
|
-
class Queryable extends SuperClass {
|
|
2275
|
-
async one(queryParams = new this.QueryParams({})) {
|
|
2276
|
-
const { items } = await this.client.get({
|
|
2277
|
-
endpoint: `/${this.path}`,
|
|
2278
|
-
params: queryParams.toParams(),
|
|
2279
|
-
});
|
|
2280
|
-
|
|
2281
|
-
if (!items || !items.length) throw new errors_index.NoResultFound();
|
|
2282
|
-
if (items.length > 1) throw new errors_index.MultipleResultsFound();
|
|
2283
|
-
|
|
2284
|
-
const [item] = items;
|
|
2285
|
-
const model = getModelFromPath(this.path, item);
|
|
2286
|
-
return model;
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
async first(queryParams = new this.QueryParams({})) {
|
|
2290
|
-
const { items } = await this.client.get({
|
|
2291
|
-
endpoint: `/${this.path}`,
|
|
2292
|
-
params: queryParams.toParams(),
|
|
2293
|
-
});
|
|
2294
|
-
|
|
2295
|
-
if (!items || !items[0]) return null;
|
|
2296
|
-
|
|
2297
|
-
const [item] = items;
|
|
2298
|
-
const model = getModelFromPath(this.path, item);
|
|
2299
|
-
return model;
|
|
2300
|
-
}
|
|
2301
|
-
|
|
2302
|
-
async count(queryParams = new this.QueryParams({})) {
|
|
2303
|
-
const qP = queryParams;
|
|
2304
|
-
qP.count = true;
|
|
2305
|
-
const { count } = await this.client.get({
|
|
2306
|
-
endpoint: `/${this.path}`,
|
|
2307
|
-
params: queryParams.toParams(),
|
|
2308
|
-
});
|
|
2309
|
-
return count || 0;
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
async *all(queryParams = new this.QueryParams({})) {
|
|
2313
|
-
let nextPageUri = `/${this.path}?${queryParams.toQueryString()}`;
|
|
2314
|
-
while (nextPageUri) {
|
|
2315
|
-
// eslint-disable-next-line no-await-in-loop
|
|
2316
|
-
const page = await this.client.get({ endpoint: nextPageUri });
|
|
2317
|
-
if (page.items) {
|
|
2318
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
2319
|
-
for (const item of page.items) {
|
|
2320
|
-
const model = getModelFromPath(this.path, item);
|
|
2321
|
-
yield model;
|
|
2322
|
-
}
|
|
2323
|
-
}
|
|
2324
|
-
nextPageUri = page.next_page_uri;
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
};
|
|
2328
|
-
|
|
2329
|
-
class AccountResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
2330
|
-
constructor(client) {
|
|
2331
|
-
super('accounts', vulnerableActivity.AccountQuery, client);
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
|
|
2335
|
-
class AlertResource extends mix(Resource).with(
|
|
2336
|
-
Creatable,
|
|
2337
|
-
Queryable,
|
|
2338
|
-
Retrievable,
|
|
2339
|
-
Updateable,
|
|
2340
|
-
) {
|
|
2341
|
-
constructor(client) {
|
|
2342
|
-
super('alerts', vulnerableActivity.AlertQuery, client);
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
async create(req) {
|
|
2346
|
-
const request = new walletTransactionRequest.AlertUpdateRequest(req);
|
|
2347
|
-
const alert = await this._create(request.toCleanObject());
|
|
2348
|
-
return alert;
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
async update(alertId, req) {
|
|
2352
|
-
const request = new walletTransactionRequest.AlertUpdateRequest(req);
|
|
2353
|
-
const alert = await this._update(alertId, request.toCleanObject());
|
|
2354
|
-
return alert;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
class ApiKeyResource extends mix(Resource).with(
|
|
2359
|
-
Creatable,
|
|
2360
|
-
Deactivable,
|
|
2361
|
-
Queryable,
|
|
2362
|
-
Retrievable,
|
|
2363
|
-
Updateable,
|
|
2364
|
-
) {
|
|
2365
|
-
constructor(client) {
|
|
2366
|
-
super('api_keys', vulnerableActivity.ApiKeyQuery, client);
|
|
2367
|
-
}
|
|
2368
|
-
|
|
2369
|
-
async create() {
|
|
2370
|
-
const apiKey = await this._create();
|
|
2371
|
-
return apiKey;
|
|
2372
|
-
}
|
|
2373
|
-
|
|
2374
|
-
async deactivate(apiKeyId, minutes = 0) {
|
|
2375
|
-
const apiKey = await this._deactivate(apiKeyId, { minutes });
|
|
2376
|
-
return apiKey;
|
|
2377
|
-
}
|
|
2378
|
-
|
|
2379
|
-
async update(apiKeyId, metadata, userId) {
|
|
2380
|
-
const request = new walletTransactionRequest.ApiKeyUpdateRequest(userId, metadata);
|
|
2381
|
-
const apiKey = await this._update(apiKeyId, request.toCleanObject());
|
|
2382
|
-
return apiKey;
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
class ArpcResource extends mix(Resource).with(Creatable) {
|
|
2387
|
-
constructor(client) {
|
|
2388
|
-
super('arpc', Object, client);
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
async create({
|
|
2392
|
-
number,
|
|
2393
|
-
arqc,
|
|
2394
|
-
arpcMethod,
|
|
2395
|
-
transactionData,
|
|
2396
|
-
responseCode,
|
|
2397
|
-
transactionCounter,
|
|
2398
|
-
panSequence,
|
|
2399
|
-
uniqueNumber,
|
|
2400
|
-
trackDataMethod,
|
|
2401
|
-
}) {
|
|
2402
|
-
const request = new walletTransactionRequest.ArpcRequest({
|
|
2403
|
-
number,
|
|
2404
|
-
arqc,
|
|
2405
|
-
arpcMethod,
|
|
2406
|
-
transactionData,
|
|
2407
|
-
responseCode,
|
|
2408
|
-
transactionCounter,
|
|
2409
|
-
panSequence,
|
|
2410
|
-
uniqueNumber,
|
|
2411
|
-
trackDataMethod,
|
|
2412
|
-
});
|
|
2413
|
-
const arpc = await this._create(request.toObject());
|
|
2414
|
-
return arpc;
|
|
2415
|
-
}
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
class BalanceEntryResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
2419
|
-
constructor(client) {
|
|
2420
|
-
super('balance_entries', vulnerableActivity.BalanceEntryQuery, client);
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
async relatedTransaction(relatedTransactionUri) {
|
|
2424
|
-
const resource = getResource(relatedTransactionUri);
|
|
2425
|
-
if (resource == null) return null;
|
|
2426
|
-
|
|
2427
|
-
const response = await this.client.get({
|
|
2428
|
-
endpoint: relatedTransactionUri,
|
|
2429
|
-
});
|
|
2430
|
-
return getModelFromPath(`${resource}`, response);
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
async fundingInstrument(fundingInstrumentUri) {
|
|
2434
|
-
const resource = getResource(fundingInstrumentUri);
|
|
2435
|
-
if (resource == null) return null;
|
|
2436
|
-
|
|
2437
|
-
const response = await this.client.get({
|
|
2438
|
-
endpoint: fundingInstrumentUri,
|
|
2439
|
-
});
|
|
2440
|
-
return getModelFromPath(`${resource}`, response);
|
|
2441
|
-
}
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2444
|
-
class BillPaymentResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
2445
|
-
constructor(client) {
|
|
2446
|
-
super('bill_payments', vulnerableActivity.BillPaymentQuery, client);
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
async serviceProvider(providerUri) {
|
|
2450
|
-
const resource = getResource(providerUri);
|
|
2451
|
-
if (resource == null) return null;
|
|
2452
|
-
|
|
2453
|
-
const response = await this.client.get({ endpoint: providerUri });
|
|
2454
|
-
return getModelFromPath(`${resource}`, response);
|
|
2455
|
-
}
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
class BridegAccountResource extends mix(Resource).with(
|
|
2459
|
-
Queryable,
|
|
2460
|
-
Updateable,
|
|
2461
|
-
Retrievable,
|
|
2462
|
-
) {
|
|
2463
|
-
constructor(client) {
|
|
2464
|
-
super('bridge/accounts', vulnerableActivity.BridgeAccountQuery, client);
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
async update({ userId = 'me', ...req }) {
|
|
2468
|
-
const request = new walletTransactionRequest.UserUpdateRequest(req);
|
|
2469
|
-
const account = await this._update(userId, request.toCleanObject());
|
|
2470
|
-
return account;
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
class BridgeBankAccountResource extends mix(Resource).with(
|
|
2475
|
-
Queryable,
|
|
2476
|
-
Retrievable,
|
|
2477
|
-
) {
|
|
2478
|
-
constructor(client) {
|
|
2479
|
-
super('bridge/bank_accounts', vulnerableActivity.BridgeBankAccountQuery, client);
|
|
2480
|
-
}
|
|
2481
|
-
}
|
|
2482
|
-
|
|
2483
|
-
class BridgeClabeResource extends mix(Resource).with(Queryable) {
|
|
2484
|
-
constructor(client) {
|
|
2485
|
-
super('bridge/clabes', vulnerableActivity.BridgeQuery, client);
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
class BridgeTransactionResource extends mix(Resource).with(
|
|
2490
|
-
Queryable,
|
|
2491
|
-
Retrievable,
|
|
2492
|
-
) {
|
|
2493
|
-
constructor(client) {
|
|
2494
|
-
super('bridge/transactions', vulnerableActivity.BridgeTransactionQuery, client);
|
|
2495
|
-
}
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
class CardActivationResource extends mix(Resource).with(Creatable) {
|
|
2499
|
-
constructor(client) {
|
|
2500
|
-
super('card_activations', Object, client);
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
async create({ number, expMonth, expYear, cvv2 }) {
|
|
2504
|
-
const request = new walletTransactionRequest.CardActivationRequest(number, expMonth, expYear, cvv2);
|
|
2505
|
-
const activation = await this._create(request.toCleanObject());
|
|
2506
|
-
return activation;
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
async card(cardUri) {
|
|
2510
|
-
if (!cardUri) return null;
|
|
2511
|
-
const response = await this.client.get({ endpoint: cardUri });
|
|
2512
|
-
return Card.fromObject(response);
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
class CardResource extends mix(Resource).with(
|
|
2517
|
-
Creatable,
|
|
2518
|
-
Deactivable,
|
|
2519
|
-
Queryable,
|
|
2520
|
-
Retrievable,
|
|
2521
|
-
Updateable,
|
|
2522
|
-
) {
|
|
2523
|
-
constructor(client) {
|
|
2524
|
-
super('cards', vulnerableActivity.CardsQuery, client);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
async create(userId, issuer, fundingType) {
|
|
2528
|
-
const request = new walletTransactionRequest.CardRequest(userId, issuer, fundingType);
|
|
2529
|
-
const card = await this._create(request.toCleanObject());
|
|
2530
|
-
return card;
|
|
2531
|
-
}
|
|
2532
|
-
|
|
2533
|
-
async deactivate(cardId) {
|
|
2534
|
-
const response = await this._deactivate(cardId);
|
|
2535
|
-
return response;
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
async update(cardId, status, pinBlock) {
|
|
2539
|
-
const request = new walletTransactionRequest.CardUpdateRequest(status, pinBlock);
|
|
2540
|
-
const card = await this._update(cardId, request.toCleanObject());
|
|
2541
|
-
return card;
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
class CardTransactionResource extends mix(Resource).with(
|
|
2546
|
-
Queryable,
|
|
2547
|
-
Retrievable,
|
|
2548
|
-
) {
|
|
2549
|
-
constructor(client) {
|
|
2550
|
-
super('card_transactions', vulnerableActivity.CardTransactionQuery, client);
|
|
2551
|
-
}
|
|
2552
|
-
|
|
2553
|
-
async relatedCard(relatedCardUri) {
|
|
2554
|
-
const resource = getResource(relatedCardUri);
|
|
2555
|
-
if (resource == null) return null;
|
|
2556
|
-
|
|
2557
|
-
const response = await this.client.get({
|
|
2558
|
-
endpoint: relatedCardUri,
|
|
2559
|
-
});
|
|
2560
|
-
return getModelFromPath(`${resource}`, response);
|
|
2561
|
-
}
|
|
1105
|
+
class CardTransactionResource extends Queryable(Retrievable(Resource)) {
|
|
1106
|
+
constructor(client) {
|
|
1107
|
+
super(client, 'card_transactions', CardTransaction.fromObject);
|
|
1108
|
+
}
|
|
1109
|
+
async relatedCard(relatedCardUri) {
|
|
1110
|
+
if (!relatedCardUri)
|
|
1111
|
+
return null;
|
|
1112
|
+
const response = await this.client.get({ endpoint: relatedCardUri });
|
|
1113
|
+
return Card.fromObject(response);
|
|
1114
|
+
}
|
|
2562
1115
|
}
|
|
1116
|
+
var CardTransactionResource$1 = CardTransactionResource;
|
|
2563
1117
|
|
|
2564
|
-
class CardValidationResource extends
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
pinAttemptsExceeded,
|
|
2578
|
-
}) {
|
|
2579
|
-
const request = new walletTransactionRequest.CardValidationRequest({
|
|
2580
|
-
cvv,
|
|
2581
|
-
cvv2,
|
|
2582
|
-
expMonth,
|
|
2583
|
-
expYear,
|
|
2584
|
-
icvv,
|
|
2585
|
-
number,
|
|
2586
|
-
pinBlock,
|
|
2587
|
-
pinAttemptsExceeded,
|
|
2588
|
-
});
|
|
2589
|
-
const validation = await this._create(request.toCleanObject());
|
|
2590
|
-
return validation;
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
async card(cardUri) {
|
|
2594
|
-
if (!cardUri) return null;
|
|
2595
|
-
const response = await this.client.get({ endpoint: cardUri });
|
|
2596
|
-
return Card.fromObject(response);
|
|
2597
|
-
}
|
|
1118
|
+
class CardValidationResource extends Creatable(Resource) {
|
|
1119
|
+
constructor(client) {
|
|
1120
|
+
super(client, 'card_validations', CardValidation.fromObject);
|
|
1121
|
+
}
|
|
1122
|
+
async create(req) {
|
|
1123
|
+
return this._create(walletTransactionRequest.CardValidationRequest.toCleanObject(req));
|
|
1124
|
+
}
|
|
1125
|
+
async card(cardUri) {
|
|
1126
|
+
if (!cardUri)
|
|
1127
|
+
return null;
|
|
1128
|
+
const response = await this.client.get({ endpoint: cardUri });
|
|
1129
|
+
return Card.fromObject(response);
|
|
1130
|
+
}
|
|
2598
1131
|
}
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
1132
|
+
var CardValidationResource$1 = CardValidationResource;
|
|
1133
|
+
|
|
1134
|
+
const RELATED_TRANSACTION_FACTORIES = {
|
|
1135
|
+
bill_payments: BillPayment.fromObject,
|
|
1136
|
+
'bridge/transactions': BridgeTransaction.fromObject,
|
|
1137
|
+
card_transactions: CardTransaction.fromObject,
|
|
1138
|
+
deposits: Deposit.fromObject,
|
|
1139
|
+
savings: Saving.fromObject,
|
|
1140
|
+
transfers: Transfer.fromObject,
|
|
1141
|
+
wallet_transactions: WalletTransaction.fromObject,
|
|
1142
|
+
whatsapp_transfers: WhatsAppTransfer.fromObject,
|
|
1143
|
+
};
|
|
1144
|
+
class CommissionResource extends Queryable(Retrievable(Resource)) {
|
|
1145
|
+
constructor(client) {
|
|
1146
|
+
super(client, 'commissions', Commission.fromObject);
|
|
1147
|
+
}
|
|
1148
|
+
async relatedTransaction(relatedTransactionUri) {
|
|
1149
|
+
const path = getResourcePath(relatedTransactionUri);
|
|
1150
|
+
if (!path)
|
|
1151
|
+
return null;
|
|
1152
|
+
const factory = RELATED_TRANSACTION_FACTORIES[path];
|
|
1153
|
+
if (!factory)
|
|
1154
|
+
return null;
|
|
1155
|
+
const response = await this.client.get({ endpoint: relatedTransactionUri });
|
|
1156
|
+
return factory(response);
|
|
1157
|
+
}
|
|
2612
1158
|
}
|
|
1159
|
+
var CommissionResource$1 = CommissionResource;
|
|
2613
1160
|
|
|
2614
|
-
class DepositResource extends
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
}
|
|
1161
|
+
class DepositResource extends Queryable(Retrievable(Resource)) {
|
|
1162
|
+
constructor(client) {
|
|
1163
|
+
super(client, 'deposits', Deposit.fromObject);
|
|
1164
|
+
}
|
|
1165
|
+
async source(sourceUri) {
|
|
1166
|
+
const response = await this.client.get({ endpoint: sourceUri });
|
|
1167
|
+
return Account.fromObject(response);
|
|
1168
|
+
}
|
|
2623
1169
|
}
|
|
1170
|
+
var DepositResource$1 = DepositResource;
|
|
2624
1171
|
|
|
2625
|
-
class FileResource extends
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
async upload(request) {
|
|
2636
|
-
const fileUpload = await this._upload(request);
|
|
2637
|
-
return fileUpload;
|
|
2638
|
-
}
|
|
1172
|
+
class FileResource extends Downlodable(Uploadable(Resource)) {
|
|
1173
|
+
constructor(client) {
|
|
1174
|
+
super(client, 'files', File.fromObject);
|
|
1175
|
+
}
|
|
1176
|
+
async download(id, { responseType } = {}) {
|
|
1177
|
+
return this._download(id, data.FileFormat.Any, responseType);
|
|
1178
|
+
}
|
|
1179
|
+
async upload(request) {
|
|
1180
|
+
return this._upload(walletTransactionRequest.FileUploadRequest.toObject(request));
|
|
1181
|
+
}
|
|
2639
1182
|
}
|
|
1183
|
+
var FileResource$1 = FileResource;
|
|
2640
1184
|
|
|
2641
|
-
class FraudFundsTransferResource extends
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
userId,
|
|
2649
|
-
amount,
|
|
2650
|
-
concepto,
|
|
2651
|
-
clabe,
|
|
2652
|
-
reason,
|
|
2653
|
-
bankCode,
|
|
2654
|
-
});
|
|
2655
|
-
const fraudFundsTransfer = await this._create(request.toObject());
|
|
2656
|
-
return fraudFundsTransfer;
|
|
2657
|
-
}
|
|
1185
|
+
class FraudFundsTransferResource extends Creatable(Resource) {
|
|
1186
|
+
constructor(client) {
|
|
1187
|
+
super(client, 'support/transfer_fraud_funds', FraudFundsTransfer.fromObject);
|
|
1188
|
+
}
|
|
1189
|
+
async create(req) {
|
|
1190
|
+
return this._create(walletTransactionRequest.FraudFundsTransferRequest.toObject(req));
|
|
1191
|
+
}
|
|
2658
1192
|
}
|
|
1193
|
+
var FraudFundsTransferResource$1 = FraudFundsTransferResource;
|
|
2659
1194
|
|
|
2660
|
-
class KYCValidationsResource extends
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
) {
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
async create(userId = 'me', force = false) {
|
|
2676
|
-
const request = new walletTransactionRequest.KYCValidationsRequest({
|
|
2677
|
-
force,
|
|
2678
|
-
userId,
|
|
2679
|
-
isBridge: this.isBridge,
|
|
2680
|
-
});
|
|
2681
|
-
const kycValidation = await this._create(request.toCleanObject());
|
|
2682
|
-
return kycValidation;
|
|
2683
|
-
}
|
|
2684
|
-
|
|
2685
|
-
async deactivate(kycValidationId) {
|
|
2686
|
-
const response = await this._deactivate(kycValidationId);
|
|
2687
|
-
return response;
|
|
2688
|
-
}
|
|
1195
|
+
class KYCValidationsResource extends Creatable(Deactivable(Queryable(Retrievable(Resource)))) {
|
|
1196
|
+
constructor(client, isBridge = false) {
|
|
1197
|
+
super(client, isBridge ? 'bridge/kyc_validations' : 'kyc_validations', KYCValidations.fromObject);
|
|
1198
|
+
this.isBridge = isBridge;
|
|
1199
|
+
}
|
|
1200
|
+
async create(userId = 'me', force = false) {
|
|
1201
|
+
return this._create(walletTransactionRequest.KYCValidationsRequest.toCleanObject({
|
|
1202
|
+
force,
|
|
1203
|
+
userId,
|
|
1204
|
+
isBridge: this.isBridge,
|
|
1205
|
+
}));
|
|
1206
|
+
}
|
|
1207
|
+
async deactivate(kycValidationId) {
|
|
1208
|
+
return this._deactivate(kycValidationId, {});
|
|
1209
|
+
}
|
|
2689
1210
|
}
|
|
1211
|
+
var KYCValidationsResource$1 = KYCValidationsResource;
|
|
2690
1212
|
|
|
2691
|
-
class LoginTokenResource extends
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
return loginToken;
|
|
2699
|
-
}
|
|
1213
|
+
class LoginTokenResource extends Creatable(Resource) {
|
|
1214
|
+
constructor(client) {
|
|
1215
|
+
super(client, 'login_tokens', LoginToken.fromObject);
|
|
1216
|
+
}
|
|
1217
|
+
async create() {
|
|
1218
|
+
return this._create({});
|
|
1219
|
+
}
|
|
2700
1220
|
}
|
|
1221
|
+
var LoginTokenResource$1 = LoginTokenResource;
|
|
2701
1222
|
|
|
2702
|
-
class PartnerResource extends
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
)
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
async create(req) {
|
|
2713
|
-
const request = new walletTransactionRequest.PartnerUserRequest(req);
|
|
2714
|
-
const partner = await this._create(request.toCleanObject());
|
|
2715
|
-
return partner;
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
async update(partnerId, req) {
|
|
2719
|
-
const request = new walletTransactionRequest.PartnerUserRequest(req);
|
|
2720
|
-
const partner = await this._update(partnerId, request.toCleanObject());
|
|
2721
|
-
return partner;
|
|
2722
|
-
}
|
|
1223
|
+
class PartnerResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1224
|
+
constructor(client) {
|
|
1225
|
+
super(client, 'partners', Partner.fromObject);
|
|
1226
|
+
}
|
|
1227
|
+
async create(req) {
|
|
1228
|
+
return this._create(walletTransactionRequest.PartnerUserRequest.toCleanObject(req));
|
|
1229
|
+
}
|
|
1230
|
+
async update(partnerId, req) {
|
|
1231
|
+
return this._update(partnerId, walletTransactionRequest.PartnerUserRequest.toCleanObject(req));
|
|
1232
|
+
}
|
|
2723
1233
|
}
|
|
1234
|
+
var PartnerResource$1 = PartnerResource;
|
|
2724
1235
|
|
|
2725
|
-
class PostalCodeResource extends
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
1236
|
+
class PostalCodeResource extends Queryable(Resource) {
|
|
1237
|
+
constructor(client) {
|
|
1238
|
+
super(client, 'postal_codes', PostalCode.fromObject);
|
|
1239
|
+
}
|
|
2729
1240
|
}
|
|
1241
|
+
var PostalCodeResource$1 = PostalCodeResource;
|
|
2730
1242
|
|
|
2731
1243
|
class ReportResource extends Resource {
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
try {
|
|
2743
|
-
headersInterceptor = this.client.addHeadersToRequest({
|
|
2744
|
-
Accept: 'text/xml',
|
|
2745
|
-
});
|
|
2746
|
-
configInterceptor = this.client.addConfigToRequest({
|
|
2747
|
-
responseType: 'arraybuffer',
|
|
2748
|
-
});
|
|
2749
|
-
|
|
2750
|
-
return await this.client.post({
|
|
2751
|
-
endpoint: `/${this.path}`,
|
|
2752
|
-
data: request.toCleanObject(),
|
|
2753
|
-
});
|
|
2754
|
-
} finally {
|
|
2755
|
-
if (headersInterceptor) headersInterceptor.eject();
|
|
2756
|
-
if (configInterceptor) configInterceptor.eject();
|
|
1244
|
+
constructor(client) {
|
|
1245
|
+
super(client, 'reports', (obj) => obj);
|
|
1246
|
+
}
|
|
1247
|
+
async generateXml({ committeeMeetingDate, }) {
|
|
1248
|
+
return this.client.post({
|
|
1249
|
+
endpoint: `/${this.path}`,
|
|
1250
|
+
data: walletTransactionRequest.ReportGenerateRequest.toCleanObject({ committeeMeetingDate }),
|
|
1251
|
+
headers: { Accept: 'text/xml' },
|
|
1252
|
+
responseType: 'arraybuffer',
|
|
1253
|
+
});
|
|
2757
1254
|
}
|
|
2758
|
-
}
|
|
2759
1255
|
}
|
|
1256
|
+
var ReportResource$1 = ReportResource;
|
|
2760
1257
|
|
|
2761
|
-
class SavingResource extends
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
const saving = await this._create(request.toObject());
|
|
2775
|
-
return saving;
|
|
2776
|
-
}
|
|
2777
|
-
|
|
2778
|
-
async deactivate(savingId) {
|
|
2779
|
-
const response = await this._deactivate(savingId);
|
|
2780
|
-
return response;
|
|
2781
|
-
}
|
|
2782
|
-
|
|
2783
|
-
async update(savingId, category, goalAmount, goalDate, name) {
|
|
2784
|
-
const request = new walletTransactionRequest.SavingRequest(category, goalAmount, goalDate, name);
|
|
2785
|
-
const saving = await this._update(savingId, request.toObject());
|
|
2786
|
-
return saving;
|
|
2787
|
-
}
|
|
1258
|
+
class SavingResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
1259
|
+
constructor(client) {
|
|
1260
|
+
super(client, 'savings', Saving.fromObject);
|
|
1261
|
+
}
|
|
1262
|
+
async create(category, goalAmount, goalDate, name) {
|
|
1263
|
+
return this._create(walletTransactionRequest.SavingRequest.toObject({ category, goalAmount, goalDate, name }));
|
|
1264
|
+
}
|
|
1265
|
+
async deactivate(savingId) {
|
|
1266
|
+
return this._deactivate(savingId, {});
|
|
1267
|
+
}
|
|
1268
|
+
async update(savingId, category, goalAmount, goalDate, name) {
|
|
1269
|
+
return this._update(savingId, walletTransactionRequest.SavingRequest.toObject({ category, goalAmount, goalDate, name }));
|
|
1270
|
+
}
|
|
2788
1271
|
}
|
|
1272
|
+
var SavingResource$1 = SavingResource;
|
|
2789
1273
|
|
|
2790
|
-
class ServiceProviderResource extends
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
constructor(client) {
|
|
2795
|
-
super('service_providers', vulnerableActivity.QueryParams, client);
|
|
2796
|
-
}
|
|
1274
|
+
class ServiceProviderResource extends Retrievable(Queryable(Resource)) {
|
|
1275
|
+
constructor(client) {
|
|
1276
|
+
super(client, 'service_providers', ServiceProvider.fromObject);
|
|
1277
|
+
}
|
|
2797
1278
|
}
|
|
1279
|
+
var ServiceProviderResource$1 = ServiceProviderResource;
|
|
2798
1280
|
|
|
2799
|
-
class SessionResource extends
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
type,
|
|
2814
|
-
userId,
|
|
2815
|
-
isBridge: this.isBridge,
|
|
2816
|
-
});
|
|
2817
|
-
const session = await this._create(req.toCleanObject());
|
|
2818
|
-
return session;
|
|
2819
|
-
}
|
|
1281
|
+
class SessionResource extends Creatable(Queryable(Retrievable(Resource))) {
|
|
1282
|
+
constructor(client, isBridge = false) {
|
|
1283
|
+
super(client, isBridge ? 'bridge/sessions' : 'sessions', Session.fromObject);
|
|
1284
|
+
this.isBridge = isBridge;
|
|
1285
|
+
}
|
|
1286
|
+
async create(userId, type, successUrl, failureUrl) {
|
|
1287
|
+
return this._create(walletTransactionRequest.SessionRequest.toCleanObject({
|
|
1288
|
+
...(failureUrl !== undefined ? { failureUrl } : {}),
|
|
1289
|
+
...(successUrl !== undefined ? { successUrl } : {}),
|
|
1290
|
+
type,
|
|
1291
|
+
userId,
|
|
1292
|
+
isBridge: this.isBridge,
|
|
1293
|
+
}));
|
|
1294
|
+
}
|
|
2820
1295
|
}
|
|
1296
|
+
var SessionResource$1 = SessionResource;
|
|
2821
1297
|
|
|
2822
|
-
class StatementResource extends
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
const [pdf, xml] = await Promise.all([
|
|
2842
|
-
this.pdf(statement.id),
|
|
2843
|
-
this.xml(statement.id),
|
|
2844
|
-
]);
|
|
2845
|
-
return { statement, pdf, xml };
|
|
2846
|
-
}
|
|
1298
|
+
class StatementResource extends Downlodable(Queryable(Resource)) {
|
|
1299
|
+
constructor(client) {
|
|
1300
|
+
super(client, 'statements', Statement.fromObject);
|
|
1301
|
+
}
|
|
1302
|
+
async pdf(id) {
|
|
1303
|
+
return this._download(id, data.FileFormat.Pdf);
|
|
1304
|
+
}
|
|
1305
|
+
async xml(id) {
|
|
1306
|
+
return this._download(id, data.FileFormat.Xml);
|
|
1307
|
+
}
|
|
1308
|
+
async downloadFiles({ userId, year, month, }) {
|
|
1309
|
+
vulnerableActivity.validateStatementQuery({ year, month });
|
|
1310
|
+
const statement = await this.one({ userId, year, month });
|
|
1311
|
+
const [pdf, xml] = await Promise.all([
|
|
1312
|
+
this.pdf(statement.id),
|
|
1313
|
+
this.xml(statement.id),
|
|
1314
|
+
]);
|
|
1315
|
+
return { statement, pdf, xml };
|
|
1316
|
+
}
|
|
2847
1317
|
}
|
|
1318
|
+
var StatementResource$1 = StatementResource;
|
|
2848
1319
|
|
|
2849
|
-
class TransferResource extends
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
endpoint: destinationUri,
|
|
2862
|
-
});
|
|
2863
|
-
return Account.fromObject(response);
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
async create({
|
|
2867
|
-
accountNumber,
|
|
2868
|
-
amount,
|
|
2869
|
-
descriptor,
|
|
2870
|
-
recipientName,
|
|
2871
|
-
idempotencyKey,
|
|
2872
|
-
}) {
|
|
2873
|
-
const key =
|
|
2874
|
-
idempotencyKey ||
|
|
2875
|
-
this.constructor._genIdempotencyKey(accountNumber, amount);
|
|
2876
|
-
const request = new walletTransactionRequest.TransferRequest(
|
|
2877
|
-
accountNumber,
|
|
2878
|
-
amount,
|
|
2879
|
-
descriptor,
|
|
2880
|
-
key,
|
|
2881
|
-
recipientName,
|
|
2882
|
-
);
|
|
2883
|
-
const transfer = await this._create(request.toCleanObject());
|
|
2884
|
-
return transfer;
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
async update(transferId, req) {
|
|
2888
|
-
const request = new walletTransactionRequest.TransferUpdateRequest(req);
|
|
2889
|
-
const transfer = await this._update(transferId, request.toCleanObject());
|
|
2890
|
-
return transfer;
|
|
2891
|
-
}
|
|
2892
|
-
|
|
2893
|
-
async createMany(requests) {
|
|
2894
|
-
if (!requests || !Array.isArray(requests) || !requests.length) return {};
|
|
2895
|
-
const transfers = { submitted: [], errors: [] };
|
|
2896
|
-
|
|
2897
|
-
await Promise.all(
|
|
2898
|
-
requests.map(
|
|
2899
|
-
async ({
|
|
2900
|
-
accountNumber,
|
|
2901
|
-
amount,
|
|
2902
|
-
descriptor,
|
|
2903
|
-
idempotencyKey,
|
|
2904
|
-
recipientName,
|
|
2905
|
-
}) => {
|
|
2906
|
-
const actualRequest = new walletTransactionRequest.TransferRequest(
|
|
1320
|
+
class TransferResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1321
|
+
constructor(client) {
|
|
1322
|
+
super(client, 'transfers', Transfer.fromObject);
|
|
1323
|
+
}
|
|
1324
|
+
async destination(destinationUri) {
|
|
1325
|
+
const response = await this.client.get({ endpoint: destinationUri });
|
|
1326
|
+
return Account.fromObject(response);
|
|
1327
|
+
}
|
|
1328
|
+
async create({ accountNumber, amount, descriptor, recipientName, idempotencyKey, }) {
|
|
1329
|
+
const key = idempotencyKey ??
|
|
1330
|
+
TransferResource._genIdempotencyKey(accountNumber, amount);
|
|
1331
|
+
return this._create(walletTransactionRequest.TransferRequest.toCleanObject({
|
|
2907
1332
|
accountNumber,
|
|
2908
1333
|
amount,
|
|
2909
1334
|
descriptor,
|
|
2910
|
-
idempotencyKey
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
return;
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
1335
|
+
idempotencyKey: key,
|
|
1336
|
+
...(recipientName !== undefined ? { recipientName } : {}),
|
|
1337
|
+
}));
|
|
1338
|
+
}
|
|
1339
|
+
async update(transferId, req) {
|
|
1340
|
+
return this._update(transferId, walletTransactionRequest.TransferUpdateRequest.toCleanObject(req));
|
|
1341
|
+
}
|
|
1342
|
+
async createMany(requests) {
|
|
1343
|
+
if (!requests || !Array.isArray(requests) || requests.length === 0) {
|
|
1344
|
+
return {};
|
|
1345
|
+
}
|
|
1346
|
+
const transfers = { submitted: [], errors: [] };
|
|
1347
|
+
await Promise.all(requests.map(async (req) => {
|
|
1348
|
+
const actualRequest = {
|
|
1349
|
+
...req,
|
|
1350
|
+
idempotencyKey: req.idempotencyKey ??
|
|
1351
|
+
TransferResource._genIdempotencyKey(req.accountNumber, req.amount),
|
|
1352
|
+
};
|
|
1353
|
+
try {
|
|
1354
|
+
const transfer = await this._create(walletTransactionRequest.TransferRequest.toCleanObject(actualRequest));
|
|
1355
|
+
transfers.submitted.push(transfer);
|
|
1356
|
+
}
|
|
1357
|
+
catch (error) {
|
|
1358
|
+
transfers.errors.push({ actualRequest, error });
|
|
1359
|
+
}
|
|
1360
|
+
}));
|
|
1361
|
+
return transfers;
|
|
1362
|
+
}
|
|
1363
|
+
static _genIdempotencyKey(accountNumber, amount) {
|
|
1364
|
+
const isoDate = data.dateToUTC(Date.now()).toISOString();
|
|
1365
|
+
/* v8 ignore next */
|
|
1366
|
+
const date = isoDate.split('T')[0] ?? '';
|
|
1367
|
+
return `${date}:${accountNumber}:${amount}`;
|
|
1368
|
+
}
|
|
2933
1369
|
}
|
|
1370
|
+
var TransferResource$1 = TransferResource;
|
|
2934
1371
|
|
|
2935
|
-
class UserCredentialResource extends
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
const credential = await this._update(userId, request.toCleanObject());
|
|
2949
|
-
return credential;
|
|
2950
|
-
}
|
|
1372
|
+
class UserCredentialResource extends Creatable(Updateable(Resource)) {
|
|
1373
|
+
constructor(client) {
|
|
1374
|
+
super(client, 'user_credentials', UserCredential.fromObject);
|
|
1375
|
+
}
|
|
1376
|
+
async create(password) {
|
|
1377
|
+
return this._create(walletTransactionRequest.UserCredentialRequest.toObject({ password }));
|
|
1378
|
+
}
|
|
1379
|
+
async update({ isActive, password, userId = 'me', }) {
|
|
1380
|
+
return this._update(userId, walletTransactionRequest.UserCredentialUpdateRequest.toCleanObject({
|
|
1381
|
+
...(password !== undefined ? { password } : {}),
|
|
1382
|
+
...(isActive !== undefined ? { isActive } : {}),
|
|
1383
|
+
}));
|
|
1384
|
+
}
|
|
2951
1385
|
}
|
|
1386
|
+
var UserCredentialResource$1 = UserCredentialResource;
|
|
2952
1387
|
|
|
2953
|
-
class UserLoginResource extends
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
await this._deactivate(userId, {});
|
|
2974
|
-
|
|
2975
|
-
// Remove current login id from headers
|
|
2976
|
-
this.loginIdInHeaders && this.loginIdInHeaders.eject();
|
|
2977
|
-
|
|
2978
|
-
return true;
|
|
2979
|
-
}
|
|
1388
|
+
class UserLoginResource extends Creatable(Deactivable(Resource)) {
|
|
1389
|
+
constructor(client) {
|
|
1390
|
+
super(client, 'user_logins', UserLogin.fromObject);
|
|
1391
|
+
this.loginIdInHeaders = null;
|
|
1392
|
+
}
|
|
1393
|
+
async create(password, userId) {
|
|
1394
|
+
const userLogin = await this._create(walletTransactionRequest.UserLoginRequest.toObject({ password, userId }));
|
|
1395
|
+
if (!userLogin.success)
|
|
1396
|
+
throw new errors_index.InvalidPassword();
|
|
1397
|
+
this.loginIdInHeaders = this.client.addHeadersToRequest({
|
|
1398
|
+
'X-Cuenca-LoginId': userLogin.id,
|
|
1399
|
+
});
|
|
1400
|
+
return userLogin;
|
|
1401
|
+
}
|
|
1402
|
+
async logOut(userId = 'me') {
|
|
1403
|
+
await this._deactivate(userId, {});
|
|
1404
|
+
if (this.loginIdInHeaders)
|
|
1405
|
+
this.loginIdInHeaders.eject();
|
|
1406
|
+
return true;
|
|
1407
|
+
}
|
|
2980
1408
|
}
|
|
1409
|
+
var UserLoginResource$1 = UserLoginResource;
|
|
2981
1410
|
|
|
2982
|
-
class
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
)
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
async update({ userId = 'me', ...req }) {
|
|
2993
|
-
const request = new walletTransactionRequest.UserUpdateRequest(req);
|
|
2994
|
-
const user = await this._update(userId, request.toCleanObject());
|
|
2995
|
-
return user;
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
async deactivate(userId) {
|
|
2999
|
-
const response = await this._deactivate(userId);
|
|
3000
|
-
return response;
|
|
3001
|
-
}
|
|
1411
|
+
class UserResource extends Deactivable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1412
|
+
constructor(client) {
|
|
1413
|
+
super(client, 'users', User.fromObject);
|
|
1414
|
+
}
|
|
1415
|
+
async update({ userId = 'me', ...req }) {
|
|
1416
|
+
return this._update(userId, walletTransactionRequest.UserUpdateRequest.toCleanObject(req));
|
|
1417
|
+
}
|
|
1418
|
+
async deactivate(userId) {
|
|
1419
|
+
return this._deactivate(userId, {});
|
|
1420
|
+
}
|
|
3002
1421
|
}
|
|
1422
|
+
var UserResource$1 = UserResource;
|
|
3003
1423
|
|
|
3004
|
-
class UserReportResource extends
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
)
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
async create({ committeeMeetingDate, userId }) {
|
|
3015
|
-
const request = new walletTransactionRequest.UserReportCreateRequest({
|
|
3016
|
-
committeeMeetingDate,
|
|
3017
|
-
userId,
|
|
3018
|
-
});
|
|
3019
|
-
return this._create(request.toCleanObject());
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
async update(userReportId, req) {
|
|
3023
|
-
const request = new walletTransactionRequest.UserReportUpdateRequest(req);
|
|
3024
|
-
return this._update(userReportId, request.toCleanObject());
|
|
3025
|
-
}
|
|
1424
|
+
class UserReportResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1425
|
+
constructor(client) {
|
|
1426
|
+
super(client, 'user_reports', UserReport.fromObject);
|
|
1427
|
+
}
|
|
1428
|
+
async create(req) {
|
|
1429
|
+
return this._create(walletTransactionRequest.UserReportCreateRequest.toCleanObject(req));
|
|
1430
|
+
}
|
|
1431
|
+
async update(userReportId, req) {
|
|
1432
|
+
return this._update(userReportId, walletTransactionRequest.UserReportUpdateRequest.toCleanObject(req));
|
|
1433
|
+
}
|
|
3026
1434
|
}
|
|
1435
|
+
var UserReportResource$1 = UserReportResource;
|
|
3027
1436
|
|
|
3028
|
-
class UsersTosAgreementsResource extends
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
1437
|
+
class UsersTosAgreementsResource extends Retrievable(Resource) {
|
|
1438
|
+
constructor(client) {
|
|
1439
|
+
super(client, 'users_tos_agreements', UserTosAgreement.fromObject);
|
|
1440
|
+
}
|
|
3032
1441
|
}
|
|
1442
|
+
var UsersTosAgreementsResource$1 = UsersTosAgreementsResource;
|
|
3033
1443
|
|
|
3034
|
-
class
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
async update({ code, id }) {
|
|
3046
|
-
const request = new walletTransactionRequest.VerificationAttemptRequest({ code });
|
|
3047
|
-
const verification = await this._update(id, request.toObject());
|
|
3048
|
-
return verification;
|
|
3049
|
-
}
|
|
1444
|
+
class VerificationResource extends Creatable(Updateable(Resource)) {
|
|
1445
|
+
constructor(client) {
|
|
1446
|
+
super(client, 'verifications', Verification.fromObject);
|
|
1447
|
+
}
|
|
1448
|
+
async create(req) {
|
|
1449
|
+
return this._create(walletTransactionRequest.VerificationRequest.toObject(req));
|
|
1450
|
+
}
|
|
1451
|
+
async update({ code, id, }) {
|
|
1452
|
+
return this._update(id, walletTransactionRequest.VerificationAttemptRequest.toObject({ code }));
|
|
1453
|
+
}
|
|
3050
1454
|
}
|
|
1455
|
+
var VerificationResource$1 = VerificationResource;
|
|
3051
1456
|
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
) {
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
)
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
return getModelFromPath(`${resource}`, response);
|
|
3077
|
-
}
|
|
1457
|
+
const WALLET_FACTORIES = {
|
|
1458
|
+
savings: Saving.fromObject,
|
|
1459
|
+
};
|
|
1460
|
+
class WalletTransactionsResource extends Creatable(Queryable(Retrievable(Resource))) {
|
|
1461
|
+
constructor(client) {
|
|
1462
|
+
super(client, 'wallet_transactions', WalletTransaction.fromObject);
|
|
1463
|
+
}
|
|
1464
|
+
async create(amount, transactionType, walletUri) {
|
|
1465
|
+
return this._create(walletTransactionRequest.WalletTransactionRequest.toObject({ amount, transactionType, walletUri }));
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* @deprecated Method name has a typo. Retained for API compatibility.
|
|
1469
|
+
* A properly-named alias (`relatedWallet`) will be introduced in v2. See cuenca-js#59.
|
|
1470
|
+
*/
|
|
1471
|
+
async realtedWallet(walletUri) {
|
|
1472
|
+
const path = getResourcePath(walletUri);
|
|
1473
|
+
if (!path)
|
|
1474
|
+
return null;
|
|
1475
|
+
const factory = WALLET_FACTORIES[path];
|
|
1476
|
+
if (!factory)
|
|
1477
|
+
return null;
|
|
1478
|
+
const response = await this.client.get({ endpoint: walletUri });
|
|
1479
|
+
return factory(response);
|
|
1480
|
+
}
|
|
3078
1481
|
}
|
|
1482
|
+
var WalletTransactionsResource$1 = WalletTransactionsResource;
|
|
3079
1483
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
1484
|
+
const ACCOUNT_FACTORIES = {
|
|
1485
|
+
accounts: Account.fromObject,
|
|
1486
|
+
'bridge/accounts': BridgeAccount.fromObject,
|
|
1487
|
+
};
|
|
1488
|
+
class WhatsAppTransferResource extends Queryable(Retrievable(Resource)) {
|
|
1489
|
+
constructor(client) {
|
|
1490
|
+
super(client, 'whatsapp_transfers', WhatsAppTransfer.fromObject);
|
|
1491
|
+
}
|
|
1492
|
+
async accountDestination(destinationUri) {
|
|
1493
|
+
const path = getResourcePath(destinationUri);
|
|
1494
|
+
if (!path)
|
|
1495
|
+
return null;
|
|
1496
|
+
const factory = ACCOUNT_FACTORIES[path];
|
|
1497
|
+
if (!factory)
|
|
1498
|
+
return null;
|
|
1499
|
+
const response = await this.client.get({ endpoint: destinationUri });
|
|
1500
|
+
return factory(response);
|
|
1501
|
+
}
|
|
3095
1502
|
}
|
|
1503
|
+
var WhatsAppTransferResource$1 = WhatsAppTransferResource;
|
|
3096
1504
|
|
|
3097
1505
|
class Cuenca {
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
1506
|
+
constructor({ apiKey, apiSecret, language = 'en', phase = data.Phase.Sandbox, } = {}) {
|
|
1507
|
+
// Client type comes from src/client/client.d.ts, a declaration for the
|
|
1508
|
+
// plain-JS class in src/client/client.js. Delete both when the client
|
|
1509
|
+
// migrates to TypeScript (see cuenca-js#66).
|
|
1510
|
+
this.client = new Client({
|
|
1511
|
+
apiKey,
|
|
1512
|
+
apiSecret,
|
|
1513
|
+
language,
|
|
1514
|
+
phase,
|
|
1515
|
+
});
|
|
1516
|
+
this.withClient(this.client);
|
|
1517
|
+
}
|
|
1518
|
+
withClient(client) {
|
|
1519
|
+
this.accounts = new AccountResource$1(client);
|
|
1520
|
+
this.alerts = new AlertResource$1(client);
|
|
1521
|
+
this.apiKeys = new ApiKeyResource$1(client);
|
|
1522
|
+
this.arpc = new ArpcResource$1(client);
|
|
1523
|
+
this.balanceEntries = new BalanceEntryResource$1(client);
|
|
1524
|
+
this.billPayments = new BillPaymentResource$1(client);
|
|
1525
|
+
this.bridgeAccounts = new BridgeAccountResource$1(client);
|
|
1526
|
+
this.bridgeBankAccounts = new BridgeBankAccountResource$1(client);
|
|
1527
|
+
this.bridgeClabes = new BridgeClabeResource$1(client);
|
|
1528
|
+
this.bridgeKycValidations = new KYCValidationsResource$1(client, true);
|
|
1529
|
+
this.bridgeSessions = new SessionResource$1(client, true);
|
|
1530
|
+
this.bridgeTransactions = new BridgeTransactionResource$1(client);
|
|
1531
|
+
this.cardActivations = new CardActivationResource$1(client);
|
|
1532
|
+
this.cards = new CardResource$1(client);
|
|
1533
|
+
this.cardTransactions = new CardTransactionResource$1(client);
|
|
1534
|
+
this.cardValidations = new CardValidationResource$1(client);
|
|
1535
|
+
this.commissions = new CommissionResource$1(client);
|
|
1536
|
+
this.deposits = new DepositResource$1(client);
|
|
1537
|
+
this.files = new FileResource$1(client);
|
|
1538
|
+
this.fraudFundsTransfers = new FraudFundsTransferResource$1(client);
|
|
1539
|
+
this.kycValidations = new KYCValidationsResource$1(client);
|
|
1540
|
+
this.loginTokens = new LoginTokenResource$1(client);
|
|
1541
|
+
this.partners = new PartnerResource$1(client);
|
|
1542
|
+
this.postalCodes = new PostalCodeResource$1(client);
|
|
1543
|
+
this.reports = new ReportResource$1(client);
|
|
1544
|
+
this.savings = new SavingResource$1(client);
|
|
1545
|
+
this.serviceProviders = new ServiceProviderResource$1(client);
|
|
1546
|
+
this.sessions = new SessionResource$1(client);
|
|
1547
|
+
this.statements = new StatementResource$1(client);
|
|
1548
|
+
this.transfers = new TransferResource$1(client);
|
|
1549
|
+
this.userCredentials = new UserCredentialResource$1(client);
|
|
1550
|
+
this.userLogins = new UserLoginResource$1(client);
|
|
1551
|
+
this.users = new UserResource$1(client);
|
|
1552
|
+
this.userReports = new UserReportResource$1(client);
|
|
1553
|
+
this.usersTosAgreements = new UsersTosAgreementsResource$1(client);
|
|
1554
|
+
this.verifications = new VerificationResource$1(client);
|
|
1555
|
+
this.walletTransactions = new WalletTransactionsResource$1(client);
|
|
1556
|
+
this.whatsAppTransfers = new WhatsAppTransferResource$1(client);
|
|
1557
|
+
}
|
|
3147
1558
|
}
|
|
3148
1559
|
|
|
3149
1560
|
exports.Cuenca = Cuenca;
|