@cuenca-mx/cuenca-js 0.0.5-dev0 → 0.0.6-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{data-38bfc8ad.mjs → data-8710a060.mjs} +56 -22
- package/build/{data-6451748e.cjs → data-e5d6baf4.cjs} +59 -22
- package/build/{identities-1a22fcdb.mjs → identities-e1b62b7e.mjs} +57 -5
- package/build/{identities-0a19fb53.cjs → identities-e9f31da0.cjs} +59 -4
- package/build/index.cjs +295 -13
- package/build/index.mjs +295 -13
- package/build/requests/index.cjs +5 -2
- package/build/requests/index.mjs +3 -2
- package/build/types/index.cjs +9 -3
- package/build/types/index.mjs +2 -2
- package/build/umd/cuenca.umd.js +1 -1
- package/build/{walletTransactionRequest-267a5d18.cjs → walletTransactionRequest-3fa9e821.cjs} +109 -1
- package/build/{walletTransactionRequest-2e5deaee.mjs → walletTransactionRequest-6b7417b4.mjs} +108 -2
- package/package.json +3 -2
package/build/index.mjs
CHANGED
|
@@ -2,9 +2,10 @@ import axios from 'axios';
|
|
|
2
2
|
import Buffer from 'buffer';
|
|
3
3
|
import { CuencaResponseException, CuencaException, NoResultFound, MultipleResultsFound, InvalidPassword } from './errors/index.mjs';
|
|
4
4
|
import { Jwt } from './jwt/index.mjs';
|
|
5
|
-
import { P as Phase, F as FileFormat, d as dateToUTC, e as enumValueFromString, E as EntryType, T as TransactionStatus, C as CardFundingType,
|
|
6
|
-
import { A as Address, K as KYCFile, T as TOSAgreements, a as AccountQuery, b as ApiKeyQuery, B as BalanceEntryQuery, c as BillPaymentQuery, C as CardsQuery,
|
|
7
|
-
import { A as ApiKeyUpdateRequest, a as ArpcRequest, C as CardActivationRequest, b as CardRequest, c as CardUpdateRequest, d as CardValidationRequest, S as SavingRequest, T as TransferRequest,
|
|
5
|
+
import { P as Phase, F as FileFormat, d as dateToUTC, e as enumValueFromString, E as EntryType, T as TransactionStatus, B as BridgeAccountStatus, a as BridgeTransactionType, C as Currency, N as Network, b as CardFundingType, c as CardIssuer, f as CardStatus, g as CardType, h as CardErrorType, i as CardTransactionType, j as CommissionType, D as DepositNetwork, K as KYCFileType, S as SavingCategory, k as ServiceProviderCategory, l as TransferNetwork, V as VerificationStatus, U as UserStatus, m as VerificationType, W as WalletTransactionType } from './data-8710a060.mjs';
|
|
6
|
+
import { A as Address, K as KYCFile, T as TOSAgreements, a as AccountQuery, b as ApiKeyQuery, B as BalanceEntryQuery, c as BillPaymentQuery, d as BridgeAccountQuery, e as BridgeTransactionQuery, C as CardsQuery, f as CardTransactionQuery, Q as QueryParams, D as DepositQuery, W as WalletQuery, S as StatementQuery, g as TransferQuery, U as UserQuery, h as WalletTransactionQuery } from './identities-e1b62b7e.mjs';
|
|
7
|
+
import { A as ApiKeyUpdateRequest, a as ArpcRequest, C as CardActivationRequest, b as CardRequest, c as CardUpdateRequest, d as CardValidationRequest, U as UploadRequest, K as KYCValidationsRequest, S as SavingRequest, T as TransferRequest, e as UserCredentialRequest, f as UserCredentialUpdateRequest, g as UserLoginRequest, h as UserUpdateRequest, V as VerificationRequest, i as VerificationAttemptRequest, W as WalletTransactionRequest } from './walletTransactionRequest-6b7417b4.mjs';
|
|
8
|
+
import 'module';
|
|
8
9
|
|
|
9
10
|
/* global window */
|
|
10
11
|
|
|
@@ -17,7 +18,7 @@ const isNode =
|
|
|
17
18
|
|
|
18
19
|
const runtimeEnv = { isBrowser, isNode };
|
|
19
20
|
|
|
20
|
-
const name="@cuenca-mx/cuenca-js";const version="0.0.
|
|
21
|
+
const name="@cuenca-mx/cuenca-js";const version="0.0.6-dev.0";const description="Cuenca client for JS";const main="./build/index.cjs";const module="./build/index.mjs";const browser="./build/umd/cuenca.umd.js";const files=["build/**/*"];const exports={".":{"import":"./build/index.mjs",require:"./build/index.cjs"},"./errors":{"import":"./build/errors/index.mjs",require:"./build/errors/index.cjs"},"./jwt":{"import":"./build/jwt/index.mjs",require:"./build/jwt/index.cjs"},"./requests":{"import":"./build/requests/index.mjs",require:"./build/requests/index.cjs"},"./types":{"import":"./build/types/index.mjs",require:"./build/types/index.cjs"}};const packageManager="yarn@3.0.2";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 scripts={build:"rm -rf build/ && yarn rollup --config",test:"yarn node --experimental-vm-modules $(yarn bin jest)",publish:"yarn build && yarn npm publish"};const devDependencies={"@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.1.1",jest:"^27.4.5",rollup:"^2.61.1","rollup-plugin-terser":"^7.0.2"};const dependencies={axios:"^0.24.0",buffer:"^6.0.3","form-data":"^4.0.0"};var pkg = {name:name,version:version,description:description,main:main,module:module,browser:browser,files:files,exports:exports,packageManager:packageManager,type:type,repository:repository,keywords:keywords,license:license,bugs:bugs,homepage:homepage,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies};
|
|
21
22
|
|
|
22
23
|
class Client {
|
|
23
24
|
constructor({
|
|
@@ -40,7 +41,7 @@ class Client {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
get origin() {
|
|
43
|
-
return `https://${this.phase.value}.
|
|
44
|
+
return `https://${this.phase.value}.arteria.xyz`;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
get authHeader() {
|
|
@@ -124,8 +125,8 @@ class Client {
|
|
|
124
125
|
return this.request({ endpoint, format, params });
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
async post({ endpoint, data }) {
|
|
128
|
-
return this.request({ method: 'POST', endpoint, data });
|
|
128
|
+
async post({ endpoint, data, multipart }) {
|
|
129
|
+
return this.request({ method: 'POST', endpoint, data, multipart });
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
async patch({ endpoint, data }) {
|
|
@@ -141,12 +142,18 @@ class Client {
|
|
|
141
142
|
data = null,
|
|
142
143
|
format = FileFormat.Json,
|
|
143
144
|
method = 'GET',
|
|
145
|
+
multipart = false,
|
|
144
146
|
params = null,
|
|
145
147
|
}) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
148
|
+
let headers;
|
|
149
|
+
if (multipart) {
|
|
150
|
+
headers = data.getHeaders();
|
|
151
|
+
} else {
|
|
152
|
+
headers = {
|
|
153
|
+
'Content-Type': 'application/json',
|
|
154
|
+
Accept: `application/${format.value}`,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
150
157
|
|
|
151
158
|
if (this.authHeader) {
|
|
152
159
|
headers.Authorization = this.authHeader;
|
|
@@ -166,11 +173,10 @@ class Client {
|
|
|
166
173
|
}
|
|
167
174
|
headers['X-Cuenca-Token'] = this.jwtToken.token;
|
|
168
175
|
}
|
|
169
|
-
|
|
170
176
|
const headersInterceptor = this.addHeadersToRequest(headers);
|
|
171
177
|
|
|
172
178
|
const modifiedData = data;
|
|
173
|
-
if (modifiedData) {
|
|
179
|
+
if (modifiedData && !multipart) {
|
|
174
180
|
Object.keys(modifiedData).forEach((k) => {
|
|
175
181
|
if (modifiedData[k] instanceof Date) {
|
|
176
182
|
modifiedData[k] = modifiedData[k].toISOString();
|
|
@@ -359,6 +365,163 @@ class BillPayment extends Transaction {
|
|
|
359
365
|
});
|
|
360
366
|
}
|
|
361
367
|
|
|
368
|
+
class BridgeAccount {
|
|
369
|
+
constructor({
|
|
370
|
+
id,
|
|
371
|
+
names,
|
|
372
|
+
firstSurname,
|
|
373
|
+
secondSurname,
|
|
374
|
+
dateOfBirth,
|
|
375
|
+
countryOfBirth,
|
|
376
|
+
rfc,
|
|
377
|
+
curp,
|
|
378
|
+
userId,
|
|
379
|
+
gender,
|
|
380
|
+
phoneNumber,
|
|
381
|
+
emailAddress,
|
|
382
|
+
clientClabe,
|
|
383
|
+
govtId,
|
|
384
|
+
proofOfAddress,
|
|
385
|
+
proofOfLife,
|
|
386
|
+
status,
|
|
387
|
+
}) {
|
|
388
|
+
this.id = id;
|
|
389
|
+
this.emailAddress = emailAddress;
|
|
390
|
+
this.clientClabe = clientClabe;
|
|
391
|
+
this.govtId = govtId;
|
|
392
|
+
this.names = names;
|
|
393
|
+
this.firstSurname = firstSurname;
|
|
394
|
+
this.secondSurname = secondSurname;
|
|
395
|
+
this.dateOfBirth = dateOfBirth;
|
|
396
|
+
this.countryOfBirth = countryOfBirth;
|
|
397
|
+
this.rfc = rfc;
|
|
398
|
+
this.curp = curp;
|
|
399
|
+
this.userId = userId;
|
|
400
|
+
this.gender = gender;
|
|
401
|
+
this.phoneNumber = phoneNumber;
|
|
402
|
+
this.addressProofs = proofOfAddress;
|
|
403
|
+
this.lifeProofs = proofOfLife;
|
|
404
|
+
this.status = enumValueFromString(BridgeAccountStatus, status);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
static fromObject = ({ status, ...obj }) =>
|
|
408
|
+
new BridgeAccount({
|
|
409
|
+
id: obj.id,
|
|
410
|
+
clientClabe: obj.client_clabe,
|
|
411
|
+
names: obj.names,
|
|
412
|
+
firstSurname: obj.first_surname,
|
|
413
|
+
secondSurname: obj.second_surname,
|
|
414
|
+
dateOfBirth: obj.date_of_birth,
|
|
415
|
+
countryOfBirth: obj.country_of_birth,
|
|
416
|
+
rfc: obj.rfc,
|
|
417
|
+
curp: obj.curp,
|
|
418
|
+
userId: obj.user_id,
|
|
419
|
+
gender: obj.gender,
|
|
420
|
+
govtId: obj.govt_id,
|
|
421
|
+
emailAddress: obj.email_address,
|
|
422
|
+
phoneNumber: obj.phone_number,
|
|
423
|
+
proofOfAddress: obj.proof_of_address,
|
|
424
|
+
proofOfLife: obj.proof_of_life,
|
|
425
|
+
status,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
class BridgeTransaction {
|
|
430
|
+
constructor({
|
|
431
|
+
id,
|
|
432
|
+
createdAt,
|
|
433
|
+
platformId,
|
|
434
|
+
type,
|
|
435
|
+
status,
|
|
436
|
+
accountId,
|
|
437
|
+
quoteId,
|
|
438
|
+
currency,
|
|
439
|
+
network,
|
|
440
|
+
sourceWallet,
|
|
441
|
+
destinationWallet,
|
|
442
|
+
bankAccountId,
|
|
443
|
+
cuencaId,
|
|
444
|
+
cuentaOrdenante,
|
|
445
|
+
cuentaBeneficiario,
|
|
446
|
+
nombreOrdenante,
|
|
447
|
+
claveRastreo,
|
|
448
|
+
rfcCurpOrdenante,
|
|
449
|
+
concepto,
|
|
450
|
+
referenciaNumerica,
|
|
451
|
+
signature,
|
|
452
|
+
trackingLink,
|
|
453
|
+
fromCurrency,
|
|
454
|
+
toCurrency,
|
|
455
|
+
fromAmount,
|
|
456
|
+
toAmount,
|
|
457
|
+
}) {
|
|
458
|
+
this.id = id;
|
|
459
|
+
this.createdAt = dateToUTC(createdAt);
|
|
460
|
+
this.platformId = platformId;
|
|
461
|
+
this.type = enumValueFromString(BridgeTransactionType, type);
|
|
462
|
+
this.status = enumValueFromString(TransactionStatus, status);
|
|
463
|
+
this.accountId = accountId;
|
|
464
|
+
this.quoteId = quoteId;
|
|
465
|
+
this.currency = enumValueFromString(Currency, currency);
|
|
466
|
+
this.network = enumValueFromString(Network, network);
|
|
467
|
+
this.sourceWallet = sourceWallet;
|
|
468
|
+
this.destinationWallet = destinationWallet;
|
|
469
|
+
this.bankAccountId = bankAccountId;
|
|
470
|
+
this.cuencaId = cuencaId;
|
|
471
|
+
this.cuentaOrdenante = cuentaOrdenante;
|
|
472
|
+
this.cuentaBeneficiario = cuentaBeneficiario;
|
|
473
|
+
this.nombreOrdenante = nombreOrdenante;
|
|
474
|
+
this.claveRastreo = claveRastreo;
|
|
475
|
+
this.rfcCurpOrdenante = rfcCurpOrdenante;
|
|
476
|
+
this.concepto = concepto;
|
|
477
|
+
this.referenciaNumerica = referenciaNumerica;
|
|
478
|
+
this.signature = signature;
|
|
479
|
+
this.trackingLink = trackingLink;
|
|
480
|
+
this.fromCurrency = enumValueFromString(Currency, fromCurrency);
|
|
481
|
+
this.toCurrency = enumValueFromString(Currency, toCurrency);
|
|
482
|
+
this.fromAmount = fromAmount;
|
|
483
|
+
this.toAmount = toAmount;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
static fromObject = ({
|
|
487
|
+
type,
|
|
488
|
+
status,
|
|
489
|
+
currency,
|
|
490
|
+
network,
|
|
491
|
+
concepto,
|
|
492
|
+
signature,
|
|
493
|
+
...obj
|
|
494
|
+
}) =>
|
|
495
|
+
new BridgeTransaction({
|
|
496
|
+
id: obj.id,
|
|
497
|
+
createdAt: obj.created_at,
|
|
498
|
+
platformId: obj.platform_id,
|
|
499
|
+
accountId: obj.account,
|
|
500
|
+
quoteId: obj.quote,
|
|
501
|
+
sourceWallet: obj.source_wallet,
|
|
502
|
+
destinationWallet: obj.destination_wallet,
|
|
503
|
+
bankAccountId: obj.bank_account,
|
|
504
|
+
cuencaId: obj.cuenca_id,
|
|
505
|
+
cuentaOrdenante: obj.cuenta_ordenante,
|
|
506
|
+
cuentaBeneficiario: obj.cuenta_beneficiario,
|
|
507
|
+
nombreOrdenante: obj.nombre_ordenante,
|
|
508
|
+
claveRastreo: obj.clave_rastreo,
|
|
509
|
+
rfcCurpOrdenante: obj.rfc_curp_ordenante,
|
|
510
|
+
referenciaNumerica: obj.referencia_numerica,
|
|
511
|
+
trackingLink: obj.tracking_link,
|
|
512
|
+
fromCurrency: obj.from_currency,
|
|
513
|
+
toCurrency: obj.to_currency,
|
|
514
|
+
fromAmount: obj.from_amount,
|
|
515
|
+
toAmount: obj.to_amount,
|
|
516
|
+
type,
|
|
517
|
+
status,
|
|
518
|
+
currency,
|
|
519
|
+
network,
|
|
520
|
+
concepto,
|
|
521
|
+
signature,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
362
525
|
class Card {
|
|
363
526
|
constructor({
|
|
364
527
|
createdAt,
|
|
@@ -619,6 +782,35 @@ class Deposit extends Transaction {
|
|
|
619
782
|
});
|
|
620
783
|
}
|
|
621
784
|
|
|
785
|
+
class File {
|
|
786
|
+
constructor({ extension, type, url, userId }) {
|
|
787
|
+
this.extension = extension;
|
|
788
|
+
this.type = enumValueFromString(KYCFileType, type);
|
|
789
|
+
this.url = url;
|
|
790
|
+
this.userId = userId;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
static fromObject = ({ extension, type, url, ...obj }) =>
|
|
794
|
+
new File({ extension, type, url, userId: obj.user_id });
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
class KYCValidations {
|
|
798
|
+
constructor({ platformId, attemps, verificationId, filesUri }) {
|
|
799
|
+
this.attemps = attemps;
|
|
800
|
+
this.filesUri = filesUri;
|
|
801
|
+
this.platformId = platformId;
|
|
802
|
+
this.verificationId = verificationId;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
static fromObject = ({ attemps, ...obj }) =>
|
|
806
|
+
new KYCValidations({
|
|
807
|
+
attemps,
|
|
808
|
+
filesUri: obj.files_uri,
|
|
809
|
+
platformId: obj.platform_id,
|
|
810
|
+
verificationId: obj.verification_id,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
|
|
622
814
|
class LoginToken {
|
|
623
815
|
constructor({ id }) {
|
|
624
816
|
this.id = id;
|
|
@@ -777,20 +969,25 @@ class User {
|
|
|
777
969
|
address,
|
|
778
970
|
blacklistValidationStatus,
|
|
779
971
|
clabe,
|
|
972
|
+
countryOfBirth,
|
|
780
973
|
createdAt,
|
|
781
974
|
curp,
|
|
975
|
+
dateOfBirth,
|
|
782
976
|
emailAddress,
|
|
783
977
|
firstSurname,
|
|
978
|
+
gender,
|
|
784
979
|
govtId,
|
|
785
980
|
id,
|
|
786
981
|
level,
|
|
787
982
|
names,
|
|
983
|
+
nationality,
|
|
788
984
|
phoneNumber,
|
|
789
985
|
proofOfAddress,
|
|
790
986
|
proofOfLife,
|
|
791
987
|
requiredLevel,
|
|
792
988
|
rfc,
|
|
793
989
|
secondSurname,
|
|
990
|
+
stateOfBirth,
|
|
794
991
|
status,
|
|
795
992
|
termsOfService,
|
|
796
993
|
updatedAt,
|
|
@@ -802,20 +999,25 @@ class User {
|
|
|
802
999
|
blacklistValidationStatus,
|
|
803
1000
|
);
|
|
804
1001
|
this.clabe = clabe;
|
|
1002
|
+
this.countryOfBirth = countryOfBirth;
|
|
805
1003
|
this.createdAt = dateToUTC(createdAt);
|
|
806
1004
|
this.curp = curp;
|
|
1005
|
+
this.dateOfBirth = dateOfBirth;
|
|
807
1006
|
this.emailAddress = emailAddress;
|
|
808
1007
|
this.firstSurname = firstSurname;
|
|
1008
|
+
this.gender = gender;
|
|
809
1009
|
this.govstIds = govtId;
|
|
810
1010
|
this.id = id;
|
|
811
1011
|
this.level = level;
|
|
812
1012
|
this.names = names;
|
|
1013
|
+
this.nationality = nationality;
|
|
813
1014
|
this.phoneNumber = phoneNumber;
|
|
814
1015
|
this.addressProofs = proofOfAddress;
|
|
815
1016
|
this.lifeProofs = proofOfLife;
|
|
816
1017
|
this.requiredLevel = requiredLevel;
|
|
817
1018
|
this.rfc = rfc;
|
|
818
1019
|
this.secondSurname = secondSurname;
|
|
1020
|
+
this.stateOfBirth = stateOfBirth;
|
|
819
1021
|
this.status = enumValueFromString(UserStatus, status);
|
|
820
1022
|
this.terms = termsOfService;
|
|
821
1023
|
this.updatedAt = dateToUTC(updatedAt);
|
|
@@ -871,9 +1073,11 @@ class User {
|
|
|
871
1073
|
address,
|
|
872
1074
|
clabe,
|
|
873
1075
|
curp,
|
|
1076
|
+
gender,
|
|
874
1077
|
id,
|
|
875
1078
|
level,
|
|
876
1079
|
names,
|
|
1080
|
+
nationality,
|
|
877
1081
|
rfc,
|
|
878
1082
|
status,
|
|
879
1083
|
...obj
|
|
@@ -882,13 +1086,17 @@ class User {
|
|
|
882
1086
|
address,
|
|
883
1087
|
clabe,
|
|
884
1088
|
curp,
|
|
1089
|
+
gender,
|
|
885
1090
|
id,
|
|
886
1091
|
level,
|
|
887
1092
|
names,
|
|
1093
|
+
nationality,
|
|
888
1094
|
rfc,
|
|
889
1095
|
status,
|
|
890
1096
|
blacklistValidationStatus: obj.blacklist_validation_status,
|
|
1097
|
+
countryOfBirth: obj.country_of_birth,
|
|
891
1098
|
createdAt: obj.created_at,
|
|
1099
|
+
dateOfBirth: obj.date_of_birth,
|
|
892
1100
|
emailAddress: obj.email_address,
|
|
893
1101
|
firstSurname: obj.first_surname,
|
|
894
1102
|
govtId: obj.govt_id,
|
|
@@ -897,6 +1105,7 @@ class User {
|
|
|
897
1105
|
proofOfLife: obj.proof_of_life,
|
|
898
1106
|
requiredLevel: obj.required_level,
|
|
899
1107
|
secondSurname: obj.second_surname,
|
|
1108
|
+
stateOfBirth: obj.state_of_birth,
|
|
900
1109
|
termsOfService: obj.terms_of_service,
|
|
901
1110
|
updatedAt: obj.updated_at,
|
|
902
1111
|
verificationId: obj.verification_id,
|
|
@@ -1068,12 +1277,16 @@ const getModelFromPath = (path, obj) => {
|
|
|
1068
1277
|
arpc: () => Arpc.fromObject(obj),
|
|
1069
1278
|
balance_entries: () => BalanceEntry.fromObject(obj),
|
|
1070
1279
|
bill_payments: () => BillPayment.fromObject(obj),
|
|
1280
|
+
'bridge/accounts': () => BridgeAccount.fromObject(obj),
|
|
1281
|
+
'bridge/transactions': () => BridgeTransaction.fromObject(obj),
|
|
1071
1282
|
cards: () => Card.fromObject(obj),
|
|
1072
1283
|
card_activations: () => CardActivation.fromObject(obj),
|
|
1073
1284
|
card_transactions: () => CardTransaction.fromObject(obj),
|
|
1074
1285
|
card_validations: () => CardValidation.fromObject(obj),
|
|
1075
1286
|
commissions: () => Commission.fromObject(obj),
|
|
1076
1287
|
deposits: () => Deposit.fromObject(obj),
|
|
1288
|
+
files: () => File.fromObject(obj),
|
|
1289
|
+
kyc_validations: () => KYCValidations.fromObject(obj),
|
|
1077
1290
|
login_tokens: () => LoginToken.fromObject(obj),
|
|
1078
1291
|
savings: () => Saving.fromObject(obj),
|
|
1079
1292
|
service_providers: () => ServiceProvider.fromObject(obj),
|
|
@@ -1139,6 +1352,19 @@ const Updateable = (SuperClass) =>
|
|
|
1139
1352
|
}
|
|
1140
1353
|
};
|
|
1141
1354
|
|
|
1355
|
+
const Uploadable = (SuperClass) =>
|
|
1356
|
+
class Uploadable extends SuperClass {
|
|
1357
|
+
async _upload(data) {
|
|
1358
|
+
const response = await this.client.post({
|
|
1359
|
+
endpoint: `/${this.path}`,
|
|
1360
|
+
data,
|
|
1361
|
+
multipart: true,
|
|
1362
|
+
});
|
|
1363
|
+
const model = getModelFromPath(this.path, response);
|
|
1364
|
+
return model;
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1142
1368
|
const Deactivable = (SuperClass) =>
|
|
1143
1369
|
class Deactivable extends SuperClass {
|
|
1144
1370
|
async _deactivate(id, data) {
|
|
@@ -1154,10 +1380,14 @@ const Deactivable = (SuperClass) =>
|
|
|
1154
1380
|
const Downlodable = (SuperClass) =>
|
|
1155
1381
|
class Downlodable extends SuperClass {
|
|
1156
1382
|
async _download(id, format) {
|
|
1383
|
+
const interceptor = this.client.addConfigToRequest({
|
|
1384
|
+
responseType: 'stream',
|
|
1385
|
+
});
|
|
1157
1386
|
const byteString = await this.client.get({
|
|
1158
1387
|
endpoint: `/${this.path}/${id}`,
|
|
1159
1388
|
format,
|
|
1160
1389
|
});
|
|
1390
|
+
interceptor.eject();
|
|
1161
1391
|
return byteString;
|
|
1162
1392
|
}
|
|
1163
1393
|
};
|
|
@@ -1324,6 +1554,21 @@ class BillPaymentResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1324
1554
|
}
|
|
1325
1555
|
}
|
|
1326
1556
|
|
|
1557
|
+
class BridegAccountResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1558
|
+
constructor(client) {
|
|
1559
|
+
super('bridge/accounts', BridgeAccountQuery, client);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
class BridgeTransactionResource extends mix(Resource).with(
|
|
1564
|
+
Queryable,
|
|
1565
|
+
Retrievable,
|
|
1566
|
+
) {
|
|
1567
|
+
constructor(client) {
|
|
1568
|
+
super('bridge/transactions', BridgeTransactionQuery, client);
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1327
1572
|
class CardActivationResource extends mix(Resource).with(Creatable) {
|
|
1328
1573
|
constructor(client) {
|
|
1329
1574
|
super('card_activations', Object, client);
|
|
@@ -1451,6 +1696,39 @@ class DepositResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1451
1696
|
}
|
|
1452
1697
|
}
|
|
1453
1698
|
|
|
1699
|
+
class FileResource extends mix(Resource).with(Downlodable, Uploadable) {
|
|
1700
|
+
constructor(client) {
|
|
1701
|
+
super('files', Object, client);
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
async download(id) {
|
|
1705
|
+
const byteString = await this._download(id, FileFormat.Any);
|
|
1706
|
+
return byteString;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
async upload({ ...req }) {
|
|
1710
|
+
const request = new UploadRequest(req);
|
|
1711
|
+
const fileUpload = await this._upload(request.toFormData());
|
|
1712
|
+
return fileUpload;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
class KYCValidationsResource extends mix(Resource).with(
|
|
1717
|
+
Creatable,
|
|
1718
|
+
Retrievable,
|
|
1719
|
+
Queryable,
|
|
1720
|
+
) {
|
|
1721
|
+
constructor(client) {
|
|
1722
|
+
super('kyc_validations', Object, client);
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
async create(userId = 'me') {
|
|
1726
|
+
const request = new KYCValidationsRequest(userId);
|
|
1727
|
+
const kycValidation = await this._create(request.toObject());
|
|
1728
|
+
return kycValidation;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1454
1732
|
class LoginTokenResource extends mix(Resource).with(Creatable) {
|
|
1455
1733
|
constructor(client) {
|
|
1456
1734
|
super('login_tokens', Object, client);
|
|
@@ -1737,12 +2015,16 @@ class Cuenca {
|
|
|
1737
2015
|
this.apiKeys = new ApiKeyResource(client);
|
|
1738
2016
|
this.balanceEntries = new BalanceEntryResource(client);
|
|
1739
2017
|
this.billPayments = new BillPaymentResource(client);
|
|
2018
|
+
this.bridgeAccounts = new BridegAccountResource(client);
|
|
2019
|
+
this.bridgeTransactions = new BridgeTransactionResource(client);
|
|
1740
2020
|
this.cardActivations = new CardActivationResource(client);
|
|
1741
2021
|
this.cards = new CardResource(client);
|
|
1742
2022
|
this.cardTransactions = new CardTransactionResource(client);
|
|
1743
2023
|
this.cardValidations = new CardValidationResource(client);
|
|
1744
2024
|
this.commissions = new CommissionResource(client);
|
|
1745
2025
|
this.deposits = new DepositResource(client);
|
|
2026
|
+
this.files = new FileResource(client);
|
|
2027
|
+
this.kycValidations = new KYCValidationsResource(client);
|
|
1746
2028
|
this.loginTokens = new LoginTokenResource(client);
|
|
1747
2029
|
this.savings = new SavingResource(client);
|
|
1748
2030
|
this.serviceProviders = new ServiceProviderResource(client);
|
package/build/requests/index.cjs
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var walletTransactionRequest = require('../walletTransactionRequest-
|
|
5
|
+
var walletTransactionRequest = require('../walletTransactionRequest-3fa9e821.cjs');
|
|
6
6
|
require('../errors/index.cjs');
|
|
7
|
-
require('../data-
|
|
7
|
+
require('../data-e5d6baf4.cjs');
|
|
8
|
+
require('module');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -14,6 +15,8 @@ exports.CardActivationRequest = walletTransactionRequest.CardActivationRequest;
|
|
|
14
15
|
exports.CardRequest = walletTransactionRequest.CardRequest;
|
|
15
16
|
exports.CardUpdateRequest = walletTransactionRequest.CardUpdateRequest;
|
|
16
17
|
exports.CardValidationRequest = walletTransactionRequest.CardValidationRequest;
|
|
18
|
+
exports.FileUploadRequest = walletTransactionRequest.UploadRequest;
|
|
19
|
+
exports.KYCValidationsRequeest = walletTransactionRequest.KYCValidationsRequest;
|
|
17
20
|
exports.SavingRequest = walletTransactionRequest.SavingRequest;
|
|
18
21
|
exports.TransferRequest = walletTransactionRequest.TransferRequest;
|
|
19
22
|
exports.UserCredentialRequest = walletTransactionRequest.UserCredentialRequest;
|
package/build/requests/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { A as ApiKeyUpdateRequest, a as ArpcRequest, C as CardActivationRequest, b as CardRequest, c as CardUpdateRequest, d as CardValidationRequest, S as SavingRequest, T as TransferRequest,
|
|
1
|
+
export { A as ApiKeyUpdateRequest, a as ArpcRequest, C as CardActivationRequest, b as CardRequest, c as CardUpdateRequest, d as CardValidationRequest, U as FileUploadRequest, K as KYCValidationsRequeest, S as SavingRequest, T as TransferRequest, e as UserCredentialRequest, f as UserCredentialUpdateRequest, g as UserLoginRequest, h as UserUpdateRequest, i as VerificationAttemptRequest, V as VerificationRequest, W as WalletTransactionRequest } from '../walletTransactionRequest-6b7417b4.mjs';
|
|
2
2
|
import '../errors/index.mjs';
|
|
3
|
-
import '../data-
|
|
3
|
+
import '../data-8710a060.mjs';
|
|
4
|
+
import 'module';
|
package/build/types/index.cjs
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var data = require('../data-
|
|
6
|
-
var identities = require('../identities-
|
|
5
|
+
var data = require('../data-e5d6baf4.cjs');
|
|
6
|
+
var identities = require('../identities-e9f31da0.cjs');
|
|
7
7
|
require('../errors/index.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
exports.BridgeAccountStatus = data.BridgeAccountStatus;
|
|
12
|
+
exports.BridgeTransactionType = data.BridgeTransactionType;
|
|
11
13
|
exports.CardErrorType = data.CardErrorType;
|
|
12
14
|
exports.CardFundingType = data.CardFundingType;
|
|
13
15
|
exports.CardIssuer = data.CardIssuer;
|
|
@@ -15,11 +17,12 @@ exports.CardStatus = data.CardStatus;
|
|
|
15
17
|
exports.CardTransactionType = data.CardTransactionType;
|
|
16
18
|
exports.CardType = data.CardType;
|
|
17
19
|
exports.CommissionType = data.CommissionType;
|
|
20
|
+
exports.Currency = data.Currency;
|
|
18
21
|
exports.DepositNetwork = data.DepositNetwork;
|
|
19
22
|
exports.EntryType = data.EntryType;
|
|
20
23
|
exports.FileFormat = data.FileFormat;
|
|
21
24
|
exports.KYCFileType = data.KYCFileType;
|
|
22
|
-
exports.
|
|
25
|
+
exports.Network = data.Network;
|
|
23
26
|
exports.Phase = data.Phase;
|
|
24
27
|
exports.SavingCategory = data.SavingCategory;
|
|
25
28
|
exports.ServiceProviderCategory = data.ServiceProviderCategory;
|
|
@@ -35,6 +38,8 @@ exports.Address = identities.Address;
|
|
|
35
38
|
exports.ApiKeyQuery = identities.ApiKeyQuery;
|
|
36
39
|
exports.BalanceEntryQuery = identities.BalanceEntryQuery;
|
|
37
40
|
exports.BillPaymentQuery = identities.BillPaymentQuery;
|
|
41
|
+
exports.BridgeAccountQuery = identities.BridgeAccountQuery;
|
|
42
|
+
exports.BridgeTransactionQuery = identities.BridgeTransactionQuery;
|
|
38
43
|
exports.CardTransactionQuery = identities.CardTransactionQuery;
|
|
39
44
|
exports.CardsQuery = identities.CardsQuery;
|
|
40
45
|
exports.DepositQuery = identities.DepositQuery;
|
|
@@ -43,6 +48,7 @@ exports.PageSize = identities.PageSize;
|
|
|
43
48
|
exports.QueryParams = identities.QueryParams;
|
|
44
49
|
exports.StatementQuery = identities.StatementQuery;
|
|
45
50
|
exports.TOSAgreements = identities.TOSAgreements;
|
|
51
|
+
exports.TransactionQuery = identities.TransactionQuery;
|
|
46
52
|
exports.TransferQuery = identities.TransferQuery;
|
|
47
53
|
exports.UserQuery = identities.UserQuery;
|
|
48
54
|
exports.WalletQuery = identities.WalletQuery;
|
package/build/types/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { a as AccountQuery, A as Address, b as ApiKeyQuery, B as BalanceEntryQuery, c as BillPaymentQuery, d as CardTransactionQuery, C as CardsQuery, D as DepositQuery, K as KYCFile, P as PageSize, Q as QueryParams, S as StatementQuery, T as TOSAgreements,
|
|
1
|
+
export { B as BridgeAccountStatus, a as BridgeTransactionType, h as CardErrorType, b as CardFundingType, c as CardIssuer, f as CardStatus, i as CardTransactionType, g as CardType, j as CommissionType, C as Currency, D as DepositNetwork, E as EntryType, F as FileFormat, K as KYCFileType, N as Network, P as Phase, S as SavingCategory, k as ServiceProviderCategory, n as TrackDataMethod, T as TransactionStatus, l as TransferNetwork, U as UserStatus, V as VerificationStatus, m as VerificationType, W as WalletTransactionType } from '../data-8710a060.mjs';
|
|
2
|
+
export { a as AccountQuery, A as Address, b as ApiKeyQuery, B as BalanceEntryQuery, c as BillPaymentQuery, d as BridgeAccountQuery, e as BridgeTransactionQuery, f as CardTransactionQuery, C as CardsQuery, D as DepositQuery, K as KYCFile, P as PageSize, Q as QueryParams, S as StatementQuery, T as TOSAgreements, i as TransactionQuery, g as TransferQuery, U as UserQuery, W as WalletQuery, h as WalletTransactionQuery } from '../identities-e1b62b7e.mjs';
|
|
3
3
|
import '../errors/index.mjs';
|