@visa-check-r/integrations 0.0.51 → 0.0.52

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.cjs.js CHANGED
@@ -1,5 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+
3
10
  // src/auth.ts
4
11
  var toAsyncTokenProvider = (p) => {
5
12
  if (!p) return async () => null;
@@ -2383,6 +2390,145 @@ var createVisaProfileReviewCommentService = (client) => ({
2383
2390
  }
2384
2391
  });
2385
2392
 
2393
+ // src/services/subscription/types/flutter.ts
2394
+ var createCardObjectResponse = ["cardObjectId", "chargeId"];
2395
+ var getFlutterAccessTokenResponse = ["accessToken"];
2396
+ var createCustomerObjectResponse = ["customerObjectId"];
2397
+
2398
+ // src/services/subscription/types/paystack.ts
2399
+ var paystackInitializePaymentResponse = [
2400
+ "access_code",
2401
+ "authorization_url",
2402
+ "reference"
2403
+ ];
2404
+
2405
+ // src/services/subscription/schemas/flutter-customer.schema.ts
2406
+ var flutterSchema = {
2407
+ createCardObject: (query) => `
2408
+ mutation createCardObject($userId: String!, $card: CardInput!) {
2409
+ createCardObject(userId: $userId, card: $card) {
2410
+ ${query}
2411
+ }
2412
+ }
2413
+ `,
2414
+ getFlutterAccessToken: (query) => `
2415
+ query getFlutterAccessToken($userId: String!) {
2416
+ getFlutterAccessToken(userId: $userId) {
2417
+ ${query}
2418
+ }
2419
+ }
2420
+ `,
2421
+ createCustomerObject: (query) => `
2422
+ mutation createCustomerObject($userId: String!, $customer: CustomerInput!) {
2423
+ createCustomerObject(userId: $userId, customer: $customer) {
2424
+ ${query}
2425
+ }
2426
+ }
2427
+ `
2428
+ // GetFlutterAccessToken
2429
+ };
2430
+
2431
+ // src/services/subscription/flutterwave.service.ts
2432
+ var createFlutterwaveService = (client) => ({
2433
+ async getFlutterAccessToken(input, fetchFields, option) {
2434
+ var _a, _b;
2435
+ const res = await client.request(
2436
+ flutterSchema.getFlutterAccessToken(
2437
+ gqlQueryStringBuilder(
2438
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : getFlutterAccessTokenResponse
2439
+ )
2440
+ ),
2441
+ input,
2442
+ option
2443
+ );
2444
+ return (_b = res.data) == null ? void 0 : _b.getFlutterAccessToken;
2445
+ },
2446
+ async createCardObject(input, fetchFields, option) {
2447
+ var _a, _b;
2448
+ const res = await client.request(
2449
+ flutterSchema.createCardObject(
2450
+ gqlQueryStringBuilder(
2451
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createCardObjectResponse
2452
+ )
2453
+ ),
2454
+ input,
2455
+ option
2456
+ );
2457
+ return (_b = res.data) == null ? void 0 : _b.createCardObject;
2458
+ },
2459
+ async createCustomerObject(input, fetchFields, option) {
2460
+ var _a, _b;
2461
+ const res = await client.request(
2462
+ flutterSchema.createCustomerObject(
2463
+ gqlQueryStringBuilder(
2464
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : createCustomerObjectResponse
2465
+ )
2466
+ ),
2467
+ input,
2468
+ option
2469
+ );
2470
+ return (_b = res.data) == null ? void 0 : _b.createCustomerObject;
2471
+ }
2472
+ });
2473
+
2474
+ // src/services/subscription/encrypt-data.ts
2475
+ async function encryptAES(data, token, nonce) {
2476
+ var _a, _b;
2477
+ if (nonce.length !== 12) {
2478
+ throw new Error("Nonce must be exactly 12 characters long");
2479
+ }
2480
+ const cryptoSubtle = ((_a = globalThis.crypto) == null ? void 0 : _a.subtle) || ((_b = __require("crypto").webcrypto) == null ? void 0 : _b.subtle);
2481
+ if (!cryptoSubtle) {
2482
+ throw new Error("Crypto API is not available in this environment.");
2483
+ }
2484
+ const decodedKeyBytes = Uint8Array.from(atob(token), (c) => c.charCodeAt(0));
2485
+ const key = await cryptoSubtle.importKey(
2486
+ "raw",
2487
+ decodedKeyBytes,
2488
+ { name: "AES-GCM" },
2489
+ false,
2490
+ ["encrypt"]
2491
+ );
2492
+ const iv = new TextEncoder().encode(nonce);
2493
+ const encryptedData = await cryptoSubtle.encrypt(
2494
+ {
2495
+ name: "AES-GCM",
2496
+ iv
2497
+ },
2498
+ key,
2499
+ new TextEncoder().encode(data)
2500
+ );
2501
+ return btoa(String.fromCharCode(...new Uint8Array(encryptedData)));
2502
+ }
2503
+
2504
+ // src/services/subscription/schemas/paystack.ts
2505
+ var paystackSchema = {
2506
+ paystackInitializePayment: (query) => `
2507
+ mutation paystackInitializePayment($userId: String!) {
2508
+ paystackInitializePayment(userId: $userId) {
2509
+ ${query}
2510
+ }
2511
+ }
2512
+ `
2513
+ };
2514
+
2515
+ // src/services/subscription/paystack.service.ts
2516
+ var createPaystackService = (client) => ({
2517
+ async paystackInitializePayment(input, fetchFields, option) {
2518
+ var _a, _b;
2519
+ const res = await client.request(
2520
+ paystackSchema.paystackInitializePayment(
2521
+ gqlQueryStringBuilder(
2522
+ (_a = fetchFields == null ? void 0 : fetchFields.root) != null ? _a : paystackInitializePaymentResponse
2523
+ )
2524
+ ),
2525
+ input,
2526
+ option
2527
+ );
2528
+ return (_b = res.data) == null ? void 0 : _b.paystackInitializePayment;
2529
+ }
2530
+ });
2531
+
2386
2532
  exports.AuthenticationError = AuthenticationError;
2387
2533
  exports.GraphQLClient = GraphQLClient;
2388
2534
  exports.NetworkError = NetworkError;
@@ -2395,6 +2541,7 @@ exports._getVisaProfileReviewCommentResponseNestedFields = _getVisaProfileReview
2395
2541
  exports.compose = compose;
2396
2542
  exports.createActivityLogService = createActivityLogService;
2397
2543
  exports.createAuthService = createAuthService;
2544
+ exports.createCardObjectResponse = createCardObjectResponse;
2398
2545
  exports.createChecklistItemResponse = createChecklistItemResponse;
2399
2546
  exports.createChecklistItemResponseNestedFields = createChecklistItemResponseNestedFields;
2400
2547
  exports.createChecklistItemService = createChecklistItemService;
@@ -2402,6 +2549,9 @@ exports.createConsultantAssignmentResponseFields = createConsultantAssignmentRes
2402
2549
  exports.createConsultantAssignmentResponseNestedFields = createConsultantAssignmentResponseNestedFields;
2403
2550
  exports.createConsultantAssignmentService = createConsultantAssignmentService;
2404
2551
  exports.createConsultantInviteService = createConsultantInviteService;
2552
+ exports.createCustomerObjectResponse = createCustomerObjectResponse;
2553
+ exports.createFlutterwaveService = createFlutterwaveService;
2554
+ exports.createPaystackService = createPaystackService;
2405
2555
  exports.createReadinessScoreReviewResponseFields = createReadinessScoreReviewResponseFields;
2406
2556
  exports.createReadinessScoreReviewResponseNestedFields = createReadinessScoreReviewResponseNestedFields;
2407
2557
  exports.createReadinessScoreReviewService = createReadinessScoreReviewService;
@@ -2437,6 +2587,7 @@ exports.deleteVisaApplicationResponseFields = deleteVisaApplicationResponseField
2437
2587
  exports.deleteVisaProfileChecklistItemResponse = deleteVisaProfileChecklistItemResponse;
2438
2588
  exports.deleteVisaProfileResponse = deleteVisaProfileResponse;
2439
2589
  exports.deleteVisaProfileReviewCommentResponseFields = deleteVisaProfileReviewCommentResponseFields;
2590
+ exports.encryptAES = encryptAES;
2440
2591
  exports.generateSOPResponse = generateSOPResponse;
2441
2592
  exports.generateSOPResponseNestedFields = generateSOPResponseNestedFields;
2442
2593
  exports.getActivityLogResponseFields = getActivityLogResponseFields;
@@ -2446,6 +2597,7 @@ exports.getChecklistItemResponseNestedFields = getChecklistItemResponseNestedFie
2446
2597
  exports.getConsultantAssignmentCountResponseFields = getConsultantAssignmentCountResponseFields;
2447
2598
  exports.getConsultantAssignmentResponseFields = getConsultantAssignmentResponseFields;
2448
2599
  exports.getConsultantAssignmentResponseNestedFields = getConsultantAssignmentResponseNestedFields;
2600
+ exports.getFlutterAccessTokenResponse = getFlutterAccessTokenResponse;
2449
2601
  exports.getGeneratedSOPResponse = getGeneratedSOPResponse;
2450
2602
  exports.getGeneratedSOPResponseNestedFields = getGeneratedSOPResponseNestedFields;
2451
2603
  exports.getJobResponse = getJobResponse;
@@ -2487,6 +2639,7 @@ exports.listVisaProfilesResponseNestedFields = listVisaProfilesResponseNestedFie
2487
2639
  exports.loginResponseFields = loginResponseFields;
2488
2640
  exports.meResponseFields = meResponseFields;
2489
2641
  exports.meResponseNestedFields = meResponseNestedFields;
2642
+ exports.paystackInitializePaymentResponse = paystackInitializePaymentResponse;
2490
2643
  exports.resetPasswordResponseFields = resetPasswordResponseFields;
2491
2644
  exports.sendOTPResponseFields = sendOTPResponseFields;
2492
2645
  exports.signUpResponseFields = signUpResponseFields;