@cuenca-mx/cuenca-js 1.2.2 → 2.0.0-dev1
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-2b32d8f3.mjs +634 -0
- package/build/data-70e6af8d.cjs +680 -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 +55 -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 +41 -0
- package/build/dts/models/kycValidations.d.ts +22 -0
- package/build/dts/models/legalPerson.d.ts +10 -0
- package/build/dts/models/loginToken.d.ts +7 -0
- package/build/dts/models/operator.d.ts +17 -0
- package/build/dts/models/operatorLogin.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 +28 -0
- package/build/dts/requests/kycValidationsRequest.d.ts +10 -0
- package/build/dts/requests/legalPersonRequest.d.ts +33 -0
- package/build/dts/requests/operatorLoginRequest.d.ts +9 -0
- package/build/dts/requests/operatorRequest.d.ts +24 -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 +39 -0
- package/build/dts/resources/kycValidations.d.ts +53 -0
- package/build/dts/resources/legalPersons.d.ts +54 -0
- package/build/dts/resources/loginTokens.d.ts +17 -0
- package/build/dts/resources/operatorLogins.d.ts +19 -0
- package/build/dts/resources/operators.d.ts +54 -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 +590 -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 +27 -0
- package/build/dts/types/queries/operatorQuery.d.ts +4 -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 +1373 -2885
- package/build/index.mjs +1375 -2886
- package/build/jwt/index.cjs +11 -8
- package/build/jwt/index.mjs +11 -8
- package/build/requests/index.cjs +9 -22
- package/build/requests/index.mjs +2 -26
- package/build/types/index.cjs +20 -56
- package/build/types/index.mjs +9 -34
- package/build/umd/cuenca.umd.js +1 -1
- package/build/vulnerableActivity-17f0ce66.mjs +278 -0
- package/build/vulnerableActivity-3cb7b0ed.cjs +299 -0
- package/build/walletTransactionRequest-7f10c2a2.mjs +496 -0
- package/build/walletTransactionRequest-dd13c569.cjs +529 -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-70e6af8d.cjs');
|
|
9
|
+
var vulnerableActivity = require('./vulnerableActivity-3cb7b0ed.cjs');
|
|
10
|
+
var walletTransactionRequest = require('./walletTransactionRequest-dd13c569.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-dev1";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,1287 @@ 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 BaseUser = {
|
|
534
|
+
fromObject: (obj) => {
|
|
535
|
+
const camelized = data.camelize(obj);
|
|
536
|
+
return data.coerceDatesWithDefaults({
|
|
537
|
+
...camelized,
|
|
538
|
+
address: obj.address
|
|
539
|
+
? vulnerableActivity.Address.fromObject(obj.address)
|
|
540
|
+
: undefined,
|
|
541
|
+
}, ['createdAt', 'updatedAt']);
|
|
542
|
+
},
|
|
543
|
+
};
|
|
559
544
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
545
|
+
const LegalPerson = {
|
|
546
|
+
fromObject: (obj) => {
|
|
547
|
+
const base = BaseUser.fromObject(obj);
|
|
548
|
+
const camelized = data.camelize(obj);
|
|
549
|
+
return data.coerceDatesWithDefaults({
|
|
550
|
+
...camelized,
|
|
551
|
+
...base,
|
|
552
|
+
legalRepresentatives: obj.legal_representatives
|
|
553
|
+
? obj.legal_representatives.map(vulnerableActivity.LegalRepresentatives.fromObject)
|
|
554
|
+
: undefined,
|
|
555
|
+
}, ['createdAt', 'updatedAt']);
|
|
556
|
+
},
|
|
557
|
+
};
|
|
563
558
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
559
|
+
const LoginToken = {
|
|
560
|
+
fromObject: (obj) => ({
|
|
561
|
+
id: obj.id,
|
|
562
|
+
}),
|
|
563
|
+
};
|
|
568
564
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
565
|
+
const Operator = {
|
|
566
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
567
|
+
'createdAt',
|
|
568
|
+
'updatedAt',
|
|
569
|
+
]),
|
|
570
|
+
};
|
|
572
571
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
}
|
|
572
|
+
const OperatorLogin = {
|
|
573
|
+
fromObject: (obj) => data.camelize(obj),
|
|
574
|
+
};
|
|
577
575
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
576
|
+
const TransactionalProfile = {
|
|
577
|
+
fromObject: (obj) => {
|
|
578
|
+
const camelized = data.camelize(obj);
|
|
579
|
+
return {
|
|
580
|
+
...camelized,
|
|
581
|
+
deposits: obj.deposits
|
|
582
|
+
? vulnerableActivity.TransactionalProfileServices.fromObject(obj.deposits)
|
|
583
|
+
: undefined,
|
|
584
|
+
withdrawal: obj.withdrawal
|
|
585
|
+
? vulnerableActivity.TransactionalProfileServices.fromObject(obj.withdrawal)
|
|
586
|
+
: undefined,
|
|
587
|
+
};
|
|
588
|
+
},
|
|
589
|
+
};
|
|
581
590
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
591
|
+
const toLegalRepresentatives = (obj) => {
|
|
592
|
+
const value = obj.legal_representatives;
|
|
593
|
+
return value ? value.map(vulnerableActivity.LegalRepresentatives.fromObject) : undefined;
|
|
594
|
+
};
|
|
595
|
+
const toTransactionalProfile = (obj) => {
|
|
596
|
+
const value = obj.transactional_profile;
|
|
597
|
+
return value ? TransactionalProfile.fromObject(value) : undefined;
|
|
598
|
+
};
|
|
599
|
+
const Partner = {
|
|
600
|
+
fromObject: (obj) => {
|
|
601
|
+
const base = BaseUser.fromObject(obj);
|
|
602
|
+
const camelized = data.camelize(obj);
|
|
603
|
+
return data.coerceDatesWithDefaults({
|
|
604
|
+
...camelized,
|
|
605
|
+
...base,
|
|
606
|
+
audit: obj.audit
|
|
607
|
+
? vulnerableActivity.Audit.fromObject(obj.audit)
|
|
608
|
+
: undefined,
|
|
609
|
+
businessDetails: obj.business_details
|
|
610
|
+
? vulnerableActivity.BusinessDetails.fromObject(obj.business_details)
|
|
611
|
+
: undefined,
|
|
612
|
+
externalAccount: obj.external_account
|
|
613
|
+
? vulnerableActivity.ExternalAccount.fromObject(obj.external_account)
|
|
614
|
+
: undefined,
|
|
615
|
+
license: obj.license
|
|
616
|
+
? vulnerableActivity.License.fromObject(obj.license)
|
|
617
|
+
: undefined,
|
|
618
|
+
shareholders: obj.shareholders
|
|
619
|
+
? obj.shareholders.map(vulnerableActivity.ShareholderMoral.fromObject)
|
|
620
|
+
: undefined,
|
|
621
|
+
legalRepresentatives: toLegalRepresentatives(obj),
|
|
622
|
+
transactionalProfile: toTransactionalProfile(obj),
|
|
623
|
+
vulnerableActivity: obj.vulnerable_activity
|
|
624
|
+
? vulnerableActivity.VulnerableActivity.fromObject(obj.vulnerable_activity)
|
|
625
|
+
: undefined,
|
|
626
|
+
}, ['incorporationDate']);
|
|
627
|
+
},
|
|
628
|
+
};
|
|
587
629
|
|
|
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
|
-
}
|
|
630
|
+
const PostalCode = {
|
|
631
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
632
|
+
'createdAt',
|
|
633
|
+
'updatedAt',
|
|
634
|
+
]),
|
|
635
|
+
};
|
|
612
636
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
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
|
-
}
|
|
637
|
+
const Saving = {
|
|
638
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
639
|
+
'createdAt',
|
|
640
|
+
'deactivatedAt',
|
|
641
|
+
'goalDate',
|
|
642
|
+
'updatedAt',
|
|
643
|
+
]),
|
|
644
|
+
};
|
|
636
645
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
+
const ServiceProvider = {
|
|
647
|
+
fromObject: (obj) => {
|
|
648
|
+
const camelized = data.camelize(obj);
|
|
649
|
+
return {
|
|
650
|
+
...camelized,
|
|
651
|
+
categories: camelized.categories == null ? [] : camelized.categories,
|
|
652
|
+
};
|
|
653
|
+
},
|
|
654
|
+
};
|
|
646
655
|
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
account: obj.account_uri.split('/')[2],
|
|
654
|
-
platformId: obj.platform_id,
|
|
655
|
-
});
|
|
656
|
-
}
|
|
656
|
+
const Session = {
|
|
657
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
658
|
+
'createdAt',
|
|
659
|
+
'expiresAt',
|
|
660
|
+
]),
|
|
661
|
+
};
|
|
657
662
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
type,
|
|
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
|
-
}
|
|
663
|
+
const Statement = {
|
|
664
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
665
|
+
'createdAt',
|
|
666
|
+
]),
|
|
667
|
+
};
|
|
714
668
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
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
|
-
}
|
|
669
|
+
const Transfer = {
|
|
670
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
671
|
+
'createdAt',
|
|
672
|
+
'updatedAt',
|
|
673
|
+
]),
|
|
674
|
+
};
|
|
753
675
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
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
|
-
}
|
|
676
|
+
const wrapKycFile = (value) => value ? vulnerableActivity.KYCFile.fromObject(value) : undefined;
|
|
677
|
+
const User = {
|
|
678
|
+
fromObject: (obj) => {
|
|
679
|
+
const camelized = data.camelize(obj);
|
|
680
|
+
return data.coerceDatesWithDefaults({
|
|
681
|
+
...camelized,
|
|
682
|
+
address: obj.address
|
|
683
|
+
? vulnerableActivity.Address.fromObject(obj.address)
|
|
684
|
+
: undefined,
|
|
685
|
+
govtId: wrapKycFile(obj.govt_id),
|
|
686
|
+
proofOfAddress: wrapKycFile(obj.proof_of_address),
|
|
687
|
+
proofOfLife: wrapKycFile(obj.proof_of_life),
|
|
688
|
+
curpDocument: wrapKycFile(obj.curp_document),
|
|
689
|
+
termsOfService: obj.terms_of_service
|
|
690
|
+
? vulnerableActivity.TOSAgreements.fromObject(obj.terms_of_service)
|
|
691
|
+
: undefined,
|
|
692
|
+
}, ['createdAt', 'updatedAt']);
|
|
693
|
+
},
|
|
694
|
+
};
|
|
784
695
|
|
|
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
|
-
}
|
|
696
|
+
const UserCredential = {
|
|
697
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
698
|
+
'createdAt',
|
|
699
|
+
'updatedAt',
|
|
700
|
+
]),
|
|
701
|
+
};
|
|
811
702
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
this.ipAddress = ipAddress;
|
|
818
|
-
this.success = success;
|
|
819
|
-
this.userId = userId;
|
|
820
|
-
}
|
|
703
|
+
const UserLogin = {
|
|
704
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
705
|
+
'lastLoginAt',
|
|
706
|
+
]),
|
|
707
|
+
};
|
|
821
708
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
success,
|
|
826
|
-
cardUri: obj.card_uri,
|
|
827
|
-
createdAt: obj.created_at,
|
|
828
|
-
ipAddress: obj.ip_address,
|
|
829
|
-
userId: obj.user_id,
|
|
830
|
-
});
|
|
831
|
-
}
|
|
709
|
+
const UserReport = {
|
|
710
|
+
fromObject: (obj) => data.camelize(obj),
|
|
711
|
+
};
|
|
832
712
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
cardUri,
|
|
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
|
-
}
|
|
713
|
+
const UserTosAgreement = {
|
|
714
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
715
|
+
'createdAt',
|
|
716
|
+
'updatedAt',
|
|
717
|
+
]),
|
|
718
|
+
};
|
|
865
719
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
type,
|
|
873
|
-
...obj
|
|
874
|
-
}) =>
|
|
875
|
-
new CardTransaction({
|
|
876
|
-
amount,
|
|
877
|
-
descriptor,
|
|
878
|
-
metadata,
|
|
879
|
-
network,
|
|
880
|
-
status,
|
|
881
|
-
type,
|
|
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
|
-
});
|
|
890
|
-
}
|
|
720
|
+
const Verification = {
|
|
721
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
722
|
+
'createdAt',
|
|
723
|
+
'updatedAt',
|
|
724
|
+
]),
|
|
725
|
+
};
|
|
891
726
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
createdAt,
|
|
898
|
-
isExpired,
|
|
899
|
-
isPinAttemptsExceeded,
|
|
900
|
-
isValidCvv,
|
|
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
|
-
}
|
|
727
|
+
const WalletTransaction = {
|
|
728
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
729
|
+
'createdAt',
|
|
730
|
+
]),
|
|
731
|
+
};
|
|
920
732
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
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
|
-
});
|
|
733
|
+
const WhatsAppTransfer = {
|
|
734
|
+
fromObject: (obj) => data.coerceDatesWithDefaults(data.camelize(obj), [
|
|
735
|
+
'createdAt',
|
|
736
|
+
'expiresAt',
|
|
737
|
+
'updatedAt',
|
|
738
|
+
]),
|
|
739
|
+
};
|
|
936
740
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
741
|
+
const encodeCursor = (uri) => Buffer.Buffer.from(uri, 'utf8').toString('base64url');
|
|
742
|
+
const decodeCursor = (cursor) => Buffer.Buffer.from(cursor, 'base64url').toString('utf8');
|
|
743
|
+
class Resource {
|
|
744
|
+
constructor(client, path, fromObject) {
|
|
745
|
+
this.client = client;
|
|
746
|
+
this.path = path;
|
|
747
|
+
this.fromObject = fromObject;
|
|
748
|
+
}
|
|
749
|
+
// eslint-disable-next-line class-methods-use-this
|
|
750
|
+
toParams(query) {
|
|
751
|
+
return vulnerableActivity.toParams(query);
|
|
752
|
+
}
|
|
753
|
+
// eslint-disable-next-line class-methods-use-this
|
|
754
|
+
toQueryString(query) {
|
|
755
|
+
return vulnerableActivity.toQueryString(query);
|
|
756
|
+
}
|
|
940
757
|
}
|
|
941
|
-
|
|
942
|
-
class
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
}) {
|
|
952
|
-
super({
|
|
953
|
-
amount,
|
|
954
|
-
createdAt,
|
|
955
|
-
descriptor,
|
|
956
|
-
status,
|
|
957
|
-
userId,
|
|
958
|
-
});
|
|
959
|
-
this.relatedTransactionUri = relatedTransactionUri;
|
|
960
|
-
this.type = data.enumValueFromString(data.CommissionType, type);
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
static fromObject = ({ amount, descriptor, status, type, ...obj }) =>
|
|
964
|
-
new Commission({
|
|
965
|
-
amount,
|
|
966
|
-
descriptor,
|
|
967
|
-
status,
|
|
968
|
-
type,
|
|
969
|
-
createdAt: obj.created_at,
|
|
970
|
-
relatedTransactionUri: obj.related_transaction_uri,
|
|
971
|
-
userId: obj.user_id,
|
|
972
|
-
});
|
|
758
|
+
function Retrievable(Base) {
|
|
759
|
+
return class extends Base {
|
|
760
|
+
async retrieve(id) {
|
|
761
|
+
const response = await this.client.get({
|
|
762
|
+
endpoint: `/${this.path}/${id}`,
|
|
763
|
+
});
|
|
764
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
765
|
+
return this.fromObject(response);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
973
768
|
}
|
|
974
|
-
|
|
975
|
-
class
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
769
|
+
function Creatable(Base) {
|
|
770
|
+
return class extends Base {
|
|
771
|
+
async _create(data) {
|
|
772
|
+
const response = await this.client.post({
|
|
773
|
+
endpoint: `/${this.path}`,
|
|
774
|
+
data,
|
|
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 Updateable(Base) {
|
|
782
|
+
return class extends Base {
|
|
783
|
+
async _update(id, data) {
|
|
784
|
+
const response = await this.client.patch({
|
|
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 Uploadable(Base) {
|
|
794
|
+
return class extends Base {
|
|
795
|
+
async _upload(data) {
|
|
796
|
+
const response = await this.client.post({
|
|
797
|
+
endpoint: `/${this.path}`,
|
|
798
|
+
data,
|
|
799
|
+
multipart: true,
|
|
800
|
+
});
|
|
801
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
802
|
+
return this.fromObject(response);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function Deactivable(Base) {
|
|
807
|
+
return class extends Base {
|
|
808
|
+
async _deactivate(id, data = {}) {
|
|
809
|
+
const response = await this.client.delete({
|
|
810
|
+
endpoint: `/${this.path}/${id}`,
|
|
811
|
+
data,
|
|
812
|
+
});
|
|
813
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
814
|
+
return this.fromObject(response);
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
function Downlodable(Base) {
|
|
819
|
+
return class extends Base {
|
|
820
|
+
async _download(id, format, responseType) {
|
|
821
|
+
const config = { endpoint: `/${this.path}/${id}` };
|
|
822
|
+
if (format !== undefined)
|
|
823
|
+
config.format = format;
|
|
824
|
+
if (responseType !== undefined)
|
|
825
|
+
config.responseType = responseType;
|
|
826
|
+
return this.client.get(config);
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
const MAX_PAGES = 10000;
|
|
831
|
+
function Queryable(Base) {
|
|
832
|
+
return class extends Base {
|
|
833
|
+
async one(query = {}) {
|
|
834
|
+
const { items } = (await this.client.get({
|
|
835
|
+
endpoint: `/${this.path}`,
|
|
836
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
837
|
+
params: this.toParams({
|
|
838
|
+
...query,
|
|
839
|
+
limit: 2,
|
|
840
|
+
}),
|
|
841
|
+
}));
|
|
842
|
+
if (!items || items.length === 0)
|
|
843
|
+
throw new errors_index.NoResultFound();
|
|
844
|
+
if (items.length > 1)
|
|
845
|
+
throw new errors_index.MultipleResultsFound();
|
|
846
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
847
|
+
return this.fromObject(items[0]);
|
|
848
|
+
}
|
|
849
|
+
async first(query = {}) {
|
|
850
|
+
const { items } = (await this.client.get({
|
|
851
|
+
endpoint: `/${this.path}`,
|
|
852
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
853
|
+
params: this.toParams({
|
|
854
|
+
...query,
|
|
855
|
+
limit: 1,
|
|
856
|
+
}),
|
|
857
|
+
}));
|
|
858
|
+
if (!items || items.length === 0)
|
|
859
|
+
return null;
|
|
860
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
861
|
+
return this.fromObject(items[0]);
|
|
862
|
+
}
|
|
863
|
+
async count(query = {}) {
|
|
864
|
+
const params = {
|
|
865
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toParams — currently downcast to QueryParams.
|
|
866
|
+
...this.toParams(query),
|
|
867
|
+
count: 1,
|
|
868
|
+
};
|
|
869
|
+
const { count } = (await this.client.get({
|
|
870
|
+
endpoint: `/${this.path}`,
|
|
871
|
+
params,
|
|
872
|
+
}));
|
|
873
|
+
return count ?? 0;
|
|
874
|
+
}
|
|
875
|
+
async page(query, cursor) {
|
|
876
|
+
// TODO(cuenca-js#64-followup): tighten generic bound to preserve Q through toQueryString — currently downcast to QueryParams.
|
|
877
|
+
const actualQuery = (query ?? {});
|
|
878
|
+
const normalized = cursor && cursor.length > 0 ? decodeCursor(cursor) : null;
|
|
879
|
+
const endpoint = normalized ?? `/${this.path}?${this.toQueryString(actualQuery)}`;
|
|
880
|
+
const response = (await this.client.get({ endpoint }));
|
|
881
|
+
// Cast justified: fromObject typing on Base narrows to M — TS can't prove it structurally.
|
|
882
|
+
const items = (response.items ?? []).map((item) => this.fromObject(item));
|
|
883
|
+
return {
|
|
884
|
+
items,
|
|
885
|
+
nextCursor: response.next_page_uri
|
|
886
|
+
? encodeCursor(response.next_page_uri)
|
|
887
|
+
: null,
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
async *all(query = {}) {
|
|
891
|
+
const seen = new Set();
|
|
892
|
+
let cursor;
|
|
893
|
+
let pageCount = 0;
|
|
894
|
+
while (true) {
|
|
895
|
+
/* v8 ignore next 5 */
|
|
896
|
+
if (pageCount >= MAX_PAGES) {
|
|
897
|
+
throw new errors_index.PaginationError(`Pagination exceeded ${MAX_PAGES} pages; aborting`);
|
|
898
|
+
}
|
|
899
|
+
pageCount += 1;
|
|
900
|
+
// eslint-disable-next-line no-await-in-loop
|
|
901
|
+
const { items, nextCursor } = await this.page(query, cursor);
|
|
902
|
+
if (nextCursor) {
|
|
903
|
+
if (nextCursor === cursor || seen.has(nextCursor)) {
|
|
904
|
+
throw new errors_index.PaginationError(`Repeated next_page_uri: ${nextCursor}`);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
908
|
+
for (const item of items)
|
|
909
|
+
yield item;
|
|
910
|
+
if (!nextCursor)
|
|
911
|
+
return;
|
|
912
|
+
seen.add(nextCursor);
|
|
913
|
+
cursor = nextCursor;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Extracts the top-level path segment(s) from a resource URI, supporting nested paths
|
|
920
|
+
* (e.g. `/bridge/accounts/AC123` → `bridge/accounts`).
|
|
921
|
+
*
|
|
922
|
+
* NOT supported: sub-resource URIs like `/accounts/AC1/refund` — these return
|
|
923
|
+
* `accounts/AC1` which is not a valid resource key. If the API introduces
|
|
924
|
+
* sub-resources, extend this helper.
|
|
925
|
+
*/
|
|
926
|
+
function getResourcePath(uri) {
|
|
927
|
+
if (!uri)
|
|
928
|
+
return null;
|
|
929
|
+
const match = uri.match(/^\/([^?]+)\/[^/?]+(?:\?.*)?$/);
|
|
930
|
+
if (!match)
|
|
931
|
+
return null;
|
|
932
|
+
return match[1];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
class AccountResource extends Retrievable(Queryable(Resource)) {
|
|
936
|
+
constructor(client) {
|
|
937
|
+
super(client, 'accounts', Account.fromObject);
|
|
938
|
+
}
|
|
1012
939
|
}
|
|
940
|
+
var AccountResource$1 = AccountResource;
|
|
1013
941
|
|
|
1014
|
-
class
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
942
|
+
class AlertResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
943
|
+
constructor(client) {
|
|
944
|
+
super(client, 'alerts', Alert.fromObject);
|
|
945
|
+
}
|
|
946
|
+
async create(req) {
|
|
947
|
+
return this._create(walletTransactionRequest.AlertUpdateRequest.toCleanObject(req));
|
|
948
|
+
}
|
|
949
|
+
async update(alertId, req) {
|
|
950
|
+
return this._update(alertId, walletTransactionRequest.AlertUpdateRequest.toCleanObject(req));
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
var AlertResource$1 = AlertResource;
|
|
1021
954
|
|
|
1022
|
-
|
|
1023
|
-
|
|
955
|
+
class ApiKeyResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
956
|
+
constructor(client) {
|
|
957
|
+
super(client, 'api_keys', ApiKey.fromObject);
|
|
958
|
+
}
|
|
959
|
+
async create() {
|
|
960
|
+
return this._create({});
|
|
961
|
+
}
|
|
962
|
+
async deactivate(apiKeyId, minutes = 0) {
|
|
963
|
+
// Sends { minutes: 0 } as request body on DELETE. The cuenca backend interprets
|
|
964
|
+
// this as "revoke immediately". Previous implementation omitted the body entirely;
|
|
965
|
+
// if backend behavior differs, revisit this default (cuenca-js#64 review).
|
|
966
|
+
return this._deactivate(apiKeyId, { minutes });
|
|
967
|
+
}
|
|
968
|
+
async update(apiKeyId, metadata, userId = 'me') {
|
|
969
|
+
return this._update(apiKeyId, walletTransactionRequest.ApiKeyUpdateRequest.toCleanObject({ userId, metadata }));
|
|
970
|
+
}
|
|
1024
971
|
}
|
|
972
|
+
var ApiKeyResource$1 = ApiKeyResource;
|
|
1025
973
|
|
|
1026
|
-
class
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
974
|
+
class ArpcResource extends Creatable(Resource) {
|
|
975
|
+
constructor(client) {
|
|
976
|
+
super(client, 'arpc', Arpc.fromObject);
|
|
977
|
+
}
|
|
978
|
+
async create(req) {
|
|
979
|
+
return this._create(walletTransactionRequest.ArpcRequest.toObject(req));
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
var ArpcResource$1 = ArpcResource;
|
|
983
|
+
|
|
984
|
+
const RELATED_TRANSACTION_FACTORIES$1 = {
|
|
985
|
+
bill_payments: BillPayment.fromObject,
|
|
986
|
+
card_transactions: CardTransaction.fromObject,
|
|
987
|
+
commissions: Commission.fromObject,
|
|
988
|
+
deposits: Deposit.fromObject,
|
|
989
|
+
savings: Saving.fromObject,
|
|
990
|
+
transfers: Transfer.fromObject,
|
|
991
|
+
wallet_transactions: WalletTransaction.fromObject,
|
|
992
|
+
whatsapp_transfers: WhatsAppTransfer.fromObject,
|
|
993
|
+
};
|
|
994
|
+
const FUNDING_INSTRUMENT_FACTORIES = {
|
|
995
|
+
...RELATED_TRANSACTION_FACTORIES$1,
|
|
996
|
+
accounts: Account.fromObject,
|
|
997
|
+
cards: Card.fromObject,
|
|
998
|
+
'bridge/accounts': BridgeAccount.fromObject,
|
|
999
|
+
};
|
|
1000
|
+
class BalanceEntryResource extends Queryable(Retrievable(Resource)) {
|
|
1001
|
+
constructor(client) {
|
|
1002
|
+
super(client, 'balance_entries', BalanceEntry.fromObject);
|
|
1003
|
+
}
|
|
1004
|
+
async relatedTransaction(relatedTransactionUri) {
|
|
1005
|
+
const path = getResourcePath(relatedTransactionUri);
|
|
1006
|
+
if (!path)
|
|
1007
|
+
return null;
|
|
1008
|
+
const factory = RELATED_TRANSACTION_FACTORIES$1[path];
|
|
1009
|
+
if (!factory)
|
|
1010
|
+
return null;
|
|
1011
|
+
const response = await this.client.get({ endpoint: relatedTransactionUri });
|
|
1012
|
+
return factory(response);
|
|
1013
|
+
}
|
|
1014
|
+
async fundingInstrument(fundingInstrumentUri) {
|
|
1015
|
+
const path = getResourcePath(fundingInstrumentUri);
|
|
1016
|
+
if (!path)
|
|
1017
|
+
return null;
|
|
1018
|
+
const factory = FUNDING_INSTRUMENT_FACTORIES[path];
|
|
1019
|
+
if (!factory)
|
|
1020
|
+
return null;
|
|
1021
|
+
const response = await this.client.get({ endpoint: fundingInstrumentUri });
|
|
1022
|
+
return factory(response);
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
var BalanceEntryResource$1 = BalanceEntryResource;
|
|
1032
1026
|
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1027
|
+
class BillPaymentResource extends Queryable(Retrievable(Resource)) {
|
|
1028
|
+
constructor(client) {
|
|
1029
|
+
super(client, 'bill_payments', BillPayment.fromObject);
|
|
1030
|
+
}
|
|
1031
|
+
async serviceProvider(providerUri) {
|
|
1032
|
+
if (!providerUri)
|
|
1033
|
+
return null;
|
|
1034
|
+
const response = await this.client.get({ endpoint: providerUri });
|
|
1035
|
+
return ServiceProvider.fromObject(response);
|
|
1036
|
+
}
|
|
1039
1037
|
}
|
|
1038
|
+
var BillPaymentResource$1 = BillPaymentResource;
|
|
1040
1039
|
|
|
1041
|
-
class
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
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 BridgeAccountResource extends Queryable(Retrievable(Updateable(Resource))) {
|
|
1041
|
+
constructor(client) {
|
|
1042
|
+
super(client, 'bridge/accounts', BridgeAccount.fromObject);
|
|
1043
|
+
}
|
|
1044
|
+
async update({ userId = 'me', ...req }) {
|
|
1045
|
+
return this._update(userId, walletTransactionRequest.UserUpdateRequest.toCleanObject(req));
|
|
1046
|
+
}
|
|
1047
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1048
|
+
toParams(query) {
|
|
1049
|
+
return vulnerableActivity.toParams$1(query);
|
|
1050
|
+
}
|
|
1051
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1052
|
+
toQueryString(query) {
|
|
1053
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
var BridgeAccountResource$1 = BridgeAccountResource;
|
|
1083
1057
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
createdAt: obj.created_at,
|
|
1089
|
-
updatedAt: obj.updated_at,
|
|
1090
|
-
deactivatedAt: obj.deactivated_at,
|
|
1091
|
-
platformId: obj.platform_id,
|
|
1092
|
-
filesUri: obj.files_uri,
|
|
1093
|
-
userId: obj.user_id,
|
|
1094
|
-
verificationId: obj.verification_id,
|
|
1095
|
-
identityId: obj.identity_id,
|
|
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
|
-
});
|
|
1058
|
+
class BridgeBankAccountResource extends Retrievable(Queryable(Resource)) {
|
|
1059
|
+
constructor(client) {
|
|
1060
|
+
super(client, 'bridge/bank_accounts', BridgeBankAccount.fromObject);
|
|
1061
|
+
}
|
|
1103
1062
|
}
|
|
1063
|
+
var BridgeBankAccountResource$1 = BridgeBankAccountResource;
|
|
1104
1064
|
|
|
1105
|
-
class
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1065
|
+
class BridgeClabeResource extends Queryable(Resource) {
|
|
1066
|
+
constructor(client) {
|
|
1067
|
+
super(client, 'bridge/clabes', BridgeClabe.fromObject);
|
|
1068
|
+
}
|
|
1069
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1070
|
+
toParams(query) {
|
|
1071
|
+
return vulnerableActivity.toParams$1(query);
|
|
1072
|
+
}
|
|
1073
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1074
|
+
toQueryString(query) {
|
|
1075
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
var BridgeClabeResource$1 = BridgeClabeResource;
|
|
1109
1079
|
|
|
1110
|
-
|
|
1080
|
+
class BridgeTransactionResource extends Retrievable(Queryable(Resource)) {
|
|
1081
|
+
constructor(client) {
|
|
1082
|
+
super(client, 'bridge/transactions', BridgeTransaction.fromObject);
|
|
1083
|
+
}
|
|
1084
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1085
|
+
toParams(query) {
|
|
1086
|
+
return vulnerableActivity.toParams$1(query);
|
|
1087
|
+
}
|
|
1088
|
+
// eslint-disable-next-line class-methods-use-this
|
|
1089
|
+
toQueryString(query) {
|
|
1090
|
+
return vulnerableActivity.toQueryString$1(query);
|
|
1091
|
+
}
|
|
1111
1092
|
}
|
|
1093
|
+
var BridgeTransactionResource$1 = BridgeTransactionResource;
|
|
1112
1094
|
|
|
1113
|
-
class
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1095
|
+
class CardActivationResource extends Creatable(Resource) {
|
|
1096
|
+
constructor(client) {
|
|
1097
|
+
super(client, 'card_activations', CardActivation.fromObject);
|
|
1098
|
+
}
|
|
1099
|
+
async create(req) {
|
|
1100
|
+
return this._create(walletTransactionRequest.CardActivationRequest.toCleanObject(req));
|
|
1101
|
+
}
|
|
1102
|
+
async card(cardUri) {
|
|
1103
|
+
if (!cardUri)
|
|
1104
|
+
return null;
|
|
1105
|
+
const response = await this.client.get({ endpoint: cardUri });
|
|
1106
|
+
return Card.fromObject(response);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
var CardActivationResource$1 = CardActivationResource;
|
|
1124
1110
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
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
|
-
}
|
|
1111
|
+
class CardResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
1112
|
+
constructor(client) {
|
|
1113
|
+
super(client, 'cards', Card.fromObject);
|
|
1114
|
+
}
|
|
1115
|
+
async create(userId, issuer, fundingType) {
|
|
1116
|
+
return this._create(walletTransactionRequest.CardRequest.toCleanObject({ userId, issuer, fundingType }));
|
|
1117
|
+
}
|
|
1118
|
+
async deactivate(cardId) {
|
|
1119
|
+
return this._deactivate(cardId, {});
|
|
1120
|
+
}
|
|
1121
|
+
async update(cardId, status, pinBlock) {
|
|
1122
|
+
return this._update(cardId, walletTransactionRequest.CardUpdateRequest.toCleanObject({
|
|
1123
|
+
status,
|
|
1124
|
+
...(pinBlock !== undefined ? { pinBlock } : {}),
|
|
1125
|
+
}));
|
|
1126
|
+
}
|
|
2487
1127
|
}
|
|
1128
|
+
var CardResource$1 = CardResource;
|
|
2488
1129
|
|
|
2489
|
-
class
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
1130
|
+
class CardTransactionResource extends Queryable(Retrievable(Resource)) {
|
|
1131
|
+
constructor(client) {
|
|
1132
|
+
super(client, 'card_transactions', CardTransaction.fromObject);
|
|
1133
|
+
}
|
|
1134
|
+
async relatedCard(relatedCardUri) {
|
|
1135
|
+
if (!relatedCardUri)
|
|
1136
|
+
return null;
|
|
1137
|
+
const response = await this.client.get({ endpoint: relatedCardUri });
|
|
1138
|
+
return Card.fromObject(response);
|
|
1139
|
+
}
|
|
2496
1140
|
}
|
|
1141
|
+
var CardTransactionResource$1 = CardTransactionResource;
|
|
2497
1142
|
|
|
2498
|
-
class
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
const response = await this.client.get({ endpoint: cardUri });
|
|
2512
|
-
return Card.fromObject(response);
|
|
2513
|
-
}
|
|
1143
|
+
class CardValidationResource extends Creatable(Resource) {
|
|
1144
|
+
constructor(client) {
|
|
1145
|
+
super(client, 'card_validations', CardValidation.fromObject);
|
|
1146
|
+
}
|
|
1147
|
+
async create(req) {
|
|
1148
|
+
return this._create(walletTransactionRequest.CardValidationRequest.toCleanObject(req));
|
|
1149
|
+
}
|
|
1150
|
+
async card(cardUri) {
|
|
1151
|
+
if (!cardUri)
|
|
1152
|
+
return null;
|
|
1153
|
+
const response = await this.client.get({ endpoint: cardUri });
|
|
1154
|
+
return Card.fromObject(response);
|
|
1155
|
+
}
|
|
2514
1156
|
}
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
return card;
|
|
2542
|
-
}
|
|
1157
|
+
var CardValidationResource$1 = CardValidationResource;
|
|
1158
|
+
|
|
1159
|
+
const RELATED_TRANSACTION_FACTORIES = {
|
|
1160
|
+
bill_payments: BillPayment.fromObject,
|
|
1161
|
+
'bridge/transactions': BridgeTransaction.fromObject,
|
|
1162
|
+
card_transactions: CardTransaction.fromObject,
|
|
1163
|
+
deposits: Deposit.fromObject,
|
|
1164
|
+
savings: Saving.fromObject,
|
|
1165
|
+
transfers: Transfer.fromObject,
|
|
1166
|
+
wallet_transactions: WalletTransaction.fromObject,
|
|
1167
|
+
whatsapp_transfers: WhatsAppTransfer.fromObject,
|
|
1168
|
+
};
|
|
1169
|
+
class CommissionResource extends Queryable(Retrievable(Resource)) {
|
|
1170
|
+
constructor(client) {
|
|
1171
|
+
super(client, 'commissions', Commission.fromObject);
|
|
1172
|
+
}
|
|
1173
|
+
async relatedTransaction(relatedTransactionUri) {
|
|
1174
|
+
const path = getResourcePath(relatedTransactionUri);
|
|
1175
|
+
if (!path)
|
|
1176
|
+
return null;
|
|
1177
|
+
const factory = RELATED_TRANSACTION_FACTORIES[path];
|
|
1178
|
+
if (!factory)
|
|
1179
|
+
return null;
|
|
1180
|
+
const response = await this.client.get({ endpoint: relatedTransactionUri });
|
|
1181
|
+
return factory(response);
|
|
1182
|
+
}
|
|
2543
1183
|
}
|
|
1184
|
+
var CommissionResource$1 = CommissionResource;
|
|
2544
1185
|
|
|
2545
|
-
class
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
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
|
-
}
|
|
1186
|
+
class DepositResource extends Queryable(Retrievable(Resource)) {
|
|
1187
|
+
constructor(client) {
|
|
1188
|
+
super(client, 'deposits', Deposit.fromObject);
|
|
1189
|
+
}
|
|
1190
|
+
async source(sourceUri) {
|
|
1191
|
+
const response = await this.client.get({ endpoint: sourceUri });
|
|
1192
|
+
return Account.fromObject(response);
|
|
1193
|
+
}
|
|
2562
1194
|
}
|
|
1195
|
+
var DepositResource$1 = DepositResource;
|
|
2563
1196
|
|
|
2564
|
-
class
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
icvv,
|
|
2575
|
-
number,
|
|
2576
|
-
pinBlock,
|
|
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
|
-
}
|
|
1197
|
+
class FileResource extends Downlodable(Uploadable(Resource)) {
|
|
1198
|
+
constructor(client) {
|
|
1199
|
+
super(client, 'files', File.fromObject);
|
|
1200
|
+
}
|
|
1201
|
+
async download(id, { responseType } = {}) {
|
|
1202
|
+
return this._download(id, data.FileFormat.Any, responseType);
|
|
1203
|
+
}
|
|
1204
|
+
async upload(request) {
|
|
1205
|
+
return this._upload(walletTransactionRequest.FileUploadRequest.toObject(request));
|
|
1206
|
+
}
|
|
2598
1207
|
}
|
|
1208
|
+
var FileResource$1 = FileResource;
|
|
2599
1209
|
|
|
2600
|
-
class
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
if (resource == null) return null;
|
|
2608
|
-
|
|
2609
|
-
const response = await this.client.get(relatedTransactionUri);
|
|
2610
|
-
return getModelFromPath(`${resource}`, response);
|
|
2611
|
-
}
|
|
1210
|
+
class FraudFundsTransferResource extends Creatable(Resource) {
|
|
1211
|
+
constructor(client) {
|
|
1212
|
+
super(client, 'support/transfer_fraud_funds', FraudFundsTransfer.fromObject);
|
|
1213
|
+
}
|
|
1214
|
+
async create(req) {
|
|
1215
|
+
return this._create(walletTransactionRequest.FraudFundsTransferRequest.toObject(req));
|
|
1216
|
+
}
|
|
2612
1217
|
}
|
|
1218
|
+
var FraudFundsTransferResource$1 = FraudFundsTransferResource;
|
|
2613
1219
|
|
|
2614
|
-
class
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
1220
|
+
class KYCValidationsResource extends Creatable(Deactivable(Queryable(Retrievable(Resource)))) {
|
|
1221
|
+
constructor(client, isBridge = false) {
|
|
1222
|
+
super(client, isBridge ? 'bridge/kyc_validations' : 'kyc_validations', KYCValidations.fromObject);
|
|
1223
|
+
this.isBridge = isBridge;
|
|
1224
|
+
}
|
|
1225
|
+
async create(userId = 'me', force = false) {
|
|
1226
|
+
return this._create(walletTransactionRequest.KYCValidationsRequest.toCleanObject({
|
|
1227
|
+
force,
|
|
1228
|
+
userId,
|
|
1229
|
+
isBridge: this.isBridge,
|
|
1230
|
+
}));
|
|
1231
|
+
}
|
|
1232
|
+
async deactivate(kycValidationId) {
|
|
1233
|
+
return this._deactivate(kycValidationId, {});
|
|
1234
|
+
}
|
|
2623
1235
|
}
|
|
1236
|
+
var KYCValidationsResource$1 = KYCValidationsResource;
|
|
2624
1237
|
|
|
2625
|
-
class
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
async upload(request) {
|
|
2636
|
-
const fileUpload = await this._upload(request);
|
|
2637
|
-
return fileUpload;
|
|
2638
|
-
}
|
|
1238
|
+
class LegalPersonResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1239
|
+
constructor(client) {
|
|
1240
|
+
super(client, 'legal_persons', LegalPerson.fromObject);
|
|
1241
|
+
}
|
|
1242
|
+
async create(req) {
|
|
1243
|
+
return this._create(walletTransactionRequest.LegalPersonRequest.toCleanObject(req));
|
|
1244
|
+
}
|
|
1245
|
+
async update(legalPersonId, req) {
|
|
1246
|
+
return this._update(legalPersonId, walletTransactionRequest.LegalPersonUpdateRequest.toCleanObject(req));
|
|
1247
|
+
}
|
|
2639
1248
|
}
|
|
1249
|
+
var LegalPersonResource$1 = LegalPersonResource;
|
|
2640
1250
|
|
|
2641
|
-
class
|
|
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
|
-
}
|
|
1251
|
+
class LoginTokenResource extends Creatable(Resource) {
|
|
1252
|
+
constructor(client) {
|
|
1253
|
+
super(client, 'login_tokens', LoginToken.fromObject);
|
|
1254
|
+
}
|
|
1255
|
+
async create() {
|
|
1256
|
+
return this._create({});
|
|
1257
|
+
}
|
|
2658
1258
|
}
|
|
1259
|
+
var LoginTokenResource$1 = LoginTokenResource;
|
|
2659
1260
|
|
|
2660
|
-
class
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
) {
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
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
|
-
}
|
|
1261
|
+
class OperatorLoginResource extends Creatable(Resource) {
|
|
1262
|
+
constructor(client) {
|
|
1263
|
+
super(client, 'operator-login', OperatorLogin.fromObject);
|
|
1264
|
+
this.sessionIdInHeaders = null;
|
|
1265
|
+
}
|
|
1266
|
+
async create(email, password) {
|
|
1267
|
+
const operatorLogin = await this._create(walletTransactionRequest.OperatorLoginRequest.toCleanObject({ email, password }));
|
|
1268
|
+
if (operatorLogin.sessionToken) {
|
|
1269
|
+
this.sessionIdInHeaders = this.client.addHeadersToRequest({
|
|
1270
|
+
'X-Cuenca-SessionId': operatorLogin.sessionToken,
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
return operatorLogin;
|
|
1274
|
+
}
|
|
1275
|
+
clearSessionHeader() {
|
|
1276
|
+
if (this.sessionIdInHeaders) {
|
|
1277
|
+
this.sessionIdInHeaders.eject();
|
|
1278
|
+
this.sessionIdInHeaders = null;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
2689
1281
|
}
|
|
1282
|
+
var OperatorLoginResource$1 = OperatorLoginResource;
|
|
2690
1283
|
|
|
2691
|
-
class
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
1284
|
+
class OperatorResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1285
|
+
constructor(client) {
|
|
1286
|
+
super(client, 'operators', Operator.fromObject);
|
|
1287
|
+
}
|
|
1288
|
+
async create(req) {
|
|
1289
|
+
return this._create(walletTransactionRequest.OperatorRequest.toCleanObject(req));
|
|
1290
|
+
}
|
|
1291
|
+
async update(operatorId, req) {
|
|
1292
|
+
return this._update(operatorId, walletTransactionRequest.OperatorUpdateRequest.toCleanObject(req));
|
|
1293
|
+
}
|
|
2700
1294
|
}
|
|
1295
|
+
var OperatorResource$1 = OperatorResource;
|
|
2701
1296
|
|
|
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
|
-
}
|
|
1297
|
+
class PartnerResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1298
|
+
constructor(client) {
|
|
1299
|
+
super(client, 'partners', Partner.fromObject);
|
|
1300
|
+
}
|
|
1301
|
+
async create(req) {
|
|
1302
|
+
return this._create(walletTransactionRequest.PartnerUserRequest.toCleanObject(req));
|
|
1303
|
+
}
|
|
1304
|
+
async update(partnerId, req) {
|
|
1305
|
+
return this._update(partnerId, walletTransactionRequest.PartnerUserRequest.toCleanObject(req));
|
|
1306
|
+
}
|
|
2723
1307
|
}
|
|
1308
|
+
var PartnerResource$1 = PartnerResource;
|
|
2724
1309
|
|
|
2725
|
-
class PostalCodeResource extends
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
1310
|
+
class PostalCodeResource extends Queryable(Resource) {
|
|
1311
|
+
constructor(client) {
|
|
1312
|
+
super(client, 'postal_codes', PostalCode.fromObject);
|
|
1313
|
+
}
|
|
2729
1314
|
}
|
|
1315
|
+
var PostalCodeResource$1 = PostalCodeResource;
|
|
2730
1316
|
|
|
2731
1317
|
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();
|
|
1318
|
+
constructor(client) {
|
|
1319
|
+
super(client, 'reports', (obj) => obj);
|
|
1320
|
+
}
|
|
1321
|
+
async generateXml({ committeeMeetingDate, }) {
|
|
1322
|
+
return this.client.post({
|
|
1323
|
+
endpoint: `/${this.path}`,
|
|
1324
|
+
data: walletTransactionRequest.ReportGenerateRequest.toCleanObject({ committeeMeetingDate }),
|
|
1325
|
+
headers: { Accept: 'text/xml' },
|
|
1326
|
+
responseType: 'arraybuffer',
|
|
1327
|
+
});
|
|
2757
1328
|
}
|
|
2758
|
-
}
|
|
2759
1329
|
}
|
|
1330
|
+
var ReportResource$1 = ReportResource;
|
|
2760
1331
|
|
|
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
|
-
}
|
|
1332
|
+
class SavingResource extends Creatable(Deactivable(Queryable(Retrievable(Updateable(Resource))))) {
|
|
1333
|
+
constructor(client) {
|
|
1334
|
+
super(client, 'savings', Saving.fromObject);
|
|
1335
|
+
}
|
|
1336
|
+
async create(category, goalAmount, goalDate, name) {
|
|
1337
|
+
return this._create(walletTransactionRequest.SavingRequest.toObject({ category, goalAmount, goalDate, name }));
|
|
1338
|
+
}
|
|
1339
|
+
async deactivate(savingId) {
|
|
1340
|
+
return this._deactivate(savingId, {});
|
|
1341
|
+
}
|
|
1342
|
+
async update(savingId, category, goalAmount, goalDate, name) {
|
|
1343
|
+
return this._update(savingId, walletTransactionRequest.SavingRequest.toObject({ category, goalAmount, goalDate, name }));
|
|
1344
|
+
}
|
|
2788
1345
|
}
|
|
1346
|
+
var SavingResource$1 = SavingResource;
|
|
2789
1347
|
|
|
2790
|
-
class ServiceProviderResource extends
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
constructor(client) {
|
|
2795
|
-
super('service_providers', vulnerableActivity.QueryParams, client);
|
|
2796
|
-
}
|
|
1348
|
+
class ServiceProviderResource extends Retrievable(Queryable(Resource)) {
|
|
1349
|
+
constructor(client) {
|
|
1350
|
+
super(client, 'service_providers', ServiceProvider.fromObject);
|
|
1351
|
+
}
|
|
2797
1352
|
}
|
|
1353
|
+
var ServiceProviderResource$1 = ServiceProviderResource;
|
|
2798
1354
|
|
|
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
|
-
}
|
|
1355
|
+
class SessionResource extends Creatable(Queryable(Retrievable(Resource))) {
|
|
1356
|
+
constructor(client, isBridge = false) {
|
|
1357
|
+
super(client, isBridge ? 'bridge/sessions' : 'sessions', Session.fromObject);
|
|
1358
|
+
this.isBridge = isBridge;
|
|
1359
|
+
}
|
|
1360
|
+
async create(userId, type, successUrl, failureUrl) {
|
|
1361
|
+
return this._create(walletTransactionRequest.SessionRequest.toCleanObject({
|
|
1362
|
+
...(failureUrl !== undefined ? { failureUrl } : {}),
|
|
1363
|
+
...(successUrl !== undefined ? { successUrl } : {}),
|
|
1364
|
+
type,
|
|
1365
|
+
userId,
|
|
1366
|
+
isBridge: this.isBridge,
|
|
1367
|
+
}));
|
|
1368
|
+
}
|
|
2820
1369
|
}
|
|
1370
|
+
var SessionResource$1 = SessionResource;
|
|
2821
1371
|
|
|
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
|
-
}
|
|
1372
|
+
class StatementResource extends Downlodable(Queryable(Resource)) {
|
|
1373
|
+
constructor(client) {
|
|
1374
|
+
super(client, 'statements', Statement.fromObject);
|
|
1375
|
+
}
|
|
1376
|
+
async pdf(id) {
|
|
1377
|
+
return this._download(id, data.FileFormat.Pdf);
|
|
1378
|
+
}
|
|
1379
|
+
async xml(id) {
|
|
1380
|
+
return this._download(id, data.FileFormat.Xml);
|
|
1381
|
+
}
|
|
1382
|
+
async downloadFiles({ userId, year, month, }) {
|
|
1383
|
+
vulnerableActivity.validateStatementQuery({ year, month });
|
|
1384
|
+
const statement = await this.one({ userId, year, month });
|
|
1385
|
+
const [pdf, xml] = await Promise.all([
|
|
1386
|
+
this.pdf(statement.id),
|
|
1387
|
+
this.xml(statement.id),
|
|
1388
|
+
]);
|
|
1389
|
+
return { statement, pdf, xml };
|
|
1390
|
+
}
|
|
2847
1391
|
}
|
|
1392
|
+
var StatementResource$1 = StatementResource;
|
|
2848
1393
|
|
|
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(
|
|
1394
|
+
class TransferResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1395
|
+
constructor(client) {
|
|
1396
|
+
super(client, 'transfers', Transfer.fromObject);
|
|
1397
|
+
}
|
|
1398
|
+
async destination(destinationUri) {
|
|
1399
|
+
const response = await this.client.get({ endpoint: destinationUri });
|
|
1400
|
+
return Account.fromObject(response);
|
|
1401
|
+
}
|
|
1402
|
+
async create({ accountNumber, amount, descriptor, recipientName, idempotencyKey, }) {
|
|
1403
|
+
const key = idempotencyKey ??
|
|
1404
|
+
TransferResource._genIdempotencyKey(accountNumber, amount);
|
|
1405
|
+
return this._create(walletTransactionRequest.TransferRequest.toCleanObject({
|
|
2907
1406
|
accountNumber,
|
|
2908
1407
|
amount,
|
|
2909
1408
|
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
|
-
|
|
1409
|
+
idempotencyKey: key,
|
|
1410
|
+
...(recipientName !== undefined ? { recipientName } : {}),
|
|
1411
|
+
}));
|
|
1412
|
+
}
|
|
1413
|
+
async update(transferId, req) {
|
|
1414
|
+
return this._update(transferId, walletTransactionRequest.TransferUpdateRequest.toCleanObject(req));
|
|
1415
|
+
}
|
|
1416
|
+
async createMany(requests) {
|
|
1417
|
+
if (!requests || !Array.isArray(requests) || requests.length === 0) {
|
|
1418
|
+
return {};
|
|
1419
|
+
}
|
|
1420
|
+
const transfers = { submitted: [], errors: [] };
|
|
1421
|
+
await Promise.all(requests.map(async (req) => {
|
|
1422
|
+
const actualRequest = {
|
|
1423
|
+
...req,
|
|
1424
|
+
idempotencyKey: req.idempotencyKey ??
|
|
1425
|
+
TransferResource._genIdempotencyKey(req.accountNumber, req.amount),
|
|
1426
|
+
};
|
|
1427
|
+
try {
|
|
1428
|
+
const transfer = await this._create(walletTransactionRequest.TransferRequest.toCleanObject(actualRequest));
|
|
1429
|
+
transfers.submitted.push(transfer);
|
|
1430
|
+
}
|
|
1431
|
+
catch (error) {
|
|
1432
|
+
transfers.errors.push({ actualRequest, error });
|
|
1433
|
+
}
|
|
1434
|
+
}));
|
|
1435
|
+
return transfers;
|
|
1436
|
+
}
|
|
1437
|
+
static _genIdempotencyKey(accountNumber, amount) {
|
|
1438
|
+
const isoDate = data.dateToUTC(Date.now()).toISOString();
|
|
1439
|
+
/* v8 ignore next */
|
|
1440
|
+
const date = isoDate.split('T')[0] ?? '';
|
|
1441
|
+
return `${date}:${accountNumber}:${amount}`;
|
|
1442
|
+
}
|
|
2933
1443
|
}
|
|
1444
|
+
var TransferResource$1 = TransferResource;
|
|
2934
1445
|
|
|
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
|
-
}
|
|
1446
|
+
class UserCredentialResource extends Creatable(Updateable(Resource)) {
|
|
1447
|
+
constructor(client) {
|
|
1448
|
+
super(client, 'user_credentials', UserCredential.fromObject);
|
|
1449
|
+
}
|
|
1450
|
+
async create(password) {
|
|
1451
|
+
return this._create(walletTransactionRequest.UserCredentialRequest.toObject({ password }));
|
|
1452
|
+
}
|
|
1453
|
+
async update({ isActive, password, userId = 'me', }) {
|
|
1454
|
+
return this._update(userId, walletTransactionRequest.UserCredentialUpdateRequest.toCleanObject({
|
|
1455
|
+
...(password !== undefined ? { password } : {}),
|
|
1456
|
+
...(isActive !== undefined ? { isActive } : {}),
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
2951
1459
|
}
|
|
1460
|
+
var UserCredentialResource$1 = UserCredentialResource;
|
|
2952
1461
|
|
|
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
|
-
}
|
|
1462
|
+
class UserLoginResource extends Creatable(Deactivable(Resource)) {
|
|
1463
|
+
constructor(client) {
|
|
1464
|
+
super(client, 'user_logins', UserLogin.fromObject);
|
|
1465
|
+
this.loginIdInHeaders = null;
|
|
1466
|
+
}
|
|
1467
|
+
async create(password, userId) {
|
|
1468
|
+
const userLogin = await this._create(walletTransactionRequest.UserLoginRequest.toObject({ password, userId }));
|
|
1469
|
+
if (!userLogin.success)
|
|
1470
|
+
throw new errors_index.InvalidPassword();
|
|
1471
|
+
this.loginIdInHeaders = this.client.addHeadersToRequest({
|
|
1472
|
+
'X-Cuenca-LoginId': userLogin.id,
|
|
1473
|
+
});
|
|
1474
|
+
return userLogin;
|
|
1475
|
+
}
|
|
1476
|
+
async logOut(userId = 'me') {
|
|
1477
|
+
await this._deactivate(userId, {});
|
|
1478
|
+
if (this.loginIdInHeaders)
|
|
1479
|
+
this.loginIdInHeaders.eject();
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
2980
1482
|
}
|
|
1483
|
+
var UserLoginResource$1 = UserLoginResource;
|
|
2981
1484
|
|
|
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
|
-
}
|
|
1485
|
+
class UserResource extends Deactivable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1486
|
+
constructor(client) {
|
|
1487
|
+
super(client, 'users', User.fromObject);
|
|
1488
|
+
}
|
|
1489
|
+
async update({ userId = 'me', ...req }) {
|
|
1490
|
+
return this._update(userId, walletTransactionRequest.UserUpdateRequest.toCleanObject(req));
|
|
1491
|
+
}
|
|
1492
|
+
async deactivate(userId) {
|
|
1493
|
+
return this._deactivate(userId, {});
|
|
1494
|
+
}
|
|
3002
1495
|
}
|
|
1496
|
+
var UserResource$1 = UserResource;
|
|
3003
1497
|
|
|
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
|
-
}
|
|
1498
|
+
class UserReportResource extends Creatable(Queryable(Retrievable(Updateable(Resource)))) {
|
|
1499
|
+
constructor(client) {
|
|
1500
|
+
super(client, 'user_reports', UserReport.fromObject);
|
|
1501
|
+
}
|
|
1502
|
+
async create(req) {
|
|
1503
|
+
return this._create(walletTransactionRequest.UserReportCreateRequest.toCleanObject(req));
|
|
1504
|
+
}
|
|
1505
|
+
async update(userReportId, req) {
|
|
1506
|
+
return this._update(userReportId, walletTransactionRequest.UserReportUpdateRequest.toCleanObject(req));
|
|
1507
|
+
}
|
|
3026
1508
|
}
|
|
1509
|
+
var UserReportResource$1 = UserReportResource;
|
|
3027
1510
|
|
|
3028
|
-
class UsersTosAgreementsResource extends
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
1511
|
+
class UsersTosAgreementsResource extends Retrievable(Resource) {
|
|
1512
|
+
constructor(client) {
|
|
1513
|
+
super(client, 'users_tos_agreements', UserTosAgreement.fromObject);
|
|
1514
|
+
}
|
|
3032
1515
|
}
|
|
1516
|
+
var UsersTosAgreementsResource$1 = UsersTosAgreementsResource;
|
|
3033
1517
|
|
|
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
|
-
}
|
|
1518
|
+
class VerificationResource extends Creatable(Updateable(Resource)) {
|
|
1519
|
+
constructor(client) {
|
|
1520
|
+
super(client, 'verifications', Verification.fromObject);
|
|
1521
|
+
}
|
|
1522
|
+
async create(req) {
|
|
1523
|
+
return this._create(walletTransactionRequest.VerificationRequest.toObject(req));
|
|
1524
|
+
}
|
|
1525
|
+
async update({ code, id, }) {
|
|
1526
|
+
return this._update(id, walletTransactionRequest.VerificationAttemptRequest.toObject({ code }));
|
|
1527
|
+
}
|
|
3050
1528
|
}
|
|
1529
|
+
var VerificationResource$1 = VerificationResource;
|
|
3051
1530
|
|
|
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
|
-
}
|
|
1531
|
+
const WALLET_FACTORIES = {
|
|
1532
|
+
savings: Saving.fromObject,
|
|
1533
|
+
};
|
|
1534
|
+
class WalletTransactionsResource extends Creatable(Queryable(Retrievable(Resource))) {
|
|
1535
|
+
constructor(client) {
|
|
1536
|
+
super(client, 'wallet_transactions', WalletTransaction.fromObject);
|
|
1537
|
+
}
|
|
1538
|
+
async create(amount, transactionType, walletUri) {
|
|
1539
|
+
return this._create(walletTransactionRequest.WalletTransactionRequest.toObject({ amount, transactionType, walletUri }));
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* @deprecated Method name has a typo. Retained for API compatibility.
|
|
1543
|
+
* A properly-named alias (`relatedWallet`) will be introduced in v2. See cuenca-js#59.
|
|
1544
|
+
*/
|
|
1545
|
+
async realtedWallet(walletUri) {
|
|
1546
|
+
const path = getResourcePath(walletUri);
|
|
1547
|
+
if (!path)
|
|
1548
|
+
return null;
|
|
1549
|
+
const factory = WALLET_FACTORIES[path];
|
|
1550
|
+
if (!factory)
|
|
1551
|
+
return null;
|
|
1552
|
+
const response = await this.client.get({ endpoint: walletUri });
|
|
1553
|
+
return factory(response);
|
|
1554
|
+
}
|
|
3078
1555
|
}
|
|
1556
|
+
var WalletTransactionsResource$1 = WalletTransactionsResource;
|
|
3079
1557
|
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
1558
|
+
const ACCOUNT_FACTORIES = {
|
|
1559
|
+
accounts: Account.fromObject,
|
|
1560
|
+
'bridge/accounts': BridgeAccount.fromObject,
|
|
1561
|
+
};
|
|
1562
|
+
class WhatsAppTransferResource extends Queryable(Retrievable(Resource)) {
|
|
1563
|
+
constructor(client) {
|
|
1564
|
+
super(client, 'whatsapp_transfers', WhatsAppTransfer.fromObject);
|
|
1565
|
+
}
|
|
1566
|
+
async accountDestination(destinationUri) {
|
|
1567
|
+
const path = getResourcePath(destinationUri);
|
|
1568
|
+
if (!path)
|
|
1569
|
+
return null;
|
|
1570
|
+
const factory = ACCOUNT_FACTORIES[path];
|
|
1571
|
+
if (!factory)
|
|
1572
|
+
return null;
|
|
1573
|
+
const response = await this.client.get({ endpoint: destinationUri });
|
|
1574
|
+
return factory(response);
|
|
1575
|
+
}
|
|
3095
1576
|
}
|
|
1577
|
+
var WhatsAppTransferResource$1 = WhatsAppTransferResource;
|
|
3096
1578
|
|
|
3097
1579
|
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
|
-
|
|
1580
|
+
constructor({ apiKey, apiSecret, language = 'en', phase = data.Phase.Sandbox, } = {}) {
|
|
1581
|
+
// Client type comes from src/client/client.d.ts, a declaration for the
|
|
1582
|
+
// plain-JS class in src/client/client.js. Delete both when the client
|
|
1583
|
+
// migrates to TypeScript (see cuenca-js#66).
|
|
1584
|
+
this.client = new Client({
|
|
1585
|
+
apiKey,
|
|
1586
|
+
apiSecret,
|
|
1587
|
+
language,
|
|
1588
|
+
phase,
|
|
1589
|
+
});
|
|
1590
|
+
this.withClient(this.client);
|
|
1591
|
+
}
|
|
1592
|
+
withClient(client) {
|
|
1593
|
+
this.accounts = new AccountResource$1(client);
|
|
1594
|
+
this.alerts = new AlertResource$1(client);
|
|
1595
|
+
this.apiKeys = new ApiKeyResource$1(client);
|
|
1596
|
+
this.arpc = new ArpcResource$1(client);
|
|
1597
|
+
this.balanceEntries = new BalanceEntryResource$1(client);
|
|
1598
|
+
this.billPayments = new BillPaymentResource$1(client);
|
|
1599
|
+
this.bridgeAccounts = new BridgeAccountResource$1(client);
|
|
1600
|
+
this.bridgeBankAccounts = new BridgeBankAccountResource$1(client);
|
|
1601
|
+
this.bridgeClabes = new BridgeClabeResource$1(client);
|
|
1602
|
+
this.bridgeKycValidations = new KYCValidationsResource$1(client, true);
|
|
1603
|
+
this.bridgeSessions = new SessionResource$1(client, true);
|
|
1604
|
+
this.bridgeTransactions = new BridgeTransactionResource$1(client);
|
|
1605
|
+
this.cardActivations = new CardActivationResource$1(client);
|
|
1606
|
+
this.cards = new CardResource$1(client);
|
|
1607
|
+
this.cardTransactions = new CardTransactionResource$1(client);
|
|
1608
|
+
this.cardValidations = new CardValidationResource$1(client);
|
|
1609
|
+
this.commissions = new CommissionResource$1(client);
|
|
1610
|
+
this.deposits = new DepositResource$1(client);
|
|
1611
|
+
this.files = new FileResource$1(client);
|
|
1612
|
+
this.fraudFundsTransfers = new FraudFundsTransferResource$1(client);
|
|
1613
|
+
this.kycValidations = new KYCValidationsResource$1(client);
|
|
1614
|
+
this.legalPersons = new LegalPersonResource$1(client);
|
|
1615
|
+
this.loginTokens = new LoginTokenResource$1(client);
|
|
1616
|
+
this.operatorLogins = new OperatorLoginResource$1(client);
|
|
1617
|
+
this.operators = new OperatorResource$1(client);
|
|
1618
|
+
this.partners = new PartnerResource$1(client);
|
|
1619
|
+
this.postalCodes = new PostalCodeResource$1(client);
|
|
1620
|
+
this.reports = new ReportResource$1(client);
|
|
1621
|
+
this.savings = new SavingResource$1(client);
|
|
1622
|
+
this.serviceProviders = new ServiceProviderResource$1(client);
|
|
1623
|
+
this.sessions = new SessionResource$1(client);
|
|
1624
|
+
this.statements = new StatementResource$1(client);
|
|
1625
|
+
this.transfers = new TransferResource$1(client);
|
|
1626
|
+
this.userCredentials = new UserCredentialResource$1(client);
|
|
1627
|
+
this.userLogins = new UserLoginResource$1(client);
|
|
1628
|
+
this.users = new UserResource$1(client);
|
|
1629
|
+
this.userReports = new UserReportResource$1(client);
|
|
1630
|
+
this.usersTosAgreements = new UsersTosAgreementsResource$1(client);
|
|
1631
|
+
this.verifications = new VerificationResource$1(client);
|
|
1632
|
+
this.walletTransactions = new WalletTransactionsResource$1(client);
|
|
1633
|
+
this.whatsAppTransfers = new WhatsAppTransferResource$1(client);
|
|
1634
|
+
}
|
|
3147
1635
|
}
|
|
3148
1636
|
|
|
3149
1637
|
exports.Cuenca = Cuenca;
|