@cuenca-mx/cuenca-js 0.0.5-dev.7 → 0.0.5-dev.8
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-86ddd935.mjs → data-487ea691.mjs} +18 -26
- package/build/{data-d25afb50.cjs → data-f85a5287.cjs} +18 -26
- package/build/{identities-f01f7ffa.mjs → identities-32031e5d.mjs} +17 -63
- package/build/{identities-b472f1c7.cjs → identities-ab85ec0b.cjs} +17 -64
- package/build/index.cjs +79 -174
- package/build/index.mjs +79 -174
- package/build/requests/index.cjs +2 -6
- package/build/requests/index.mjs +2 -4
- package/build/types/index.cjs +4 -5
- package/build/types/index.mjs +2 -2
- package/build/umd/cuenca.umd.js +1 -1
- package/build/{walletTransactionRequest-ee4e5af1.cjs → walletTransactionRequest-8a816a1f.cjs} +1 -117
- package/build/{walletTransactionRequest-180eb9ea.mjs → walletTransactionRequest-bdcb7e35.mjs} +2 -112
- package/package.json +2 -3
package/build/index.cjs
CHANGED
|
@@ -6,10 +6,9 @@ var axios = require('axios');
|
|
|
6
6
|
var Buffer = require('buffer');
|
|
7
7
|
var errors_index = require('./errors/index.cjs');
|
|
8
8
|
var jwt_index = require('./jwt/index.cjs');
|
|
9
|
-
var data = require('./data-
|
|
10
|
-
var identities = require('./identities-
|
|
11
|
-
var walletTransactionRequest = require('./walletTransactionRequest-
|
|
12
|
-
require('module');
|
|
9
|
+
var data = require('./data-f85a5287.cjs');
|
|
10
|
+
var identities = require('./identities-ab85ec0b.cjs');
|
|
11
|
+
var walletTransactionRequest = require('./walletTransactionRequest-8a816a1f.cjs');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
14
|
|
|
@@ -27,7 +26,7 @@ const isNode =
|
|
|
27
26
|
|
|
28
27
|
const runtimeEnv = { isBrowser, isNode };
|
|
29
28
|
|
|
30
|
-
const name="@cuenca-mx/cuenca-js";const version="0.0.5-dev.
|
|
29
|
+
const name="@cuenca-mx/cuenca-js";const version="0.0.5-dev.8";const description="Cuenca client for JS";const main="./build/index.cjs";const module$1="./build/index.mjs";const browser="./build/umd/cuenca.umd.js";const files=["build/**/*"];const exports$1={".":{"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"};var pkg = {name:name,version:version,description:description,main:main,module:module$1,browser:browser,files:files,exports:exports$1,packageManager:packageManager,type:type,repository:repository,keywords:keywords,license:license,bugs:bugs,homepage:homepage,scripts:scripts,devDependencies:devDependencies,dependencies:dependencies};
|
|
31
30
|
|
|
32
31
|
class Client {
|
|
33
32
|
constructor({
|
|
@@ -134,8 +133,8 @@ class Client {
|
|
|
134
133
|
return this.request({ endpoint, format, params });
|
|
135
134
|
}
|
|
136
135
|
|
|
137
|
-
async post({ endpoint, data
|
|
138
|
-
return this.request({ method: 'POST', endpoint, data
|
|
136
|
+
async post({ endpoint, data }) {
|
|
137
|
+
return this.request({ method: 'POST', endpoint, data });
|
|
139
138
|
}
|
|
140
139
|
|
|
141
140
|
async patch({ endpoint, data }) {
|
|
@@ -151,18 +150,13 @@ class Client {
|
|
|
151
150
|
data: data$1 = null,
|
|
152
151
|
format = data.FileFormat.Json,
|
|
153
152
|
method = 'GET',
|
|
154
|
-
multipart = false,
|
|
155
153
|
params = null,
|
|
156
154
|
}) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
'Content-Type': 'application/json',
|
|
163
|
-
Accept: `application/${format.value}`,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
155
|
+
const headers = {
|
|
156
|
+
'Content-Type': 'application/json',
|
|
157
|
+
Accept: `application/${format.value}`,
|
|
158
|
+
};
|
|
159
|
+
|
|
166
160
|
if (this.authHeader) {
|
|
167
161
|
headers.Authorization = this.authHeader;
|
|
168
162
|
}
|
|
@@ -181,6 +175,7 @@ class Client {
|
|
|
181
175
|
}
|
|
182
176
|
headers['X-Cuenca-Token'] = this.jwtToken.token;
|
|
183
177
|
}
|
|
178
|
+
|
|
184
179
|
const headersInterceptor = this.addHeadersToRequest(headers);
|
|
185
180
|
|
|
186
181
|
const modifiedData = data$1;
|
|
@@ -373,6 +368,64 @@ class BillPayment extends Transaction {
|
|
|
373
368
|
});
|
|
374
369
|
}
|
|
375
370
|
|
|
371
|
+
class BridgeAccount {
|
|
372
|
+
constructor({
|
|
373
|
+
id,
|
|
374
|
+
names,
|
|
375
|
+
firstSurname,
|
|
376
|
+
secondSurname,
|
|
377
|
+
dateOfBirth,
|
|
378
|
+
countryOfBirth,
|
|
379
|
+
rfc,
|
|
380
|
+
curp,
|
|
381
|
+
userId,
|
|
382
|
+
gender,
|
|
383
|
+
phoneNumber,
|
|
384
|
+
emailAddress,
|
|
385
|
+
govtId,
|
|
386
|
+
proofOfAddress,
|
|
387
|
+
proofOfLife,
|
|
388
|
+
status,
|
|
389
|
+
}) {
|
|
390
|
+
this.id = id;
|
|
391
|
+
this.emailAddress = emailAddress;
|
|
392
|
+
this.govtId = govtId;
|
|
393
|
+
this.names = names;
|
|
394
|
+
this.firstSurname = firstSurname;
|
|
395
|
+
this.secondSurname = secondSurname;
|
|
396
|
+
this.dateOfBirth = dateOfBirth;
|
|
397
|
+
this.countryOfBirth = countryOfBirth;
|
|
398
|
+
this.rfc = rfc;
|
|
399
|
+
this.curp = curp;
|
|
400
|
+
this.userId = userId;
|
|
401
|
+
this.gender = gender;
|
|
402
|
+
this.phoneNumber = phoneNumber;
|
|
403
|
+
this.addressProofs = proofOfAddress;
|
|
404
|
+
this.lifeProofs = proofOfLife;
|
|
405
|
+
this.status = data.enumValueFromString(data.BridgeAccountStatus, status);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
static fromObject = ({ status, ...obj }) =>
|
|
409
|
+
new BridgeAccount({
|
|
410
|
+
id: obj.id,
|
|
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
|
+
|
|
376
429
|
class Card {
|
|
377
430
|
constructor({
|
|
378
431
|
createdAt,
|
|
@@ -633,35 +686,6 @@ class Deposit extends Transaction {
|
|
|
633
686
|
});
|
|
634
687
|
}
|
|
635
688
|
|
|
636
|
-
class File {
|
|
637
|
-
constructor({ extension, type, url, userId }) {
|
|
638
|
-
this.extension = extension;
|
|
639
|
-
this.type = data.enumValueFromString(data.KYCFileType, type);
|
|
640
|
-
this.url = url;
|
|
641
|
-
this.userId = userId;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
static fromObject = ({ extension, type, url, ...obj }) =>
|
|
645
|
-
new File({ extension, type, url, userId: obj.user_id });
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
class KYCValidations {
|
|
649
|
-
constructor({ platformId, attemps, verificationId, filesUri }) {
|
|
650
|
-
this.attemps = attemps;
|
|
651
|
-
this.filesUri = filesUri;
|
|
652
|
-
this.platformId = platformId;
|
|
653
|
-
this.verificationId = verificationId;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
static fromObject = ({ attemps, ...obj }) =>
|
|
657
|
-
new KYCValidations({
|
|
658
|
-
attemps,
|
|
659
|
-
filesUri: obj.files_uri,
|
|
660
|
-
platformId: obj.platform_id,
|
|
661
|
-
verificationId: obj.verification_id,
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
|
|
665
689
|
class LoginToken {
|
|
666
690
|
constructor({ id }) {
|
|
667
691
|
this.id = id;
|
|
@@ -817,73 +841,29 @@ class Transfer extends Transaction {
|
|
|
817
841
|
|
|
818
842
|
class User {
|
|
819
843
|
constructor({
|
|
820
|
-
address,
|
|
821
|
-
blacklistValidationStatus,
|
|
822
|
-
clabe,
|
|
823
|
-
countryOfBirth,
|
|
824
|
-
createdAt,
|
|
825
|
-
curp,
|
|
826
|
-
dateOfBirth,
|
|
827
844
|
emailAddress,
|
|
828
|
-
firstSurname,
|
|
829
|
-
gender,
|
|
830
845
|
govtId,
|
|
831
|
-
id,
|
|
832
846
|
level,
|
|
833
|
-
names,
|
|
834
|
-
nationality,
|
|
835
847
|
phoneNumber,
|
|
836
848
|
proofOfAddress,
|
|
837
849
|
proofOfLife,
|
|
838
850
|
requiredLevel,
|
|
839
|
-
rfc,
|
|
840
|
-
secondSurname,
|
|
841
|
-
stateOfBirth,
|
|
842
851
|
status,
|
|
843
852
|
termsOfService,
|
|
844
|
-
updatedAt,
|
|
845
853
|
verificationId,
|
|
846
854
|
}) {
|
|
847
|
-
this.add = address;
|
|
848
|
-
this.blacklistValidationStatus = data.enumValueFromString(
|
|
849
|
-
data.VerificationStatus,
|
|
850
|
-
blacklistValidationStatus,
|
|
851
|
-
);
|
|
852
|
-
this.clabe = clabe;
|
|
853
|
-
this.countryOfBirth = countryOfBirth;
|
|
854
|
-
this.createdAt = data.dateToUTC(createdAt);
|
|
855
|
-
this.curp = curp;
|
|
856
|
-
this.dateOfBirth = dateOfBirth;
|
|
857
855
|
this.emailAddress = emailAddress;
|
|
858
|
-
this.firstSurname = firstSurname;
|
|
859
|
-
this.gender = gender;
|
|
860
856
|
this.govstIds = govtId;
|
|
861
|
-
this.id = id;
|
|
862
857
|
this.level = level;
|
|
863
|
-
this.names = names;
|
|
864
|
-
this.nationality = nationality;
|
|
865
858
|
this.phoneNumber = phoneNumber;
|
|
866
859
|
this.addressProofs = proofOfAddress;
|
|
867
860
|
this.lifeProofs = proofOfLife;
|
|
868
861
|
this.requiredLevel = requiredLevel;
|
|
869
|
-
this.rfc = rfc;
|
|
870
|
-
this.secondSurname = secondSurname;
|
|
871
|
-
this.stateOfBirth = stateOfBirth;
|
|
872
862
|
this.status = data.enumValueFromString(data.UserStatus, status);
|
|
873
863
|
this.terms = termsOfService;
|
|
874
|
-
this.updatedAt = data.dateToUTC(updatedAt);
|
|
875
864
|
this.verificationId = verificationId;
|
|
876
865
|
}
|
|
877
866
|
|
|
878
|
-
get address() {
|
|
879
|
-
return this._address;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
set add(value) {
|
|
883
|
-
if (!value) return;
|
|
884
|
-
this._address = identities.Address.fromObject(value);
|
|
885
|
-
}
|
|
886
|
-
|
|
887
867
|
get proofOfAddress() {
|
|
888
868
|
return this._proofOfAddress;
|
|
889
869
|
}
|
|
@@ -920,45 +900,17 @@ class User {
|
|
|
920
900
|
this._termsOfService = identities.TOSAgreements.fromObject(value);
|
|
921
901
|
}
|
|
922
902
|
|
|
923
|
-
static fromObject = ({
|
|
924
|
-
address,
|
|
925
|
-
clabe,
|
|
926
|
-
curp,
|
|
927
|
-
gender,
|
|
928
|
-
id,
|
|
929
|
-
level,
|
|
930
|
-
names,
|
|
931
|
-
nationality,
|
|
932
|
-
rfc,
|
|
933
|
-
status,
|
|
934
|
-
...obj
|
|
935
|
-
}) =>
|
|
903
|
+
static fromObject = ({ level, status, ...obj }) =>
|
|
936
904
|
new User({
|
|
937
|
-
address,
|
|
938
|
-
clabe,
|
|
939
|
-
curp,
|
|
940
|
-
gender,
|
|
941
|
-
id,
|
|
942
905
|
level,
|
|
943
|
-
names,
|
|
944
|
-
nationality,
|
|
945
|
-
rfc,
|
|
946
906
|
status,
|
|
947
|
-
blacklistValidationStatus: obj.blacklist_validation_status,
|
|
948
|
-
countryOfBirth: obj.country_of_birth,
|
|
949
|
-
createdAt: obj.created_at,
|
|
950
|
-
dateOfBirth: obj.date_of_birth,
|
|
951
|
-
emailAddress: obj.email_address,
|
|
952
|
-
firstSurname: obj.first_surname,
|
|
953
907
|
govtId: obj.govt_id,
|
|
908
|
+
emailAddress: obj.email_address,
|
|
954
909
|
phoneNumber: obj.phone_number,
|
|
955
910
|
proofOfAddress: obj.proof_of_address,
|
|
956
911
|
proofOfLife: obj.proof_of_life,
|
|
957
912
|
requiredLevel: obj.required_level,
|
|
958
|
-
secondSurname: obj.second_surname,
|
|
959
|
-
stateOfBirth: obj.state_of_birth,
|
|
960
913
|
termsOfService: obj.terms_of_service,
|
|
961
|
-
updatedAt: obj.updated_at,
|
|
962
914
|
verificationId: obj.verification_id,
|
|
963
915
|
});
|
|
964
916
|
}
|
|
@@ -1128,14 +1080,13 @@ const getModelFromPath = (path, obj) => {
|
|
|
1128
1080
|
arpc: () => Arpc.fromObject(obj),
|
|
1129
1081
|
balance_entries: () => BalanceEntry.fromObject(obj),
|
|
1130
1082
|
bill_payments: () => BillPayment.fromObject(obj),
|
|
1083
|
+
'bridge/accounts': () => BridgeAccount.fromObject(obj),
|
|
1131
1084
|
cards: () => Card.fromObject(obj),
|
|
1132
1085
|
card_activations: () => CardActivation.fromObject(obj),
|
|
1133
1086
|
card_transactions: () => CardTransaction.fromObject(obj),
|
|
1134
1087
|
card_validations: () => CardValidation.fromObject(obj),
|
|
1135
1088
|
commissions: () => Commission.fromObject(obj),
|
|
1136
1089
|
deposits: () => Deposit.fromObject(obj),
|
|
1137
|
-
files: () => File.fromObject(obj),
|
|
1138
|
-
kyc_validations: () => KYCValidations.fromObject(obj),
|
|
1139
1090
|
login_tokens: () => LoginToken.fromObject(obj),
|
|
1140
1091
|
savings: () => Saving.fromObject(obj),
|
|
1141
1092
|
service_providers: () => ServiceProvider.fromObject(obj),
|
|
@@ -1201,19 +1152,6 @@ const Updateable = (SuperClass) =>
|
|
|
1201
1152
|
}
|
|
1202
1153
|
};
|
|
1203
1154
|
|
|
1204
|
-
const Uploadable = (SuperClass) =>
|
|
1205
|
-
class Uploadable extends SuperClass {
|
|
1206
|
-
async _upload(data) {
|
|
1207
|
-
const response = await this.client.post({
|
|
1208
|
-
endpoint: `/${this.path}`,
|
|
1209
|
-
data,
|
|
1210
|
-
multipart: true,
|
|
1211
|
-
});
|
|
1212
|
-
const model = getModelFromPath(this.path, response);
|
|
1213
|
-
return model;
|
|
1214
|
-
}
|
|
1215
|
-
};
|
|
1216
|
-
|
|
1217
1155
|
const Deactivable = (SuperClass) =>
|
|
1218
1156
|
class Deactivable extends SuperClass {
|
|
1219
1157
|
async _deactivate(id, data) {
|
|
@@ -1229,14 +1167,10 @@ const Deactivable = (SuperClass) =>
|
|
|
1229
1167
|
const Downlodable = (SuperClass) =>
|
|
1230
1168
|
class Downlodable extends SuperClass {
|
|
1231
1169
|
async _download(id, format) {
|
|
1232
|
-
const interceptor = this.client.addConfigToRequest({
|
|
1233
|
-
responseType: 'stream',
|
|
1234
|
-
});
|
|
1235
1170
|
const byteString = await this.client.get({
|
|
1236
1171
|
endpoint: `/${this.path}/${id}`,
|
|
1237
1172
|
format,
|
|
1238
1173
|
});
|
|
1239
|
-
interceptor.eject();
|
|
1240
1174
|
return byteString;
|
|
1241
1175
|
}
|
|
1242
1176
|
};
|
|
@@ -1403,6 +1337,12 @@ class BillPaymentResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1403
1337
|
}
|
|
1404
1338
|
}
|
|
1405
1339
|
|
|
1340
|
+
class BridegAccountResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1341
|
+
constructor(client) {
|
|
1342
|
+
super('bridge/accounts', identities.BridgeAccountQuery, client);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1406
1346
|
class CardActivationResource extends mix(Resource).with(Creatable) {
|
|
1407
1347
|
constructor(client) {
|
|
1408
1348
|
super('card_activations', Object, client);
|
|
@@ -1530,39 +1470,6 @@ class DepositResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1530
1470
|
}
|
|
1531
1471
|
}
|
|
1532
1472
|
|
|
1533
|
-
class FileResource extends mix(Resource).with(Downlodable, Uploadable) {
|
|
1534
|
-
constructor(client) {
|
|
1535
|
-
super('files', Object, client);
|
|
1536
|
-
}
|
|
1537
|
-
|
|
1538
|
-
async download(id) {
|
|
1539
|
-
const byteString = await this._download(id, data.FileFormat.Any);
|
|
1540
|
-
return byteString;
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
|
-
async upload({ ...req }) {
|
|
1544
|
-
const request = new walletTransactionRequest.UploadRequest(req);
|
|
1545
|
-
const fileUpload = await this._upload(request.toFormData());
|
|
1546
|
-
return fileUpload;
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
class KYCValidationsResource extends mix(Resource).with(
|
|
1551
|
-
Creatable,
|
|
1552
|
-
Retrievable,
|
|
1553
|
-
Queryable,
|
|
1554
|
-
) {
|
|
1555
|
-
constructor(client) {
|
|
1556
|
-
super('kyc_validations', Object, client);
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
async create(userId = 'me') {
|
|
1560
|
-
const request = new walletTransactionRequest.KYCValidationsRequest(userId);
|
|
1561
|
-
const kycValidation = await this._create(request.toObject());
|
|
1562
|
-
return kycValidation;
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
1473
|
class LoginTokenResource extends mix(Resource).with(Creatable) {
|
|
1567
1474
|
constructor(client) {
|
|
1568
1475
|
super('login_tokens', Object, client);
|
|
@@ -1855,8 +1762,6 @@ class Cuenca {
|
|
|
1855
1762
|
this.cardValidations = new CardValidationResource(client);
|
|
1856
1763
|
this.commissions = new CommissionResource(client);
|
|
1857
1764
|
this.deposits = new DepositResource(client);
|
|
1858
|
-
this.files = new FileResource(client);
|
|
1859
|
-
this.kycValidations = new KYCValidationsResource(client);
|
|
1860
1765
|
this.loginTokens = new LoginTokenResource(client);
|
|
1861
1766
|
this.savings = new SavingResource(client);
|
|
1862
1767
|
this.serviceProviders = new ServiceProviderResource(client);
|