@alviere/core 0.8.2 → 0.9.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/index.mjs CHANGED
@@ -133,7 +133,7 @@ const getRSA_PUB_KEY = () => {
133
133
  if (!runtimeConfig.certificate) {
134
134
  initializeFromEnvironment();
135
135
  }
136
- return runtimeConfig.certificate.public_key;
136
+ return runtimeConfig.certificate.public_key.replace(/\\n/g, "").replace(/\r\n/g, "").replace(/\n/g, "").replace(/\r/g, "").trim();
137
137
  };
138
138
  const getCERTIFICATE_ID = () => {
139
139
  if (!runtimeConfig.certificate) {
@@ -1325,6 +1325,27 @@ class PaymentProcessor {
1325
1325
  }
1326
1326
  }
1327
1327
  }
1328
+ class BankInfoApiService {
1329
+ constructor(gateway) {
1330
+ this.gateway = gateway;
1331
+ }
1332
+ async getBankInfo(routingNumber) {
1333
+ return this.gateway.getBankInfo(routingNumber);
1334
+ }
1335
+ }
1336
+ class BankInfoGateway extends AlcoreBase {
1337
+ constructor(jwt, cryptor, logger) {
1338
+ super(jwt, cryptor, logger);
1339
+ this.logger.debug("🔐 BankInfoGateway initialized");
1340
+ }
1341
+ async getBankInfo(routingNumber) {
1342
+ const endpoint = `/bank-info?routing_number=${routingNumber}`;
1343
+ const response = await this.send("GET", endpoint, {});
1344
+ const encrypted = await response.json();
1345
+ const decrypted = await this.decrypt(encrypted);
1346
+ return throwIfApiError(decrypted);
1347
+ }
1348
+ }
1328
1349
  function NewAddCardRequest(params) {
1329
1350
  const { external_id, name, pan, expiry, code, zip } = params;
1330
1351
  const expiryParts = expiry.split("/");
@@ -2259,6 +2280,16 @@ class AlviereCore {
2259
2280
  }
2260
2281
  return this.gateways.get("auth");
2261
2282
  }
2283
+ // Create bank info service
2284
+ createBankInfoService() {
2285
+ if (!this.gateways.has("bankInfo")) {
2286
+ this.gateways.set(
2287
+ "bankInfo",
2288
+ new BankInfoGateway(this.authToken, this.getOrCreateCryptor(), this.logger)
2289
+ );
2290
+ }
2291
+ return new BankInfoApiService(this.gateways.get("bankInfo"));
2292
+ }
2262
2293
  /**
2263
2294
  * Generate scoped JWT for specific account (JWT downgrade)
2264
2295
  * Exchanges the current business-level JWT for a consumer-level JWT
@@ -2362,6 +2393,7 @@ export {
2362
2393
  AlcoreErrorMessages,
2363
2394
  AlviereCore,
2364
2395
  AuthGateway,
2396
+ BankInfoGateway,
2365
2397
  BaseFieldPlugin,
2366
2398
  CERTIFICATE_ID,
2367
2399
  CardNumberPlugin,