@cuenca-mx/cuenca-js 0.0.1-dev.9 → 0.0.3-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/README.md +157 -2
- package/build/data-69952249.mjs +330 -0
- package/build/{queries-b8f29837.js → data-efb53250.cjs} +62 -285
- package/build/errors/{index.js → index.cjs} +0 -0
- package/build/identities-5e48f342.mjs +337 -0
- package/build/identities-93faf1ed.cjs +354 -0
- package/build/{index.js → index.cjs} +291 -98
- package/build/index.mjs +250 -23
- package/build/jwt/{index.js → index.cjs} +7 -2
- package/build/jwt/index.mjs +2 -1
- package/build/requests/{index.js → index.cjs} +6 -3
- package/build/requests/index.mjs +2 -2
- package/build/types/index.cjs +47 -0
- package/build/types/index.mjs +2 -2
- package/build/umd/cuenca.umd.js +1 -1
- package/build/{walletTransactionRequest-bbfb87bd.js → walletTransactionRequest-63cd40ad.mjs} +173 -4
- package/build/{walletTransactionRequest-b588cc52.js → walletTransactionRequest-bb31f865.cjs} +176 -4
- package/package.json +10 -9
- package/build/data-7d3d5fcc.js +0 -11
- package/build/data-c53f1052.js +0 -14
- package/build/queries-f146b91b.js +0 -546
- package/build/types/index.js +0 -40
package/build/index.mjs
CHANGED
|
@@ -1,19 +1,38 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import Buffer from 'buffer';
|
|
2
3
|
import { CuencaResponseException, CuencaException, NoResultFound, MultipleResultsFound, InvalidPassword } from './errors/index.mjs';
|
|
3
|
-
export { CuencaException, CuencaResponseException, InvalidPassword, MalformedJwtToken, MultipleResultsFound, NoResultFound, ValidationError } from './errors/index.mjs';
|
|
4
4
|
import { Jwt } from './jwt/index.mjs';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { P as Phase, F as FileFormat, d as dateToUTC, e as enumValueFromString, E as EntryType, T as TransactionStatus, C as CardFundingType, a as CardIssuer, b as CardStatus, c as CardType, f as CardErrorType, g as CardTransactionType, h as CommissionType, D as DepositNetwork, S as SavingCategory, i as ServiceProviderCategory, j as TransferNetwork, U as UserStatus, V as VerificationType, W as WalletTransactionType } from './data-69952249.mjs';
|
|
6
|
+
import { K as KYCFile, T as TOSAgreements, A as AccountQuery, a as ApiKeyQuery, B as BalanceEntryQuery, b as BillPaymentQuery, C as CardsQuery, c as CardTransactionQuery, Q as QueryParams, D as DepositQuery, W as WalletQuery, S as StatementQuery, d as TransferQuery, U as UserQuery, e as WalletTransactionQuery } from './identities-5e48f342.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, V as VerificationRequest, h as VerificationAttemptRequest, W as WalletTransactionRequest } from './walletTransactionRequest-63cd40ad.mjs';
|
|
8
|
+
|
|
9
|
+
/* global window */
|
|
10
|
+
|
|
11
|
+
const isBrowser =
|
|
12
|
+
typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
13
|
+
|
|
14
|
+
const isNode =
|
|
15
|
+
typeof process !== 'undefined' &&
|
|
16
|
+
Object.prototype.toString.call(process) === '[object process]';
|
|
17
|
+
|
|
18
|
+
const runtimeEnv = { isBrowser, isNode };
|
|
19
|
+
|
|
20
|
+
const name="@cuenca-mx/cuenca-js";const version="0.0.3-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"};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};
|
|
10
21
|
|
|
11
22
|
class Client {
|
|
12
|
-
constructor({
|
|
23
|
+
constructor({
|
|
24
|
+
apiKey,
|
|
25
|
+
apiSecret,
|
|
26
|
+
language = 'en',
|
|
27
|
+
phase = Phase.Sandbox,
|
|
28
|
+
} = {}) {
|
|
13
29
|
this.phase = phase;
|
|
14
30
|
this.basicAuth = { apiKey, apiSecret };
|
|
15
31
|
this.jwtToken = null;
|
|
16
|
-
this._session = axios.create(
|
|
32
|
+
this._session = axios.create({
|
|
33
|
+
headers: { 'Accept-Language': language },
|
|
34
|
+
timeout: 45000,
|
|
35
|
+
});
|
|
17
36
|
}
|
|
18
37
|
|
|
19
38
|
get session() {
|
|
@@ -27,8 +46,9 @@ class Client {
|
|
|
27
46
|
get authHeader() {
|
|
28
47
|
const { apiKey, apiSecret } = this.basicAuth;
|
|
29
48
|
if (!apiKey || !apiSecret) return '';
|
|
30
|
-
return `Basic ${Buffer.from(
|
|
31
|
-
|
|
49
|
+
return `Basic ${Buffer.Buffer.from(
|
|
50
|
+
`${apiKey}:${apiSecret}`,
|
|
51
|
+
'utf-8',
|
|
32
52
|
).toString('base64')}`;
|
|
33
53
|
}
|
|
34
54
|
|
|
@@ -74,7 +94,14 @@ class Client {
|
|
|
74
94
|
};
|
|
75
95
|
}
|
|
76
96
|
|
|
77
|
-
async configure({
|
|
97
|
+
async configure({
|
|
98
|
+
apiKey,
|
|
99
|
+
apiSecret,
|
|
100
|
+
loginToken,
|
|
101
|
+
phase,
|
|
102
|
+
sessionId,
|
|
103
|
+
useJwt = false,
|
|
104
|
+
}) {
|
|
78
105
|
this.basicAuth = {
|
|
79
106
|
apiKey: apiKey || this.basicAuth.apiKey,
|
|
80
107
|
apiSecret: apiSecret || this.basicAuth.apiSecret,
|
|
@@ -87,6 +114,10 @@ class Client {
|
|
|
87
114
|
if (loginToken) {
|
|
88
115
|
this.addHeadersToRequest({ 'X-Cuenca-LoginToken': loginToken });
|
|
89
116
|
}
|
|
117
|
+
|
|
118
|
+
if (sessionId) {
|
|
119
|
+
this.addHeadersToRequest({ 'X-Cuenca-SessionId': sessionId });
|
|
120
|
+
}
|
|
90
121
|
}
|
|
91
122
|
|
|
92
123
|
async get({ endpoint, format, params }) {
|
|
@@ -113,12 +144,22 @@ class Client {
|
|
|
113
144
|
params = null,
|
|
114
145
|
}) {
|
|
115
146
|
const headers = {
|
|
116
|
-
Authorization: this.authHeader,
|
|
117
|
-
'X-User-Agent': `cuenca-js/0.0.1`, // TODO: Change for client version
|
|
118
147
|
'Content-Type': 'application/json',
|
|
119
148
|
Accept: `application/${format.value}`,
|
|
120
149
|
};
|
|
121
150
|
|
|
151
|
+
if (this.authHeader) {
|
|
152
|
+
headers.Authorization = this.authHeader;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (runtimeEnv.isNode) {
|
|
156
|
+
headers['User-Agent'] = `cuenca-js/${pkg.version}`;
|
|
157
|
+
} else if (runtimeEnv.isBrowser) {
|
|
158
|
+
// Cannot set User-Agent header on browsers
|
|
159
|
+
// https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name
|
|
160
|
+
headers['X-User-Agent'] = `cuenca-js/${pkg.version}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
122
163
|
if (this.jwtToken) {
|
|
123
164
|
if (this.jwtToken.isExpired) {
|
|
124
165
|
this.jwtToken = await Jwt.create(this);
|
|
@@ -293,7 +334,13 @@ class BillPayment extends Transaction {
|
|
|
293
334
|
status,
|
|
294
335
|
userId,
|
|
295
336
|
}) {
|
|
296
|
-
super({
|
|
337
|
+
super({
|
|
338
|
+
amount,
|
|
339
|
+
createdAt,
|
|
340
|
+
descriptor,
|
|
341
|
+
status,
|
|
342
|
+
userId,
|
|
343
|
+
});
|
|
297
344
|
this.accountNumber = accountNumber;
|
|
298
345
|
this.id = id;
|
|
299
346
|
this.providerUri = providerUri;
|
|
@@ -407,7 +454,13 @@ class CardTransaction extends Transaction {
|
|
|
407
454
|
type,
|
|
408
455
|
userId,
|
|
409
456
|
}) {
|
|
410
|
-
super({
|
|
457
|
+
super({
|
|
458
|
+
amount,
|
|
459
|
+
createdAt,
|
|
460
|
+
descriptor,
|
|
461
|
+
status,
|
|
462
|
+
userId,
|
|
463
|
+
});
|
|
411
464
|
this.cardErrorType = enumValueFromString(CardErrorType, cardErrorType);
|
|
412
465
|
this.cardLastFour = cardLastFour;
|
|
413
466
|
this.cardType = enumValueFromString(CardType, cardType);
|
|
@@ -504,7 +557,13 @@ class Commission extends Transaction {
|
|
|
504
557
|
type,
|
|
505
558
|
userId,
|
|
506
559
|
}) {
|
|
507
|
-
super({
|
|
560
|
+
super({
|
|
561
|
+
amount,
|
|
562
|
+
createdAt,
|
|
563
|
+
descriptor,
|
|
564
|
+
status,
|
|
565
|
+
userId,
|
|
566
|
+
});
|
|
508
567
|
this.relatedTransactionUri = relatedTransactionUri;
|
|
509
568
|
this.type = enumValueFromString(CommissionType, type);
|
|
510
569
|
}
|
|
@@ -533,7 +592,13 @@ class Deposit extends Transaction {
|
|
|
533
592
|
trackingKey,
|
|
534
593
|
userId,
|
|
535
594
|
}) {
|
|
536
|
-
super({
|
|
595
|
+
super({
|
|
596
|
+
amount,
|
|
597
|
+
createdAt,
|
|
598
|
+
descriptor,
|
|
599
|
+
status,
|
|
600
|
+
userId,
|
|
601
|
+
});
|
|
537
602
|
this.id = id;
|
|
538
603
|
this.network = enumValueFromString(DepositNetwork, network);
|
|
539
604
|
this.sourceUri = sourceUri;
|
|
@@ -586,7 +651,14 @@ class Saving extends Wallet {
|
|
|
586
651
|
userId,
|
|
587
652
|
updatedAt,
|
|
588
653
|
}) {
|
|
589
|
-
super({
|
|
654
|
+
super({
|
|
655
|
+
balance,
|
|
656
|
+
createdAt,
|
|
657
|
+
deactivatedAt,
|
|
658
|
+
id,
|
|
659
|
+
userId,
|
|
660
|
+
updatedAt,
|
|
661
|
+
});
|
|
590
662
|
this.category = enumValueFromString(SavingCategory, category);
|
|
591
663
|
this.goalAmount = goalAmount;
|
|
592
664
|
this.goalDate = dateToUTC(goalDate);
|
|
@@ -665,7 +737,13 @@ class Transfer extends Transaction {
|
|
|
665
737
|
updatedAt,
|
|
666
738
|
userId,
|
|
667
739
|
}) {
|
|
668
|
-
super({
|
|
740
|
+
super({
|
|
741
|
+
amount,
|
|
742
|
+
createdAt,
|
|
743
|
+
descriptor,
|
|
744
|
+
status,
|
|
745
|
+
userId,
|
|
746
|
+
});
|
|
669
747
|
this.accountNumber = accountNumber;
|
|
670
748
|
this.destinationUri = destinationUri;
|
|
671
749
|
this.id = id;
|
|
@@ -694,6 +772,79 @@ class Transfer extends Transaction {
|
|
|
694
772
|
});
|
|
695
773
|
}
|
|
696
774
|
|
|
775
|
+
class User {
|
|
776
|
+
constructor({
|
|
777
|
+
emailAddress,
|
|
778
|
+
govtId,
|
|
779
|
+
level,
|
|
780
|
+
phoneNumber,
|
|
781
|
+
proofOfAddress,
|
|
782
|
+
proofOfLife,
|
|
783
|
+
status,
|
|
784
|
+
termsOfService,
|
|
785
|
+
verificationId,
|
|
786
|
+
}) {
|
|
787
|
+
this.emailAddress = emailAddress;
|
|
788
|
+
this.govstIds = govtId;
|
|
789
|
+
this.level = level;
|
|
790
|
+
this.phoneNumber = phoneNumber;
|
|
791
|
+
this.addressProofs = proofOfAddress;
|
|
792
|
+
this.lifeProofs = proofOfLife;
|
|
793
|
+
this.status = enumValueFromString(UserStatus, status);
|
|
794
|
+
this.terms = termsOfService;
|
|
795
|
+
this.verificationId = verificationId;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
get proofOfAddress() {
|
|
799
|
+
return this._proofOfAddress;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
set addressProofs(value) {
|
|
803
|
+
if (!value) return;
|
|
804
|
+
this._proofOfAddress = KYCFile.fromObject(value);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
get proofOfLife() {
|
|
808
|
+
return this._proofOfLife;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
set lifeProofs(value) {
|
|
812
|
+
if (!value) return;
|
|
813
|
+
this._proofOfLife = KYCFile.fromObject(value);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
get govtId() {
|
|
817
|
+
return this._govtId;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
set govstIds(value) {
|
|
821
|
+
if (!value) return;
|
|
822
|
+
this._govtId = KYCFile.fromObject(value);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
get termsOfService() {
|
|
826
|
+
return this._termsOfService;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
set terms(value) {
|
|
830
|
+
if (!value) return;
|
|
831
|
+
this._termsOfService = TOSAgreements.fromObject(value);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
static fromObject = ({ level, status, ...obj }) =>
|
|
835
|
+
new User({
|
|
836
|
+
level,
|
|
837
|
+
status,
|
|
838
|
+
govtId: obj.govt_id,
|
|
839
|
+
emailAddress: obj.email_address,
|
|
840
|
+
phoneNumber: obj.phone_number,
|
|
841
|
+
proofOfAddress: obj.proof_of_address,
|
|
842
|
+
proofOfLife: obj.proof_of_life,
|
|
843
|
+
termsOfService: obj.terms_of_service,
|
|
844
|
+
verificationId: obj.verification_id,
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
697
848
|
class UserCredential {
|
|
698
849
|
constructor({ createdAt, id, isActive, updatedAt }) {
|
|
699
850
|
this.createdAt = dateToUTC(createdAt);
|
|
@@ -726,6 +877,27 @@ class UserLogin {
|
|
|
726
877
|
});
|
|
727
878
|
}
|
|
728
879
|
|
|
880
|
+
class Verification {
|
|
881
|
+
constructor({ createdAt, id, platformId, recipient, type, updatedAt }) {
|
|
882
|
+
this.createdAt = dateToUTC(createdAt);
|
|
883
|
+
this.id = id;
|
|
884
|
+
this.platformId = platformId;
|
|
885
|
+
this.recipient = recipient;
|
|
886
|
+
this.type = enumValueFromString(VerificationType, type);
|
|
887
|
+
this.updatedAt = dateToUTC(updatedAt);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
static fromObject = ({ id, recipient, type, ...obj }) =>
|
|
891
|
+
new Verification({
|
|
892
|
+
id,
|
|
893
|
+
recipient,
|
|
894
|
+
type,
|
|
895
|
+
createdAt: obj.created_at,
|
|
896
|
+
platformId: obj.platform_id,
|
|
897
|
+
updatedAt: obj.updated_at,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
|
|
729
901
|
class WalletTransaction extends Transaction {
|
|
730
902
|
constructor({
|
|
731
903
|
amount,
|
|
@@ -737,7 +909,13 @@ class WalletTransaction extends Transaction {
|
|
|
737
909
|
userId,
|
|
738
910
|
walletUri,
|
|
739
911
|
}) {
|
|
740
|
-
super({
|
|
912
|
+
super({
|
|
913
|
+
amount,
|
|
914
|
+
createdAt,
|
|
915
|
+
descriptor,
|
|
916
|
+
status,
|
|
917
|
+
userId,
|
|
918
|
+
});
|
|
741
919
|
this.id = id;
|
|
742
920
|
this.transactionType = enumValueFromString(
|
|
743
921
|
WalletTransactionType,
|
|
@@ -776,7 +954,13 @@ class WhatsAppTransfer extends Transaction {
|
|
|
776
954
|
updatedAt,
|
|
777
955
|
userId,
|
|
778
956
|
}) {
|
|
779
|
-
super({
|
|
957
|
+
super({
|
|
958
|
+
amount,
|
|
959
|
+
createdAt,
|
|
960
|
+
descriptor,
|
|
961
|
+
status,
|
|
962
|
+
userId,
|
|
963
|
+
});
|
|
780
964
|
this.claimUrl = claimUrl;
|
|
781
965
|
this.destinationUri = destinationUri;
|
|
782
966
|
this.id = id;
|
|
@@ -837,8 +1021,10 @@ const getModelFromPath = (path, obj) => {
|
|
|
837
1021
|
service_providers: () => ServiceProvider.fromObject(obj),
|
|
838
1022
|
statements: () => Statement.fromObject(obj),
|
|
839
1023
|
transfers: () => Transfer.fromObject(obj),
|
|
1024
|
+
users: () => User.fromObject(obj),
|
|
840
1025
|
user_credentials: () => UserCredential.fromObject(obj),
|
|
841
1026
|
user_logins: () => UserLogin.fromObject(obj),
|
|
1027
|
+
verifications: () => Verification.fromObject(obj),
|
|
842
1028
|
wallet_transactions: () => WalletTransaction.fromObject(obj),
|
|
843
1029
|
whatsapp_transfers: () => WhatsAppTransfer.fromObject(obj),
|
|
844
1030
|
};
|
|
@@ -1398,6 +1584,40 @@ class UserLoginResource extends mix(Resource).with(Creatable, Deactivable) {
|
|
|
1398
1584
|
}
|
|
1399
1585
|
}
|
|
1400
1586
|
|
|
1587
|
+
class UserResourse extends mix(Resource).with(
|
|
1588
|
+
Queryable,
|
|
1589
|
+
Updateable,
|
|
1590
|
+
Retrievable,
|
|
1591
|
+
) {
|
|
1592
|
+
constructor(client) {
|
|
1593
|
+
super('users', UserQuery, client);
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
async update({ userId = 'me', ...req }) {
|
|
1597
|
+
const request = new UserUpdateRequest(req);
|
|
1598
|
+
const user = await this._update(userId, request.toCleanObject());
|
|
1599
|
+
return user;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
class VerificationResourse extends mix(Resource).with(Creatable, Updateable) {
|
|
1604
|
+
constructor(client) {
|
|
1605
|
+
super('verifications', Object, client);
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
async create({ platformId, recipient, type }) {
|
|
1609
|
+
const request = new VerificationRequest({ platformId, recipient, type });
|
|
1610
|
+
const verification = await this._create(request.toObject());
|
|
1611
|
+
return verification;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
async update({ code, id }) {
|
|
1615
|
+
const request = new VerificationAttemptRequest({ code });
|
|
1616
|
+
const verification = await this._update(id, request.toObject());
|
|
1617
|
+
return verification;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1401
1621
|
class WalletTransactionsResource extends mix(Resource).with(
|
|
1402
1622
|
Creatable,
|
|
1403
1623
|
Queryable,
|
|
@@ -1444,8 +1664,13 @@ class WhatsAppTransferResource extends mix(Resource).with(
|
|
|
1444
1664
|
}
|
|
1445
1665
|
|
|
1446
1666
|
class Cuenca {
|
|
1447
|
-
constructor(
|
|
1448
|
-
|
|
1667
|
+
constructor({
|
|
1668
|
+
apiKey,
|
|
1669
|
+
apiSecret,
|
|
1670
|
+
language = 'en',
|
|
1671
|
+
phase = Phase.Sandbox,
|
|
1672
|
+
} = {}) {
|
|
1673
|
+
this.client = new Client({ apiKey, apiSecret, language, phase });
|
|
1449
1674
|
this.withClient(this.client);
|
|
1450
1675
|
}
|
|
1451
1676
|
|
|
@@ -1467,6 +1692,8 @@ class Cuenca {
|
|
|
1467
1692
|
this.transfers = new TransferResource(client);
|
|
1468
1693
|
this.userCredentials = new UserCredentialResource(client);
|
|
1469
1694
|
this.userLogins = new UserLoginResource(client);
|
|
1695
|
+
this.users = new UserResourse(client);
|
|
1696
|
+
this.verifications = new VerificationResourse(client);
|
|
1470
1697
|
this.walletTransactions = new WalletTransactionsResource(client);
|
|
1471
1698
|
this.whatsAppTransfers = new WhatsAppTransferResource(client);
|
|
1472
1699
|
}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var Buffer = require('buffer');
|
|
6
|
+
var errors_index = require('../errors/index.cjs');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var Buffer__default = /*#__PURE__*/_interopDefaultLegacy(Buffer);
|
|
6
11
|
|
|
7
12
|
class Jwt {
|
|
8
13
|
constructor(expiresAt, token) {
|
|
@@ -20,7 +25,7 @@ class Jwt {
|
|
|
20
25
|
try {
|
|
21
26
|
const [, payloadEncoded] = token.split('.');
|
|
22
27
|
payload = JSON.parse(
|
|
23
|
-
Buffer.from(`${payloadEncoded}==`, 'base64').toString(),
|
|
28
|
+
Buffer__default["default"].Buffer.from(`${payloadEncoded}==`, 'base64').toString(),
|
|
24
29
|
);
|
|
25
30
|
} catch (error) {
|
|
26
31
|
throw new errors_index.MalformedJwtToken();
|
package/build/jwt/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Buffer from 'buffer';
|
|
1
2
|
import { MalformedJwtToken } from '../errors/index.mjs';
|
|
2
3
|
|
|
3
4
|
class Jwt {
|
|
@@ -16,7 +17,7 @@ class Jwt {
|
|
|
16
17
|
try {
|
|
17
18
|
const [, payloadEncoded] = token.split('.');
|
|
18
19
|
payload = JSON.parse(
|
|
19
|
-
Buffer.from(`${payloadEncoded}==`, 'base64').toString(),
|
|
20
|
+
Buffer.Buffer.from(`${payloadEncoded}==`, 'base64').toString(),
|
|
20
21
|
);
|
|
21
22
|
} catch (error) {
|
|
22
23
|
throw new MalformedJwtToken();
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var walletTransactionRequest = require('../walletTransactionRequest-
|
|
6
|
-
require('../errors/index.
|
|
7
|
-
require('../data-
|
|
5
|
+
var walletTransactionRequest = require('../walletTransactionRequest-bb31f865.cjs');
|
|
6
|
+
require('../errors/index.cjs');
|
|
7
|
+
require('../data-efb53250.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -19,4 +19,7 @@ exports.TransferRequest = walletTransactionRequest.TransferRequest;
|
|
|
19
19
|
exports.UserCredentialRequest = walletTransactionRequest.UserCredentialRequest;
|
|
20
20
|
exports.UserCredentialUpdateRequest = walletTransactionRequest.UserCredentialUpdateRequest;
|
|
21
21
|
exports.UserLoginRequest = walletTransactionRequest.UserLoginRequest;
|
|
22
|
+
exports.UserUpdateRequest = walletTransactionRequest.UserUpdateRequest;
|
|
23
|
+
exports.VerificationAttemptRequest = walletTransactionRequest.VerificationAttemptRequest;
|
|
24
|
+
exports.VerificationRequest = walletTransactionRequest.VerificationRequest;
|
|
22
25
|
exports.WalletTransactionRequest = walletTransactionRequest.WalletTransactionRequest;
|
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, 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, T as TransferRequest, U as UserCredentialRequest, e as UserCredentialUpdateRequest, f as UserLoginRequest, g as UserUpdateRequest, h as VerificationAttemptRequest, V as VerificationRequest, W as WalletTransactionRequest } from '../walletTransactionRequest-63cd40ad.mjs';
|
|
2
2
|
import '../errors/index.mjs';
|
|
3
|
-
import '../data-
|
|
3
|
+
import '../data-69952249.mjs';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var data = require('../data-efb53250.cjs');
|
|
6
|
+
var identities = require('../identities-93faf1ed.cjs');
|
|
7
|
+
require('../errors/index.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.CardErrorType = data.CardErrorType;
|
|
12
|
+
exports.CardFundingType = data.CardFundingType;
|
|
13
|
+
exports.CardIssuer = data.CardIssuer;
|
|
14
|
+
exports.CardStatus = data.CardStatus;
|
|
15
|
+
exports.CardTransactionType = data.CardTransactionType;
|
|
16
|
+
exports.CardType = data.CardType;
|
|
17
|
+
exports.CommissionType = data.CommissionType;
|
|
18
|
+
exports.DepositNetwork = data.DepositNetwork;
|
|
19
|
+
exports.EntryType = data.EntryType;
|
|
20
|
+
exports.FileFormat = data.FileFormat;
|
|
21
|
+
exports.KYCFileType = data.KYCFileType;
|
|
22
|
+
exports.KYCStatus = data.KYCStatus;
|
|
23
|
+
exports.Phase = data.Phase;
|
|
24
|
+
exports.SavingCategory = data.SavingCategory;
|
|
25
|
+
exports.ServiceProviderCategory = data.ServiceProviderCategory;
|
|
26
|
+
exports.TrackDataMethod = data.TrackDataMethod;
|
|
27
|
+
exports.TransactionStatus = data.TransactionStatus;
|
|
28
|
+
exports.TransferNetwork = data.TransferNetwork;
|
|
29
|
+
exports.UserStatus = data.UserStatus;
|
|
30
|
+
exports.VerificationType = data.VerificationType;
|
|
31
|
+
exports.WalletTransactionType = data.WalletTransactionType;
|
|
32
|
+
exports.AccountQuery = identities.AccountQuery;
|
|
33
|
+
exports.ApiKeyQuery = identities.ApiKeyQuery;
|
|
34
|
+
exports.BalanceEntryQuery = identities.BalanceEntryQuery;
|
|
35
|
+
exports.BillPaymentQuery = identities.BillPaymentQuery;
|
|
36
|
+
exports.CardTransactionQuery = identities.CardTransactionQuery;
|
|
37
|
+
exports.CardsQuery = identities.CardsQuery;
|
|
38
|
+
exports.DepositQuery = identities.DepositQuery;
|
|
39
|
+
exports.KYCFile = identities.KYCFile;
|
|
40
|
+
exports.PageSize = identities.PageSize;
|
|
41
|
+
exports.QueryParams = identities.QueryParams;
|
|
42
|
+
exports.StatementQuery = identities.StatementQuery;
|
|
43
|
+
exports.TOSAgreements = identities.TOSAgreements;
|
|
44
|
+
exports.TransferQuery = identities.TransferQuery;
|
|
45
|
+
exports.UserQuery = identities.UserQuery;
|
|
46
|
+
exports.WalletQuery = identities.WalletQuery;
|
|
47
|
+
exports.WalletTransactionQuery = identities.WalletTransactionQuery;
|
package/build/types/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { f as CardErrorType, C as CardFundingType, a as CardIssuer, b as CardStatus, g as CardTransactionType, c as CardType, h as CommissionType, D as DepositNetwork, E as EntryType, F as FileFormat, K as KYCFileType, k as KYCStatus, P as Phase, S as SavingCategory, i as ServiceProviderCategory, l as TrackDataMethod, T as TransactionStatus, j as TransferNetwork, U as UserStatus, V as VerificationType, W as WalletTransactionType } from '../data-69952249.mjs';
|
|
2
|
+
export { A as AccountQuery, a as ApiKeyQuery, B as BalanceEntryQuery, b as BillPaymentQuery, c as CardTransactionQuery, C as CardsQuery, D as DepositQuery, K as KYCFile, P as PageSize, Q as QueryParams, S as StatementQuery, T as TOSAgreements, d as TransferQuery, U as UserQuery, W as WalletQuery, e as WalletTransactionQuery } from '../identities-5e48f342.mjs';
|
|
2
3
|
import '../errors/index.mjs';
|
|
3
|
-
import '../data-7d3d5fcc.js';
|