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