@alviere/core 0.10.0 → 0.11.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/dist/entities/interfaces/gateways/legal-texts.interface.d.ts +5 -0
- package/dist/entities/interfaces/gateways/legal-texts.interface.d.ts.map +1 -0
- package/dist/entities/interfaces/gateways/payments.interface.d.ts +2 -1
- package/dist/entities/interfaces/gateways/payments.interface.d.ts.map +1 -1
- package/dist/entities/requests/accounts/accounts.d.ts +1 -0
- package/dist/entities/requests/accounts/accounts.d.ts.map +1 -1
- package/dist/entities/requests/payments/bank-accounts.d.ts +8 -0
- package/dist/entities/requests/payments/bank-accounts.d.ts.map +1 -1
- package/dist/entities/responses/legal-texts/legal-texts.d.ts +13 -0
- package/dist/entities/responses/legal-texts/legal-texts.d.ts.map +1 -0
- package/dist/entities/responses/payments/bank_accounts.d.ts +1 -0
- package/dist/entities/responses/payments/bank_accounts.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -2
- package/dist/index.mjs.map +1 -1
- package/dist/infrastructure/gateways/legal-texts.gateway.d.ts +10 -0
- package/dist/infrastructure/gateways/legal-texts.gateway.d.ts.map +1 -0
- package/dist/infrastructure/gateways/payments.gateway.d.ts +2 -1
- package/dist/infrastructure/gateways/payments.gateway.d.ts.map +1 -1
- package/dist/services/legal-texts-api.service.d.ts +8 -0
- package/dist/services/legal-texts-api.service.d.ts.map +1 -0
- package/dist/services/payment-processor.service.d.ts +2 -1
- package/dist/services/payment-processor.service.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -896,6 +896,13 @@ class PaymentsGateway extends AlcoreBase {
|
|
|
896
896
|
const response = await this.send("DELETE", endpoint, {});
|
|
897
897
|
return throwIfApiError(response);
|
|
898
898
|
}
|
|
899
|
+
async update_bank_account(accountUuid, uuid, data) {
|
|
900
|
+
const endpoint = `/payment-methods/bank-accounts/${uuid}`;
|
|
901
|
+
const response = await this.send("PATCH", endpoint, data);
|
|
902
|
+
const encrypted = await response.json();
|
|
903
|
+
const decrypted = await this.decrypt(encrypted);
|
|
904
|
+
return throwIfApiError(decrypted);
|
|
905
|
+
}
|
|
899
906
|
}
|
|
900
907
|
class WalletsGateway extends AlcoreBase {
|
|
901
908
|
constructor(jwt, cryptor, logger) {
|
|
@@ -1028,7 +1035,7 @@ class AccountsGateway extends AlcoreBase {
|
|
|
1028
1035
|
}
|
|
1029
1036
|
async manageOnboarding(accountUuid, action) {
|
|
1030
1037
|
const endpoint = `/accounts/${accountUuid}/onboarding`;
|
|
1031
|
-
await this.send("
|
|
1038
|
+
await this.send("PUT", endpoint, { action });
|
|
1032
1039
|
}
|
|
1033
1040
|
async createAddress(accountUuid, data) {
|
|
1034
1041
|
const endpoint = `/accounts/${accountUuid}/addresses`;
|
|
@@ -1330,6 +1337,19 @@ class PaymentProcessor {
|
|
|
1330
1337
|
throw error;
|
|
1331
1338
|
}
|
|
1332
1339
|
}
|
|
1340
|
+
async processUpdateBankAccount(accountUuid, uuid, request) {
|
|
1341
|
+
this.logger.debug("PaymentProcessor: Starting update bank account processing");
|
|
1342
|
+
this.logger.debug("PaymentProcessor: Request data: " + JSON.stringify(request, null, 2));
|
|
1343
|
+
try {
|
|
1344
|
+
const result = await this.gateway.update_bank_account(accountUuid, uuid, request);
|
|
1345
|
+
this.logger.debug("PaymentProcessor: Update bank account processing completed successfully");
|
|
1346
|
+
return result;
|
|
1347
|
+
} catch (error) {
|
|
1348
|
+
this.logger.debug("PaymentProcessor: Update bank account processing failed");
|
|
1349
|
+
this.logger.debug("PaymentProcessor: Error details: " + JSON.stringify(error));
|
|
1350
|
+
throw error;
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1333
1353
|
}
|
|
1334
1354
|
class BankInfoApiService {
|
|
1335
1355
|
constructor(gateway) {
|
|
@@ -1339,6 +1359,14 @@ class BankInfoApiService {
|
|
|
1339
1359
|
return this.gateway.getBankInfo(routingNumber);
|
|
1340
1360
|
}
|
|
1341
1361
|
}
|
|
1362
|
+
class LegalTextsApiService {
|
|
1363
|
+
constructor(gateway) {
|
|
1364
|
+
this.gateway = gateway;
|
|
1365
|
+
}
|
|
1366
|
+
async getLegalTexts(type, version) {
|
|
1367
|
+
return this.gateway.getLegalTexts(type, version);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1342
1370
|
class BankInfoGateway extends AlcoreBase {
|
|
1343
1371
|
constructor(jwt, cryptor, logger) {
|
|
1344
1372
|
super(jwt, cryptor, logger);
|
|
@@ -1352,6 +1380,24 @@ class BankInfoGateway extends AlcoreBase {
|
|
|
1352
1380
|
return throwIfApiError(decrypted);
|
|
1353
1381
|
}
|
|
1354
1382
|
}
|
|
1383
|
+
class LegalTextsGateway extends AlcoreBase {
|
|
1384
|
+
constructor(jwt, cryptor, logger) {
|
|
1385
|
+
super(jwt, cryptor, logger);
|
|
1386
|
+
this.logger.debug("🔐 LegalTextsGateway initialized");
|
|
1387
|
+
}
|
|
1388
|
+
async getLegalTexts(type, version) {
|
|
1389
|
+
const queryParams = new URLSearchParams({ type });
|
|
1390
|
+
if (version) {
|
|
1391
|
+
queryParams.set("version", version);
|
|
1392
|
+
}
|
|
1393
|
+
const endpoint = `/v3/legal-texts?${queryParams.toString()}`;
|
|
1394
|
+
this.logger.debug(`endpoint -> ${endpoint}`);
|
|
1395
|
+
const response = await this.send("GET", endpoint, {});
|
|
1396
|
+
const encrypted = await response.json();
|
|
1397
|
+
const decrypted = await this.decrypt(encrypted);
|
|
1398
|
+
return throwIfApiError(decrypted);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1355
1401
|
function NewAddCardRequest(params) {
|
|
1356
1402
|
const { external_id, name, pan, expiry, code, zip } = params;
|
|
1357
1403
|
const expiryParts = expiry.split("/");
|
|
@@ -1425,12 +1471,13 @@ function createDefaultMerchantDetails() {
|
|
|
1425
1471
|
};
|
|
1426
1472
|
}
|
|
1427
1473
|
function NewAddBankAccountRequest(params) {
|
|
1428
|
-
const { external_id, country, currency, bank_account_details, metadata } = params;
|
|
1474
|
+
const { external_id, country, currency, bank_account_details, primary, metadata } = params;
|
|
1429
1475
|
let data = {
|
|
1430
1476
|
external_id,
|
|
1431
1477
|
country,
|
|
1432
1478
|
currency,
|
|
1433
1479
|
bank_account_details,
|
|
1480
|
+
primary,
|
|
1434
1481
|
metadata
|
|
1435
1482
|
};
|
|
1436
1483
|
data = getSanitizedBody(data);
|
|
@@ -2327,6 +2374,16 @@ class AlviereCore {
|
|
|
2327
2374
|
}
|
|
2328
2375
|
return new BankInfoApiService(this.gateways.get("bankInfo"));
|
|
2329
2376
|
}
|
|
2377
|
+
// Create legal texts service
|
|
2378
|
+
createLegalTextsService() {
|
|
2379
|
+
if (!this.gateways.has("legalTexts")) {
|
|
2380
|
+
this.gateways.set(
|
|
2381
|
+
"legalTexts",
|
|
2382
|
+
new LegalTextsGateway(this.authToken, this.getOrCreateCryptor(), this.logger)
|
|
2383
|
+
);
|
|
2384
|
+
}
|
|
2385
|
+
return new LegalTextsApiService(this.gateways.get("legalTexts"));
|
|
2386
|
+
}
|
|
2330
2387
|
/**
|
|
2331
2388
|
* Generate scoped JWT for specific account (JWT downgrade)
|
|
2332
2389
|
* Exchanges the current business-level JWT for a consumer-level JWT
|