@cuenca-mx/cuenca-js 0.0.1-dev.22 → 0.0.1-dev.25
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/base-b19a0e85.cjs +31 -0
- package/build/base-f29f69bd.mjs +27 -0
- package/build/identities-82a71f6f.mjs +593 -0
- package/build/identities-9aa8969e.cjs +627 -0
- package/build/index.cjs +84 -65
- package/build/index.mjs +28 -9
- package/build/requests/index.cjs +3 -2
- package/build/requests/index.mjs +2 -2
- package/build/types/index.cjs +17 -15
- package/build/types/index.mjs +2 -2
- package/build/umd/cuenca.umd.js +1 -1
- package/build/{walletTransactionRequest-7334f8c5.mjs → walletTransactionRequest-9a6cf2f5.mjs} +58 -18
- package/build/{walletTransactionRequest-a1851594.cjs → walletTransactionRequest-eae9c284.cjs} +72 -31
- package/package.json +1 -1
- package/build/identities-7fc7251d.mjs +0 -289
- package/build/identities-b7106a30.cjs +0 -310
- package/build/queries-59c893b6.mjs +0 -282
- package/build/queries-bc02f9a8.cjs +0 -296
package/build/index.cjs
CHANGED
|
@@ -6,9 +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 identities = require('./identities-
|
|
10
|
-
var
|
|
11
|
-
var walletTransactionRequest = require('./walletTransactionRequest-
|
|
9
|
+
var identities = require('./identities-9aa8969e.cjs');
|
|
10
|
+
var base = require('./base-b19a0e85.cjs');
|
|
11
|
+
var walletTransactionRequest = require('./walletTransactionRequest-eae9c284.cjs');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
@@ -26,7 +26,7 @@ const isNode =
|
|
|
26
26
|
|
|
27
27
|
const runtimeEnv = { isBrowser, isNode };
|
|
28
28
|
|
|
29
|
-
const name="@cuenca-mx/cuenca-js";const version="0.0.1-dev.
|
|
29
|
+
const name="@cuenca-mx/cuenca-js";const version="0.0.1-dev.25";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};
|
|
30
30
|
|
|
31
31
|
class Client {
|
|
32
32
|
constructor({ apiKey, apiSecret, phase = identities.Phase.Sandbox } = {}) {
|
|
@@ -200,7 +200,7 @@ class Client {
|
|
|
200
200
|
class Account {
|
|
201
201
|
constructor({ accountNumber, createdAt, id, institutionName, name, userId }) {
|
|
202
202
|
this.accountNumber = accountNumber;
|
|
203
|
-
this.createdAt =
|
|
203
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
204
204
|
this.id = id;
|
|
205
205
|
this.institutionName = institutionName;
|
|
206
206
|
this.name = name;
|
|
@@ -220,12 +220,12 @@ class Account {
|
|
|
220
220
|
|
|
221
221
|
class ApiKey {
|
|
222
222
|
constructor({ createdAt, deactivatedAt, id, secret, userId, updatedAt }) {
|
|
223
|
-
this.createdAt =
|
|
224
|
-
this.deactivatedAt =
|
|
223
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
224
|
+
this.deactivatedAt = base.dateToUTC(deactivatedAt);
|
|
225
225
|
this.id = id;
|
|
226
226
|
this.secret = secret;
|
|
227
227
|
this.userId = userId;
|
|
228
|
-
this.updatedAt =
|
|
228
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
static fromObject = ({ id, secret, ...obj }) =>
|
|
@@ -239,7 +239,7 @@ class ApiKey {
|
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
get isActive() {
|
|
242
|
-
const todayUTC =
|
|
242
|
+
const todayUTC = base.dateToUTC(Date.now());
|
|
243
243
|
return (
|
|
244
244
|
!this.deactivatedAt || this.deactivatedAt.getTime() > todayUTC.getTime()
|
|
245
245
|
);
|
|
@@ -249,7 +249,7 @@ class ApiKey {
|
|
|
249
249
|
class Arpc {
|
|
250
250
|
constructor({ arpc, createdAt, cardUri, isValidArqc }) {
|
|
251
251
|
this.arpc = arpc;
|
|
252
|
-
this.createdAt =
|
|
252
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
253
253
|
this.cardUri = cardUri;
|
|
254
254
|
this.isValidArqc = isValidArqc;
|
|
255
255
|
}
|
|
@@ -276,9 +276,9 @@ class BalanceEntry {
|
|
|
276
276
|
rollingBalance,
|
|
277
277
|
}) {
|
|
278
278
|
this.amount = amount;
|
|
279
|
-
this.createdAt =
|
|
279
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
280
280
|
this.descriptor = descriptor;
|
|
281
|
-
this.entryType =
|
|
281
|
+
this.entryType = base.enumValueFromString(identities.EntryType, entryType);
|
|
282
282
|
this.fundingInstrumentUri = fundingInstrumentUri;
|
|
283
283
|
this.id = id;
|
|
284
284
|
this.name = name;
|
|
@@ -303,9 +303,9 @@ class BalanceEntry {
|
|
|
303
303
|
class Transaction {
|
|
304
304
|
constructor({ amount, createdAt, descriptor, status, userId }) {
|
|
305
305
|
this.amount = amount;
|
|
306
|
-
this.createdAt =
|
|
306
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
307
307
|
this.descriptor = descriptor;
|
|
308
|
-
this.status =
|
|
308
|
+
this.status = base.enumValueFromString(identities.TransactionStatus, status);
|
|
309
309
|
this.userId = userId;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
@@ -362,18 +362,18 @@ class Card {
|
|
|
362
362
|
updatedAt,
|
|
363
363
|
userId,
|
|
364
364
|
}) {
|
|
365
|
-
this.createdAt =
|
|
365
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
366
366
|
this.cvv2 = cvv2;
|
|
367
367
|
this.expMonth = expMonth;
|
|
368
368
|
this.expYear = expYear;
|
|
369
|
-
this.fundingType =
|
|
369
|
+
this.fundingType = base.enumValueFromString(identities.CardFundingType, fundingType);
|
|
370
370
|
this.id = id;
|
|
371
|
-
this.issuer =
|
|
371
|
+
this.issuer = base.enumValueFromString(identities.CardIssuer, issuer);
|
|
372
372
|
this.number = number;
|
|
373
373
|
this.pin = pin;
|
|
374
|
-
this.status =
|
|
375
|
-
this.type =
|
|
376
|
-
this.updatedAt =
|
|
374
|
+
this.status = base.enumValueFromString(identities.CardStatus, status);
|
|
375
|
+
this.type = base.enumValueFromString(identities.CardType, type);
|
|
376
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
377
377
|
this.userId = userId;
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -407,7 +407,7 @@ class Card {
|
|
|
407
407
|
class CardActivation {
|
|
408
408
|
constructor({ cardUri, createdAt, id, ipAddress, success, userId }) {
|
|
409
409
|
this.cardUri = cardUri;
|
|
410
|
-
this.createdAt =
|
|
410
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
411
411
|
this.id = id;
|
|
412
412
|
this.ipAddress = ipAddress;
|
|
413
413
|
this.success = success;
|
|
@@ -448,14 +448,14 @@ class CardTransaction extends Transaction {
|
|
|
448
448
|
status,
|
|
449
449
|
userId,
|
|
450
450
|
});
|
|
451
|
-
this.cardErrorType =
|
|
451
|
+
this.cardErrorType = base.enumValueFromString(identities.CardErrorType, cardErrorType);
|
|
452
452
|
this.cardLastFour = cardLastFour;
|
|
453
|
-
this.cardType =
|
|
453
|
+
this.cardType = base.enumValueFromString(identities.CardType, cardType);
|
|
454
454
|
this.cardUri = cardUri;
|
|
455
455
|
this.metadata = metadata;
|
|
456
456
|
this.network = network;
|
|
457
457
|
this.relatedCardTransactionsUris = relatedCardTransactionsUris;
|
|
458
|
-
this.type =
|
|
458
|
+
this.type = base.enumValueFromString(identities.CardTransactionType, type);
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
static fromObject = ({
|
|
@@ -499,10 +499,10 @@ class CardValidation {
|
|
|
499
499
|
isValidPinBlock,
|
|
500
500
|
userId,
|
|
501
501
|
}) {
|
|
502
|
-
this.cardStatus =
|
|
503
|
-
this.cardType =
|
|
502
|
+
this.cardStatus = base.enumValueFromString(identities.CardStatus, cardStatus);
|
|
503
|
+
this.cardType = base.enumValueFromString(identities.CardType, cardType);
|
|
504
504
|
this.cardUri = cardUri;
|
|
505
|
-
this.createdAt =
|
|
505
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
506
506
|
this.isExpired = isExpired;
|
|
507
507
|
this.isPinAttemptsExceeded = isPinAttemptsExceeded;
|
|
508
508
|
this.isValidCvv = isValidCvv;
|
|
@@ -552,7 +552,7 @@ class Commission extends Transaction {
|
|
|
552
552
|
userId,
|
|
553
553
|
});
|
|
554
554
|
this.relatedTransactionUri = relatedTransactionUri;
|
|
555
|
-
this.type =
|
|
555
|
+
this.type = base.enumValueFromString(identities.CommissionType, type);
|
|
556
556
|
}
|
|
557
557
|
|
|
558
558
|
static fromObject = ({ amount, descriptor, status, type, ...obj }) =>
|
|
@@ -587,7 +587,7 @@ class Deposit extends Transaction {
|
|
|
587
587
|
userId,
|
|
588
588
|
});
|
|
589
589
|
this.id = id;
|
|
590
|
-
this.network =
|
|
590
|
+
this.network = base.enumValueFromString(identities.DepositNetwork, network);
|
|
591
591
|
this.sourceUri = sourceUri;
|
|
592
592
|
this.trackingKey = trackingKey;
|
|
593
593
|
}
|
|
@@ -617,11 +617,11 @@ class LoginToken {
|
|
|
617
617
|
class Wallet {
|
|
618
618
|
constructor({ balance, createdAt, deactivatedAt, id, userId, updatedAt }) {
|
|
619
619
|
this.balance = balance;
|
|
620
|
-
this.createdAt =
|
|
621
|
-
this.deactivatedAt =
|
|
620
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
621
|
+
this.deactivatedAt = base.dateToUTC(deactivatedAt);
|
|
622
622
|
this.id = id;
|
|
623
623
|
this.userId = userId;
|
|
624
|
-
this.updatedAt =
|
|
624
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
627
|
|
|
@@ -646,9 +646,9 @@ class Saving extends Wallet {
|
|
|
646
646
|
userId,
|
|
647
647
|
updatedAt,
|
|
648
648
|
});
|
|
649
|
-
this.category =
|
|
649
|
+
this.category = base.enumValueFromString(identities.SavingCategory, category);
|
|
650
650
|
this.goalAmount = goalAmount;
|
|
651
|
-
this.goalDate =
|
|
651
|
+
this.goalDate = base.dateToUTC(goalDate);
|
|
652
652
|
this.name = name;
|
|
653
653
|
}
|
|
654
654
|
|
|
@@ -670,7 +670,7 @@ class Saving extends Wallet {
|
|
|
670
670
|
const categoriesFromString = (categoriesList) => {
|
|
671
671
|
if (categoriesList == null) return [];
|
|
672
672
|
return categoriesList.map((category) =>
|
|
673
|
-
|
|
673
|
+
base.enumValueFromString(identities.ServiceProviderCategory, category),
|
|
674
674
|
);
|
|
675
675
|
};
|
|
676
676
|
|
|
@@ -693,7 +693,7 @@ class ServiceProvider {
|
|
|
693
693
|
|
|
694
694
|
class Statement {
|
|
695
695
|
constructor({ createdAt, id, month, year }) {
|
|
696
|
-
this.createdAt =
|
|
696
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
697
697
|
this.id = id;
|
|
698
698
|
this.month = month;
|
|
699
699
|
this.year = year;
|
|
@@ -735,10 +735,10 @@ class Transfer extends Transaction {
|
|
|
735
735
|
this.destinationUri = destinationUri;
|
|
736
736
|
this.id = id;
|
|
737
737
|
this.idempotencyKey = idempotencyKey;
|
|
738
|
-
this.network =
|
|
738
|
+
this.network = base.enumValueFromString(identities.TransferNetwork, network);
|
|
739
739
|
this.recipientName = recipientName;
|
|
740
740
|
this.trackingKey = trackingKey;
|
|
741
|
-
this.updatedAt =
|
|
741
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
742
742
|
}
|
|
743
743
|
|
|
744
744
|
static fromObject = ({ amount, descriptor, id, network, status, ...obj }) =>
|
|
@@ -760,22 +760,36 @@ class Transfer extends Transaction {
|
|
|
760
760
|
}
|
|
761
761
|
|
|
762
762
|
class User {
|
|
763
|
-
constructor({
|
|
763
|
+
constructor({
|
|
764
|
+
emailAddress,
|
|
765
|
+
phoneNumber,
|
|
766
|
+
status,
|
|
767
|
+
termsOfService,
|
|
768
|
+
verificationId,
|
|
769
|
+
}) {
|
|
770
|
+
this.emailAddress = emailAddress;
|
|
771
|
+
this.phoneNumber = phoneNumber;
|
|
772
|
+
this.status = base.enumValueFromString(identities.UserStatus, status);
|
|
764
773
|
this.termsOfService = identities.TOSAgreements.fromObject(termsOfService);
|
|
774
|
+
this.verificationId = verificationId;
|
|
765
775
|
}
|
|
766
776
|
|
|
767
777
|
static fromObject = ({ ...obj }) =>
|
|
768
778
|
new User({
|
|
779
|
+
emailAddress: obj.email_address,
|
|
780
|
+
phoneNumber: obj.phone_number,
|
|
781
|
+
status: obj.status,
|
|
769
782
|
termsOfService: obj.terms_of_service,
|
|
783
|
+
verificationId: obj.verification_id,
|
|
770
784
|
});
|
|
771
785
|
}
|
|
772
786
|
|
|
773
787
|
class UserCredential {
|
|
774
788
|
constructor({ createdAt, id, isActive, updatedAt }) {
|
|
775
|
-
this.createdAt =
|
|
789
|
+
this.createdAt = base.dateToUTC(createdAt);
|
|
776
790
|
this.id = id;
|
|
777
791
|
this.isActive = isActive;
|
|
778
|
-
this.updatedAt =
|
|
792
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
779
793
|
}
|
|
780
794
|
|
|
781
795
|
static fromObject = ({ id, ...obj }) =>
|
|
@@ -790,7 +804,7 @@ class UserCredential {
|
|
|
790
804
|
class UserLogin {
|
|
791
805
|
constructor({ id, lastLoginAt, success }) {
|
|
792
806
|
this.id = id;
|
|
793
|
-
this.lastLoginAt =
|
|
807
|
+
this.lastLoginAt = base.dateToUTC(lastLoginAt);
|
|
794
808
|
this.success = success;
|
|
795
809
|
}
|
|
796
810
|
|
|
@@ -821,7 +835,7 @@ class WalletTransaction extends Transaction {
|
|
|
821
835
|
userId,
|
|
822
836
|
});
|
|
823
837
|
this.id = id;
|
|
824
|
-
this.transactionType =
|
|
838
|
+
this.transactionType = base.enumValueFromString(
|
|
825
839
|
identities.WalletTransactionType,
|
|
826
840
|
transactionType,
|
|
827
841
|
);
|
|
@@ -868,12 +882,12 @@ class WhatsAppTransfer extends Transaction {
|
|
|
868
882
|
this.claimUrl = claimUrl;
|
|
869
883
|
this.destinationUri = destinationUri;
|
|
870
884
|
this.id = id;
|
|
871
|
-
this.expiresAt =
|
|
872
|
-
this.network =
|
|
885
|
+
this.expiresAt = base.dateToUTC(expiresAt);
|
|
886
|
+
this.network = base.enumValueFromString(identities.TransferNetwork, network);
|
|
873
887
|
this.phoneNumber = phoneNumber;
|
|
874
888
|
this.recipientName = recipientName;
|
|
875
889
|
this.trackingKey = trackingKey;
|
|
876
|
-
this.updatedAt =
|
|
890
|
+
this.updatedAt = base.dateToUTC(updatedAt);
|
|
877
891
|
}
|
|
878
892
|
|
|
879
893
|
static fromObject = ({ amount, descriptor, id, network, status, ...obj }) =>
|
|
@@ -1065,7 +1079,7 @@ const Queryable = (SuperClass) =>
|
|
|
1065
1079
|
|
|
1066
1080
|
class AccountResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1067
1081
|
constructor(client) {
|
|
1068
|
-
super('accounts',
|
|
1082
|
+
super('accounts', identities.AccountQuery, client);
|
|
1069
1083
|
}
|
|
1070
1084
|
}
|
|
1071
1085
|
|
|
@@ -1077,7 +1091,7 @@ class ApiKeyResource extends mix(Resource).with(
|
|
|
1077
1091
|
Updateable,
|
|
1078
1092
|
) {
|
|
1079
1093
|
constructor(client) {
|
|
1080
|
-
super('api_keys',
|
|
1094
|
+
super('api_keys', identities.ApiKeyQuery, client);
|
|
1081
1095
|
}
|
|
1082
1096
|
|
|
1083
1097
|
async create() {
|
|
@@ -1131,7 +1145,7 @@ class ArpcResource extends mix(Resource).with(Creatable) {
|
|
|
1131
1145
|
|
|
1132
1146
|
class BalanceEntryResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1133
1147
|
constructor(client) {
|
|
1134
|
-
super('balance_entries',
|
|
1148
|
+
super('balance_entries', identities.BalanceEntryQuery, client);
|
|
1135
1149
|
}
|
|
1136
1150
|
|
|
1137
1151
|
async relatedTransaction(relatedTransactionUri) {
|
|
@@ -1157,7 +1171,7 @@ class BalanceEntryResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1157
1171
|
|
|
1158
1172
|
class BillPaymentResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1159
1173
|
constructor(client) {
|
|
1160
|
-
super('bill_payments',
|
|
1174
|
+
super('bill_payments', identities.BillPaymentQuery, client);
|
|
1161
1175
|
}
|
|
1162
1176
|
|
|
1163
1177
|
async serviceProvider(providerUri) {
|
|
@@ -1195,7 +1209,7 @@ class CardResource extends mix(Resource).with(
|
|
|
1195
1209
|
Updateable,
|
|
1196
1210
|
) {
|
|
1197
1211
|
constructor(client) {
|
|
1198
|
-
super('cards',
|
|
1212
|
+
super('cards', identities.CardsQuery, client);
|
|
1199
1213
|
}
|
|
1200
1214
|
|
|
1201
1215
|
async create(userId, issuer, fundingType) {
|
|
@@ -1221,7 +1235,7 @@ class CardTransactionResource extends mix(Resource).with(
|
|
|
1221
1235
|
Retrievable,
|
|
1222
1236
|
) {
|
|
1223
1237
|
constructor(client) {
|
|
1224
|
-
super('card_transactions',
|
|
1238
|
+
super('card_transactions', identities.CardTransactionQuery, client);
|
|
1225
1239
|
}
|
|
1226
1240
|
|
|
1227
1241
|
async relatedCard(relatedCardUri) {
|
|
@@ -1273,7 +1287,7 @@ class CardValidationResource extends mix(Resource).with(Creatable) {
|
|
|
1273
1287
|
|
|
1274
1288
|
class CommissionResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1275
1289
|
constructor(client) {
|
|
1276
|
-
super('commissions',
|
|
1290
|
+
super('commissions', identities.QueryParams, client);
|
|
1277
1291
|
}
|
|
1278
1292
|
|
|
1279
1293
|
async relatedTransaction(relatedTransactionUri) {
|
|
@@ -1287,7 +1301,7 @@ class CommissionResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
|
1287
1301
|
|
|
1288
1302
|
class DepositResource extends mix(Resource).with(Queryable, Retrievable) {
|
|
1289
1303
|
constructor(client) {
|
|
1290
|
-
super('deposits',
|
|
1304
|
+
super('deposits', identities.DepositQuery, client);
|
|
1291
1305
|
}
|
|
1292
1306
|
|
|
1293
1307
|
async source(sourceUri) {
|
|
@@ -1315,7 +1329,7 @@ class SavingResource extends mix(Resource).with(
|
|
|
1315
1329
|
Updateable,
|
|
1316
1330
|
) {
|
|
1317
1331
|
constructor(client) {
|
|
1318
|
-
super('savings',
|
|
1332
|
+
super('savings', identities.WalletQuery, client);
|
|
1319
1333
|
}
|
|
1320
1334
|
|
|
1321
1335
|
async create(category, goalAmount, goalDate, name) {
|
|
@@ -1341,13 +1355,13 @@ class ServiceProviderResource extends mix(Resource).with(
|
|
|
1341
1355
|
Retrievable,
|
|
1342
1356
|
) {
|
|
1343
1357
|
constructor(client) {
|
|
1344
|
-
super('service_providers',
|
|
1358
|
+
super('service_providers', identities.QueryParams, client);
|
|
1345
1359
|
}
|
|
1346
1360
|
}
|
|
1347
1361
|
|
|
1348
1362
|
class StatementResource extends mix(Resource).with(Downlodable, Queryable) {
|
|
1349
1363
|
constructor(client) {
|
|
1350
|
-
super('statements',
|
|
1364
|
+
super('statements', identities.StatementQuery, client);
|
|
1351
1365
|
}
|
|
1352
1366
|
|
|
1353
1367
|
async pdf(id) {
|
|
@@ -1367,7 +1381,7 @@ class TransferResource extends mix(Resource).with(
|
|
|
1367
1381
|
Retrievable,
|
|
1368
1382
|
) {
|
|
1369
1383
|
constructor(client) {
|
|
1370
|
-
super('transfers',
|
|
1384
|
+
super('transfers', identities.TransferQuery, client);
|
|
1371
1385
|
}
|
|
1372
1386
|
|
|
1373
1387
|
async destination(destinationUri) {
|
|
@@ -1435,7 +1449,7 @@ class TransferResource extends mix(Resource).with(
|
|
|
1435
1449
|
}
|
|
1436
1450
|
|
|
1437
1451
|
static _genIdempotencyKey(accountNumber, amount) {
|
|
1438
|
-
const [date] =
|
|
1452
|
+
const [date] = base.dateToUTC(Date.now()).toISOString().split('T');
|
|
1439
1453
|
return `${date}:${accountNumber}:${amount}`;
|
|
1440
1454
|
}
|
|
1441
1455
|
}
|
|
@@ -1487,13 +1501,17 @@ class UserLoginResource extends mix(Resource).with(Creatable, Deactivable) {
|
|
|
1487
1501
|
}
|
|
1488
1502
|
}
|
|
1489
1503
|
|
|
1490
|
-
class UserResourse extends mix(Resource).with(Updateable) {
|
|
1504
|
+
class UserResourse extends mix(Resource).with(Queryable, Updateable) {
|
|
1491
1505
|
constructor(client) {
|
|
1492
|
-
super('
|
|
1506
|
+
super('users', identities.UserQuery, client);
|
|
1493
1507
|
}
|
|
1494
1508
|
|
|
1495
|
-
async update({ termsOfService, userId = 'me' }) {
|
|
1496
|
-
|
|
1509
|
+
async update({ termsOfService, userId = 'me', verificationId }) {
|
|
1510
|
+
console.log('Llega al verification');
|
|
1511
|
+
console.log(verificationId);
|
|
1512
|
+
const request = new walletTransactionRequest.UserUpdateRequest({ termsOfService, verificationId });
|
|
1513
|
+
console.log('request:');
|
|
1514
|
+
console.log(request);
|
|
1497
1515
|
const user = await this._update(userId, request.toCleanObject());
|
|
1498
1516
|
return user;
|
|
1499
1517
|
}
|
|
@@ -1505,7 +1523,7 @@ class WalletTransactionsResource extends mix(Resource).with(
|
|
|
1505
1523
|
Retrievable,
|
|
1506
1524
|
) {
|
|
1507
1525
|
constructor(client) {
|
|
1508
|
-
super('wallet_transactions',
|
|
1526
|
+
super('wallet_transactions', identities.WalletTransactionQuery, client);
|
|
1509
1527
|
}
|
|
1510
1528
|
|
|
1511
1529
|
async create(amount, transactionType, walletUri) {
|
|
@@ -1532,7 +1550,7 @@ class WhatsAppTransferResource extends mix(Resource).with(
|
|
|
1532
1550
|
Retrievable,
|
|
1533
1551
|
) {
|
|
1534
1552
|
constructor(client) {
|
|
1535
|
-
super('whatsapp_transfers',
|
|
1553
|
+
super('whatsapp_transfers', identities.QueryParams, client);
|
|
1536
1554
|
}
|
|
1537
1555
|
|
|
1538
1556
|
async accountDestination(destinationUri) {
|
|
@@ -1566,6 +1584,7 @@ class Cuenca {
|
|
|
1566
1584
|
this.serviceProviders = new ServiceProviderResource(client);
|
|
1567
1585
|
this.statements = new StatementResource(client);
|
|
1568
1586
|
this.transfers = new TransferResource(client);
|
|
1587
|
+
this.users = new UserResourse(client);
|
|
1569
1588
|
this.userCredentials = new UserCredentialResource(client);
|
|
1570
1589
|
this.userLogins = new UserLoginResource(client);
|
|
1571
1590
|
this.walletTransactions = new WalletTransactionsResource(client);
|
package/build/index.mjs
CHANGED
|
@@ -2,9 +2,9 @@ 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,
|
|
6
|
-
import {
|
|
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, U as UserCredentialRequest, e as UserCredentialUpdateRequest, f as UserLoginRequest, g as UserUpdateRequest, W as WalletTransactionRequest } from './walletTransactionRequest-
|
|
5
|
+
import { P as Phase, F as FileFormat, E as EntryType, T as TransactionStatus, C as CardIssuer, a as CardStatus, b as CardType, c as CardFundingType, d as CardErrorType, e as CardTransactionType, f as CommissionType, D as DepositNetwork, S as SavingCategory, g as ServiceProviderCategory, h as TransferNetwork, U as UserStatus, i as TOSAgreements, W as WalletTransactionType, A as AccountQuery, j as ApiKeyQuery, B as BalanceEntryQuery, k as BillPaymentQuery, l as CardsQuery, m as CardTransactionQuery, Q as QueryParams, n as DepositQuery, o as WalletQuery, p as StatementQuery, q as TransferQuery, r as UserQuery, s as WalletTransactionQuery } from './identities-82a71f6f.mjs';
|
|
6
|
+
import { d as dateToUTC, e as enumValueFromString } from './base-f29f69bd.mjs';
|
|
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, U as UserCredentialRequest, e as UserCredentialUpdateRequest, f as UserLoginRequest, g as UserUpdateRequest, W as WalletTransactionRequest } from './walletTransactionRequest-9a6cf2f5.mjs';
|
|
8
8
|
|
|
9
9
|
/* global window */
|
|
10
10
|
|
|
@@ -17,7 +17,7 @@ const isNode =
|
|
|
17
17
|
|
|
18
18
|
const runtimeEnv = { isBrowser, isNode };
|
|
19
19
|
|
|
20
|
-
const name="@cuenca-mx/cuenca-js";const version="0.0.1-dev.
|
|
20
|
+
const name="@cuenca-mx/cuenca-js";const version="0.0.1-dev.25";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"};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
21
|
|
|
22
22
|
class Client {
|
|
23
23
|
constructor({ apiKey, apiSecret, phase = Phase.Sandbox } = {}) {
|
|
@@ -751,13 +751,27 @@ class Transfer extends Transaction {
|
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
class User {
|
|
754
|
-
constructor({
|
|
754
|
+
constructor({
|
|
755
|
+
emailAddress,
|
|
756
|
+
phoneNumber,
|
|
757
|
+
status,
|
|
758
|
+
termsOfService,
|
|
759
|
+
verificationId,
|
|
760
|
+
}) {
|
|
761
|
+
this.emailAddress = emailAddress;
|
|
762
|
+
this.phoneNumber = phoneNumber;
|
|
763
|
+
this.status = enumValueFromString(UserStatus, status);
|
|
755
764
|
this.termsOfService = TOSAgreements.fromObject(termsOfService);
|
|
765
|
+
this.verificationId = verificationId;
|
|
756
766
|
}
|
|
757
767
|
|
|
758
768
|
static fromObject = ({ ...obj }) =>
|
|
759
769
|
new User({
|
|
770
|
+
emailAddress: obj.email_address,
|
|
771
|
+
phoneNumber: obj.phone_number,
|
|
772
|
+
status: obj.status,
|
|
760
773
|
termsOfService: obj.terms_of_service,
|
|
774
|
+
verificationId: obj.verification_id,
|
|
761
775
|
});
|
|
762
776
|
}
|
|
763
777
|
|
|
@@ -1478,13 +1492,17 @@ class UserLoginResource extends mix(Resource).with(Creatable, Deactivable) {
|
|
|
1478
1492
|
}
|
|
1479
1493
|
}
|
|
1480
1494
|
|
|
1481
|
-
class UserResourse extends mix(Resource).with(Updateable) {
|
|
1495
|
+
class UserResourse extends mix(Resource).with(Queryable, Updateable) {
|
|
1482
1496
|
constructor(client) {
|
|
1483
|
-
super('
|
|
1497
|
+
super('users', UserQuery, client);
|
|
1484
1498
|
}
|
|
1485
1499
|
|
|
1486
|
-
async update({ termsOfService, userId = 'me' }) {
|
|
1487
|
-
|
|
1500
|
+
async update({ termsOfService, userId = 'me', verificationId }) {
|
|
1501
|
+
console.log('Llega al verification');
|
|
1502
|
+
console.log(verificationId);
|
|
1503
|
+
const request = new UserUpdateRequest({ termsOfService, verificationId });
|
|
1504
|
+
console.log('request:');
|
|
1505
|
+
console.log(request);
|
|
1488
1506
|
const user = await this._update(userId, request.toCleanObject());
|
|
1489
1507
|
return user;
|
|
1490
1508
|
}
|
|
@@ -1557,6 +1575,7 @@ class Cuenca {
|
|
|
1557
1575
|
this.serviceProviders = new ServiceProviderResource(client);
|
|
1558
1576
|
this.statements = new StatementResource(client);
|
|
1559
1577
|
this.transfers = new TransferResource(client);
|
|
1578
|
+
this.users = new UserResourse(client);
|
|
1560
1579
|
this.userCredentials = new UserCredentialResource(client);
|
|
1561
1580
|
this.userLogins = new UserLoginResource(client);
|
|
1562
1581
|
this.walletTransactions = new WalletTransactionsResource(client);
|
package/build/requests/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var walletTransactionRequest = require('../walletTransactionRequest-
|
|
5
|
+
var walletTransactionRequest = require('../walletTransactionRequest-eae9c284.cjs');
|
|
6
|
+
require('../base-b19a0e85.cjs');
|
|
6
7
|
require('../errors/index.cjs');
|
|
7
|
-
require('../identities-b7106a30.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -15,6 +15,7 @@ exports.CardRequest = walletTransactionRequest.CardRequest;
|
|
|
15
15
|
exports.CardUpdateRequest = walletTransactionRequest.CardUpdateRequest;
|
|
16
16
|
exports.CardValidationRequest = walletTransactionRequest.CardValidationRequest;
|
|
17
17
|
exports.SavingRequest = walletTransactionRequest.SavingRequest;
|
|
18
|
+
exports.TosUpdateRequest = walletTransactionRequest.TosUpdateRequest;
|
|
18
19
|
exports.TransferRequest = walletTransactionRequest.TransferRequest;
|
|
19
20
|
exports.UserCredentialRequest = walletTransactionRequest.UserCredentialRequest;
|
|
20
21
|
exports.UserCredentialUpdateRequest = walletTransactionRequest.UserCredentialUpdateRequest;
|
package/build/requests/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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, U as UserCredentialRequest, e as UserCredentialUpdateRequest, f as UserLoginRequest, g as UserUpdateRequest, W as WalletTransactionRequest } from '../walletTransactionRequest-
|
|
1
|
+
export { A as ApiKeyUpdateRequest, a as ArpcRequest, C as CardActivationRequest, b as CardRequest, c as CardUpdateRequest, d as CardValidationRequest, S as SavingRequest, h as TosUpdateRequest, T as TransferRequest, U as UserCredentialRequest, e as UserCredentialUpdateRequest, f as UserLoginRequest, g as UserUpdateRequest, W as WalletTransactionRequest } from '../walletTransactionRequest-9a6cf2f5.mjs';
|
|
2
|
+
import '../base-f29f69bd.mjs';
|
|
2
3
|
import '../errors/index.mjs';
|
|
3
|
-
import '../identities-7fc7251d.mjs';
|
package/build/types/index.cjs
CHANGED
|
@@ -2,40 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var identities = require('../identities-
|
|
6
|
-
var queries = require('../queries-bc02f9a8.cjs');
|
|
5
|
+
var identities = require('../identities-9aa8969e.cjs');
|
|
7
6
|
require('../errors/index.cjs');
|
|
7
|
+
require('../base-b19a0e85.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
exports.AccountQuery = identities.AccountQuery;
|
|
12
|
+
exports.ApiKeyQuery = identities.ApiKeyQuery;
|
|
13
|
+
exports.BalanceEntryQuery = identities.BalanceEntryQuery;
|
|
14
|
+
exports.BillPaymentQuery = identities.BillPaymentQuery;
|
|
11
15
|
exports.CardErrorType = identities.CardErrorType;
|
|
12
16
|
exports.CardFundingType = identities.CardFundingType;
|
|
13
17
|
exports.CardIssuer = identities.CardIssuer;
|
|
14
18
|
exports.CardStatus = identities.CardStatus;
|
|
19
|
+
exports.CardTransactionQuery = identities.CardTransactionQuery;
|
|
15
20
|
exports.CardTransactionType = identities.CardTransactionType;
|
|
16
21
|
exports.CardType = identities.CardType;
|
|
22
|
+
exports.CardsQuery = identities.CardsQuery;
|
|
17
23
|
exports.CommissionType = identities.CommissionType;
|
|
18
24
|
exports.DepositNetwork = identities.DepositNetwork;
|
|
25
|
+
exports.DepositQuery = identities.DepositQuery;
|
|
19
26
|
exports.EntryType = identities.EntryType;
|
|
20
27
|
exports.FileFormat = identities.FileFormat;
|
|
28
|
+
exports.PageSize = identities.PageSize;
|
|
21
29
|
exports.Phase = identities.Phase;
|
|
30
|
+
exports.QueryParams = identities.QueryParams;
|
|
22
31
|
exports.SavingCategory = identities.SavingCategory;
|
|
23
32
|
exports.ServiceProviderCategory = identities.ServiceProviderCategory;
|
|
33
|
+
exports.StatementQuery = identities.StatementQuery;
|
|
24
34
|
exports.TOSAgreements = identities.TOSAgreements;
|
|
25
35
|
exports.TrackDataMethod = identities.TrackDataMethod;
|
|
26
36
|
exports.TransactionStatus = identities.TransactionStatus;
|
|
27
37
|
exports.TransferNetwork = identities.TransferNetwork;
|
|
38
|
+
exports.TransferQuery = identities.TransferQuery;
|
|
39
|
+
exports.UserQuery = identities.UserQuery;
|
|
40
|
+
exports.UserStatus = identities.UserStatus;
|
|
41
|
+
exports.WalletQuery = identities.WalletQuery;
|
|
42
|
+
exports.WalletTransactionQuery = identities.WalletTransactionQuery;
|
|
28
43
|
exports.WalletTransactionType = identities.WalletTransactionType;
|
|
29
|
-
exports.AccountQuery = queries.AccountQuery;
|
|
30
|
-
exports.ApiKeyQuery = queries.ApiKeyQuery;
|
|
31
|
-
exports.BalanceEntryQuery = queries.BalanceEntryQuery;
|
|
32
|
-
exports.BillPaymentQuery = queries.BillPaymentQuery;
|
|
33
|
-
exports.CardTransactionQuery = queries.CardTransactionQuery;
|
|
34
|
-
exports.CardsQuery = queries.CardsQuery;
|
|
35
|
-
exports.DepositQuery = queries.DepositQuery;
|
|
36
|
-
exports.PageSize = queries.PageSize;
|
|
37
|
-
exports.QueryParams = queries.QueryParams;
|
|
38
|
-
exports.StatementQuery = queries.StatementQuery;
|
|
39
|
-
exports.TransferQuery = queries.TransferQuery;
|
|
40
|
-
exports.WalletQuery = queries.WalletQuery;
|
|
41
|
-
exports.WalletTransactionQuery = queries.WalletTransactionQuery;
|
package/build/types/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { A as AccountQuery, a as ApiKeyQuery, B as BalanceEntryQuery, b as BillPaymentQuery, c as CardTransactionQuery, C as CardsQuery, D as DepositQuery, P as PageSize, Q as QueryParams, S as StatementQuery, T as TransferQuery, W as WalletQuery, d as WalletTransactionQuery } from '../queries-59c893b6.mjs';
|
|
1
|
+
export { A as AccountQuery, j as ApiKeyQuery, B as BalanceEntryQuery, k as BillPaymentQuery, d as CardErrorType, c as CardFundingType, C as CardIssuer, a as CardStatus, m as CardTransactionQuery, e as CardTransactionType, b as CardType, l as CardsQuery, f as CommissionType, D as DepositNetwork, n as DepositQuery, E as EntryType, F as FileFormat, u as PageSize, P as Phase, Q as QueryParams, S as SavingCategory, g as ServiceProviderCategory, p as StatementQuery, i as TOSAgreements, t as TrackDataMethod, T as TransactionStatus, h as TransferNetwork, q as TransferQuery, r as UserQuery, U as UserStatus, o as WalletQuery, s as WalletTransactionQuery, W as WalletTransactionType } from '../identities-82a71f6f.mjs';
|
|
3
2
|
import '../errors/index.mjs';
|
|
3
|
+
import '../base-f29f69bd.mjs';
|