@spritz-finance/service-client 0.5.7 → 0.6.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.
Files changed (45) hide show
  1. package/lib/bridge/bridgeServiceClient.d.ts +1 -1
  2. package/lib/bridge/bridgeServiceClient.js +24 -14
  3. package/lib/checkbook/checkbookServiceClient.js +20 -10
  4. package/lib/createGraphClient.js +1 -0
  5. package/lib/credentials.js +18 -8
  6. package/lib/exchangeRates/exchangeRatesServiceClient.js +19 -9
  7. package/lib/features/featuresServiceClient.js +23 -13
  8. package/lib/graphTypes.d.ts +91 -0
  9. package/lib/graphTypes.js +100 -0
  10. package/lib/growth/growthServiceClient.d.ts +1 -1
  11. package/lib/growth/growthServiceClient.js +23 -13
  12. package/lib/index.d.ts +1 -0
  13. package/lib/index.js +1 -0
  14. package/lib/liabilities/liabilitiesServiceClient.d.ts +4 -4
  15. package/lib/liabilities/liabilitiesServiceClient.js +35 -25
  16. package/lib/onramp/onrampServiceClient.d.ts +1 -1
  17. package/lib/onramp/onrampServiceClient.js +22 -12
  18. package/lib/params.d.ts +1 -1
  19. package/lib/params.js +2 -1
  20. package/lib/payableAccounts/payableAccountsServiceClient.d.ts +33 -33
  21. package/lib/payableAccounts/payableAccountsServiceClient.js +28 -18
  22. package/lib/paymentAddress/paymentAddressServiceClient.js +19 -9
  23. package/lib/payments/paymentsClient.d.ts +4 -4
  24. package/lib/payments/paymentsClient.js +35 -25
  25. package/lib/payouts/payoutsServiceClient.d.ts +1 -1
  26. package/lib/payouts/payoutsServiceClient.js +22 -12
  27. package/lib/payouts/types.js +1 -2
  28. package/lib/platform/platformServiceClient.d.ts +5 -1
  29. package/lib/platform/platformServiceClient.js +45 -9
  30. package/lib/platform/types.d.ts +60 -0
  31. package/lib/rain/rainServiceClient.d.ts +1 -1
  32. package/lib/rain/rainServiceClient.js +31 -21
  33. package/lib/serviceClient.js +1 -0
  34. package/lib/transactions/transactionsServiceClient.js +24 -14
  35. package/lib/unblock/unblockServiceClient.js +24 -14
  36. package/lib/users/usersServiceClient.d.ts +2 -2
  37. package/lib/users/usersServiceClient.js +26 -16
  38. package/lib/utils.js +5 -6
  39. package/lib/verification/verificationServiceClient.js +25 -15
  40. package/lib/web3/web3ServiceClient.js +25 -15
  41. package/package.json +7 -8
  42. package/lib/graphClient.test.d.ts +0 -1
  43. package/lib/graphClient.test.js +0 -118
  44. package/lib/serviceClient.test.d.ts +0 -1
  45. package/lib/serviceClient.test.js +0 -187
@@ -7,7 +7,7 @@ export declare function getTransferHashes(externalPaymentIds: string[]): Promise
7
7
  hash: string | null;
8
8
  }>>;
9
9
  export declare function createBridgeBankAccount(userId: string, accountId: string, input: CreateBridgeAccountParams): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeExternalAccount>>;
10
- export declare function getBridgeUser(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeUser>>;
10
+ export declare function getBridgeUser(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<BridgeUser | null>>;
11
11
  export declare function validateTransfer({ userId, transferId, amount, toAddress, }: {
12
12
  userId: string;
13
13
  transferId: string;
@@ -15,15 +15,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getExternalPayments = exports.createBridgeTransfer = exports.validateTransfer = exports.getBridgeUser = exports.createBridgeBankAccount = exports.getTransferHashes = exports.BridgeClient = void 0;
36
+ exports.BridgeClient = void 0;
37
+ exports.getTransferHashes = getTransferHashes;
38
+ exports.createBridgeBankAccount = createBridgeBankAccount;
39
+ exports.getBridgeUser = getBridgeUser;
40
+ exports.validateTransfer = validateTransfer;
41
+ exports.createBridgeTransfer = createBridgeTransfer;
42
+ exports.getExternalPayments = getExternalPayments;
27
43
  exports.BridgeClient = __importStar(require("./bridgeServiceClient"));
28
44
  const serviceClient_1 = require("../serviceClient");
29
45
  const ONRAMP_ENDPOINT = "/bridge";
@@ -33,19 +49,16 @@ async function getTransferHashes(externalPaymentIds) {
33
49
  .post(`${ONRAMP_ROUTER_ENDPOINT}/off-ramps/blockchain-transactions`, { externalPaymentIds })
34
50
  .then((res) => res.data);
35
51
  }
36
- exports.getTransferHashes = getTransferHashes;
37
52
  async function createBridgeBankAccount(userId, accountId, input) {
38
53
  return serviceClient_1.baseClient
39
54
  .post(`${ONRAMP_ENDPOINT}/user/${userId}/bank-account/${accountId}`, input)
40
55
  .then((res) => res.data);
41
56
  }
42
- exports.createBridgeBankAccount = createBridgeBankAccount;
43
57
  async function getBridgeUser(userId) {
44
58
  return serviceClient_1.baseClient
45
59
  .get(`${ONRAMP_ENDPOINT}/user/${userId}`)
46
60
  .then((res) => res.data);
47
61
  }
48
- exports.getBridgeUser = getBridgeUser;
49
62
  async function validateTransfer({ userId, transferId, amount, toAddress, }) {
50
63
  return serviceClient_1.baseClient
51
64
  .post(`${ONRAMP_ENDPOINT}/transfer/validate`, {
@@ -56,16 +69,13 @@ async function validateTransfer({ userId, transferId, amount, toAddress, }) {
56
69
  })
57
70
  .then((res) => res.data);
58
71
  }
59
- exports.validateTransfer = validateTransfer;
60
72
  async function createBridgeTransfer(userId, input) {
61
73
  return serviceClient_1.baseClient
62
74
  .post(`${ONRAMP_ENDPOINT}/user/${userId}/transfer`, input)
63
75
  .then((res) => res.data);
64
76
  }
65
- exports.createBridgeTransfer = createBridgeTransfer;
66
77
  async function getExternalPayments(paymentIds) {
67
78
  return serviceClient_1.baseClient
68
79
  .get(`${ONRAMP_ENDPOINT}/external-payments?paymentIds=${paymentIds.join(",")}`)
69
80
  .then((res) => res.data);
70
81
  }
71
- exports.getExternalPayments = getExternalPayments;
@@ -15,15 +15,27 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getBatchBalances = exports.triggerBatch = exports.CheckbookClient = void 0;
36
+ exports.CheckbookClient = void 0;
37
+ exports.triggerBatch = triggerBatch;
38
+ exports.getBatchBalances = getBatchBalances;
27
39
  exports.CheckbookClient = __importStar(require("./checkbookServiceClient"));
28
40
  const serviceClient_1 = require("../serviceClient");
29
41
  const CHECKBOOK_ENDPOINT = "/liabilities";
@@ -37,10 +49,8 @@ async function triggerBatch({ config, configs, reserve, currency, }) {
37
49
  })
38
50
  .then((res) => res.data);
39
51
  }
40
- exports.triggerBatch = triggerBatch;
41
52
  async function getBatchBalances() {
42
53
  return serviceClient_1.baseClient
43
54
  .get(`${CHECKBOOK_ENDPOINT}/checkbook/batch/balances`)
44
55
  .then((res) => res.data);
45
56
  }
46
- exports.getBatchBalances = getBatchBalances;
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createGraphClient = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ // @ts-expect-error no type declarations for axios-token-interceptor
8
9
  const axios_token_interceptor_1 = __importDefault(require("axios-token-interceptor"));
9
10
  const logger_1 = __importDefault(require("@spritz-finance/logger"));
10
11
  const credentials_1 = require("./credentials");
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
@@ -36,7 +46,7 @@ const qs = __importStar(require("qs"));
36
46
  const config_1 = require("./config");
37
47
  const params_1 = require("./params");
38
48
  function createSecret(key) {
39
- return (0, crypto_1.createSecretKey)(Buffer.from(key, "utf8"));
49
+ return (0, crypto_1.createSecretKey)(Uint8Array.from(Buffer.from(key, "utf8")));
40
50
  }
41
51
  async function createJWT(secretKey, expMinutes = 30) {
42
52
  const now = Math.floor(Date.now() / 1000);
@@ -15,15 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getLatestRate = exports.ExchangeRatesClient = void 0;
36
+ exports.ExchangeRatesClient = void 0;
37
+ exports.getLatestRate = getLatestRate;
27
38
  exports.ExchangeRatesClient = __importStar(require("./exchangeRatesServiceClient"));
28
39
  const serviceClient_1 = require("../serviceClient");
29
40
  const EXCHANGE_RATE_ENDPOINT = "/exchange-rates";
@@ -37,4 +48,3 @@ async function getLatestRate(target, base = "USD") {
37
48
  })
38
49
  .then((res) => res.data);
39
50
  }
40
- exports.getLatestRate = getLatestRate;
@@ -15,15 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isFeatureEnabled = exports.isPaymentsEnabled = exports.isFeatureFlagEnabled = exports.getFeatureFlags = exports.updateFeatureFlag = exports.FeaturesClient = void 0;
36
+ exports.FeaturesClient = void 0;
37
+ exports.updateFeatureFlag = updateFeatureFlag;
38
+ exports.getFeatureFlags = getFeatureFlags;
39
+ exports.isFeatureFlagEnabled = isFeatureFlagEnabled;
40
+ exports.isPaymentsEnabled = isPaymentsEnabled;
41
+ exports.isFeatureEnabled = isFeatureEnabled;
27
42
  exports.FeaturesClient = __importStar(require("./featuresServiceClient"));
28
43
  const serviceClient_1 = require("../serviceClient");
29
44
  const utils_1 = require("../utils");
@@ -67,11 +82,9 @@ function updateFeatureFlag(input) {
67
82
  };
68
83
  return serviceClient_1.baseClient.post(FEATURES_ENDPOINT, payload);
69
84
  }
70
- exports.updateFeatureFlag = updateFeatureFlag;
71
85
  async function getFeatureFlags() {
72
86
  return serviceClient_1.baseClient.get(FEATURES_ENDPOINT).then((res) => res.data);
73
87
  }
74
- exports.getFeatureFlags = getFeatureFlags;
75
88
  async function isFeatureFlagEnabled(flag) {
76
89
  var _a, _b;
77
90
  const response = await getFeatureFlags();
@@ -80,7 +93,6 @@ async function isFeatureFlagEnabled(flag) {
80
93
  const flags = response.data;
81
94
  return (_b = (_a = flags[flag]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : false;
82
95
  }
83
- exports.isFeatureFlagEnabled = isFeatureFlagEnabled;
84
96
  async function getFlags() {
85
97
  const response = await getFeatureFlags();
86
98
  if ((0, utils_1.isApiError)(response))
@@ -100,7 +112,6 @@ async function isPaymentsEnabled(network, allFlags) {
100
112
  // this will default to true if we have not handled the network yet
101
113
  return networkFlag ? ((_c = (_b = flags[networkFlag]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : true) : true;
102
114
  }
103
- exports.isPaymentsEnabled = isPaymentsEnabled;
104
115
  /**
105
116
  * Synchronously checks if a feature flag is enabled from a provided flags object.
106
117
  * Use this when you already have the flags and want to avoid refetching them.
@@ -112,4 +123,3 @@ async function isFeatureEnabled(flag, allFlags) {
112
123
  return false;
113
124
  return (_b = (_a = flags[flag]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : false;
114
125
  }
115
- exports.isFeatureEnabled = isFeatureEnabled;
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Shared enums and types extracted from the GraphQL schema.
3
+ *
4
+ * These are re-exported as top-level service-client exports so consumers
5
+ * don't need to reach into `lib/lib/graphClient/generated`.
6
+ */
7
+ export declare enum AccountProvider {
8
+ Bridge = "BRIDGE",
9
+ Checkbook = "CHECKBOOK",
10
+ MethodFi = "METHOD_FI",
11
+ Rain = "RAIN",
12
+ Unblock = "UNBLOCK"
13
+ }
14
+ export declare enum BasicPayableAccountType {
15
+ BankAccount = "BANK_ACCOUNT",
16
+ Bill = "BILL",
17
+ DebitCard = "DEBIT_CARD",
18
+ PayOthers = "PAY_OTHERS",
19
+ SpritzCard = "SPRITZ_CARD"
20
+ }
21
+ export declare enum BillType {
22
+ AutoLoan = "AutoLoan",
23
+ CreditCard = "CreditCard",
24
+ Loan = "Loan",
25
+ MobilePhone = "MobilePhone",
26
+ Mortgage = "Mortgage",
27
+ StudentLoan = "StudentLoan",
28
+ Unknown = "Unknown",
29
+ Utility = "Utility"
30
+ }
31
+ export declare enum ModuleStatus {
32
+ Active = "ACTIVE",
33
+ Disabled = "DISABLED",
34
+ Failed = "FAILED",
35
+ Initialized = "INITIALIZED",
36
+ Loading = "LOADING",
37
+ Retry = "RETRY",
38
+ Unavailable = "UNAVAILABLE",
39
+ UnderReview = "UNDER_REVIEW",
40
+ Uninitialized = "UNINITIALIZED"
41
+ }
42
+ export declare enum OnrampPaymentStatus {
43
+ AwaitingFunds = "AWAITING_FUNDS",
44
+ Cancelled = "CANCELLED",
45
+ Completed = "COMPLETED",
46
+ Failed = "FAILED",
47
+ OnHold = "ON_HOLD",
48
+ Pending = "PENDING",
49
+ Refunded = "REFUNDED",
50
+ Reversed = "REVERSED"
51
+ }
52
+ export declare enum PayableAccountType {
53
+ BankAccount = "BankAccount",
54
+ Bill = "Bill",
55
+ DebitCard = "DebitCard",
56
+ DigitalAccount = "DigitalAccount",
57
+ OneTimePayment = "OneTimePayment",
58
+ VirtualCard = "VirtualCard"
59
+ }
60
+ export declare enum PaymentDeliveryMethod {
61
+ Instant = "INSTANT",
62
+ SameDay = "SAME_DAY",
63
+ Standard = "STANDARD"
64
+ }
65
+ export declare enum PaymentStatus {
66
+ Cancelled = "CANCELLED",
67
+ Completed = "COMPLETED",
68
+ Failed = "FAILED",
69
+ Initialized = "INITIALIZED",
70
+ Pending = "PENDING",
71
+ Refunded = "REFUNDED",
72
+ ReversalInProgress = "REVERSAL_IN_PROGRESS",
73
+ Reversed = "REVERSED",
74
+ Scheduled = "SCHEDULED",
75
+ Sent = "SENT"
76
+ }
77
+ export declare enum ReferralRewardType {
78
+ AffiliateRevenueShare = "AffiliateRevenueShare",
79
+ Referral = "Referral",
80
+ ReferralClub = "ReferralClub",
81
+ Referrer = "Referrer"
82
+ }
83
+ export declare enum ReferralTier {
84
+ Local = "Local",
85
+ Tourist = "Tourist",
86
+ Vip = "VIP"
87
+ }
88
+ export interface UsBankAccountDetails {
89
+ routingNumber: string;
90
+ swiftCode?: string | null;
91
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * Shared enums and types extracted from the GraphQL schema.
4
+ *
5
+ * These are re-exported as top-level service-client exports so consumers
6
+ * don't need to reach into `lib/lib/graphClient/generated`.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ReferralTier = exports.ReferralRewardType = exports.PaymentStatus = exports.PaymentDeliveryMethod = exports.PayableAccountType = exports.OnrampPaymentStatus = exports.ModuleStatus = exports.BillType = exports.BasicPayableAccountType = exports.AccountProvider = void 0;
10
+ var AccountProvider;
11
+ (function (AccountProvider) {
12
+ AccountProvider["Bridge"] = "BRIDGE";
13
+ AccountProvider["Checkbook"] = "CHECKBOOK";
14
+ AccountProvider["MethodFi"] = "METHOD_FI";
15
+ AccountProvider["Rain"] = "RAIN";
16
+ AccountProvider["Unblock"] = "UNBLOCK";
17
+ })(AccountProvider || (exports.AccountProvider = AccountProvider = {}));
18
+ var BasicPayableAccountType;
19
+ (function (BasicPayableAccountType) {
20
+ BasicPayableAccountType["BankAccount"] = "BANK_ACCOUNT";
21
+ BasicPayableAccountType["Bill"] = "BILL";
22
+ BasicPayableAccountType["DebitCard"] = "DEBIT_CARD";
23
+ BasicPayableAccountType["PayOthers"] = "PAY_OTHERS";
24
+ BasicPayableAccountType["SpritzCard"] = "SPRITZ_CARD";
25
+ })(BasicPayableAccountType || (exports.BasicPayableAccountType = BasicPayableAccountType = {}));
26
+ var BillType;
27
+ (function (BillType) {
28
+ BillType["AutoLoan"] = "AutoLoan";
29
+ BillType["CreditCard"] = "CreditCard";
30
+ BillType["Loan"] = "Loan";
31
+ BillType["MobilePhone"] = "MobilePhone";
32
+ BillType["Mortgage"] = "Mortgage";
33
+ BillType["StudentLoan"] = "StudentLoan";
34
+ BillType["Unknown"] = "Unknown";
35
+ BillType["Utility"] = "Utility";
36
+ })(BillType || (exports.BillType = BillType = {}));
37
+ var ModuleStatus;
38
+ (function (ModuleStatus) {
39
+ ModuleStatus["Active"] = "ACTIVE";
40
+ ModuleStatus["Disabled"] = "DISABLED";
41
+ ModuleStatus["Failed"] = "FAILED";
42
+ ModuleStatus["Initialized"] = "INITIALIZED";
43
+ ModuleStatus["Loading"] = "LOADING";
44
+ ModuleStatus["Retry"] = "RETRY";
45
+ ModuleStatus["Unavailable"] = "UNAVAILABLE";
46
+ ModuleStatus["UnderReview"] = "UNDER_REVIEW";
47
+ ModuleStatus["Uninitialized"] = "UNINITIALIZED";
48
+ })(ModuleStatus || (exports.ModuleStatus = ModuleStatus = {}));
49
+ var OnrampPaymentStatus;
50
+ (function (OnrampPaymentStatus) {
51
+ OnrampPaymentStatus["AwaitingFunds"] = "AWAITING_FUNDS";
52
+ OnrampPaymentStatus["Cancelled"] = "CANCELLED";
53
+ OnrampPaymentStatus["Completed"] = "COMPLETED";
54
+ OnrampPaymentStatus["Failed"] = "FAILED";
55
+ OnrampPaymentStatus["OnHold"] = "ON_HOLD";
56
+ OnrampPaymentStatus["Pending"] = "PENDING";
57
+ OnrampPaymentStatus["Refunded"] = "REFUNDED";
58
+ OnrampPaymentStatus["Reversed"] = "REVERSED";
59
+ })(OnrampPaymentStatus || (exports.OnrampPaymentStatus = OnrampPaymentStatus = {}));
60
+ var PayableAccountType;
61
+ (function (PayableAccountType) {
62
+ PayableAccountType["BankAccount"] = "BankAccount";
63
+ PayableAccountType["Bill"] = "Bill";
64
+ PayableAccountType["DebitCard"] = "DebitCard";
65
+ PayableAccountType["DigitalAccount"] = "DigitalAccount";
66
+ PayableAccountType["OneTimePayment"] = "OneTimePayment";
67
+ PayableAccountType["VirtualCard"] = "VirtualCard";
68
+ })(PayableAccountType || (exports.PayableAccountType = PayableAccountType = {}));
69
+ var PaymentDeliveryMethod;
70
+ (function (PaymentDeliveryMethod) {
71
+ PaymentDeliveryMethod["Instant"] = "INSTANT";
72
+ PaymentDeliveryMethod["SameDay"] = "SAME_DAY";
73
+ PaymentDeliveryMethod["Standard"] = "STANDARD";
74
+ })(PaymentDeliveryMethod || (exports.PaymentDeliveryMethod = PaymentDeliveryMethod = {}));
75
+ var PaymentStatus;
76
+ (function (PaymentStatus) {
77
+ PaymentStatus["Cancelled"] = "CANCELLED";
78
+ PaymentStatus["Completed"] = "COMPLETED";
79
+ PaymentStatus["Failed"] = "FAILED";
80
+ PaymentStatus["Initialized"] = "INITIALIZED";
81
+ PaymentStatus["Pending"] = "PENDING";
82
+ PaymentStatus["Refunded"] = "REFUNDED";
83
+ PaymentStatus["ReversalInProgress"] = "REVERSAL_IN_PROGRESS";
84
+ PaymentStatus["Reversed"] = "REVERSED";
85
+ PaymentStatus["Scheduled"] = "SCHEDULED";
86
+ PaymentStatus["Sent"] = "SENT";
87
+ })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
88
+ var ReferralRewardType;
89
+ (function (ReferralRewardType) {
90
+ ReferralRewardType["AffiliateRevenueShare"] = "AffiliateRevenueShare";
91
+ ReferralRewardType["Referral"] = "Referral";
92
+ ReferralRewardType["ReferralClub"] = "ReferralClub";
93
+ ReferralRewardType["Referrer"] = "Referrer";
94
+ })(ReferralRewardType || (exports.ReferralRewardType = ReferralRewardType = {}));
95
+ var ReferralTier;
96
+ (function (ReferralTier) {
97
+ ReferralTier["Local"] = "Local";
98
+ ReferralTier["Tourist"] = "Tourist";
99
+ ReferralTier["Vip"] = "VIP";
100
+ })(ReferralTier || (exports.ReferralTier = ReferralTier = {}));
@@ -1,7 +1,7 @@
1
1
  export * as GrowthClient from "./growthServiceClient";
2
2
  import { PayableAccountType } from "../lib/graphClient/generated";
3
3
  import { PointsRedemption, PointsRedemptionOption } from "./types";
4
- export declare function getUserReferrer(userId: string): Promise<string>;
4
+ export declare function getUserReferrer(userId: string): Promise<string | null>;
5
5
  export declare function initializePointsRedemption(input: {
6
6
  userId: string;
7
7
  paymentRequestId: string;
@@ -15,15 +15,30 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.confirmPointsRedemption = exports.validatePointsRedemption = exports.getPointsRedemptionOption = exports.initializePointsRedemption = exports.getUserReferrer = exports.GrowthClient = void 0;
36
+ exports.GrowthClient = void 0;
37
+ exports.getUserReferrer = getUserReferrer;
38
+ exports.initializePointsRedemption = initializePointsRedemption;
39
+ exports.getPointsRedemptionOption = getPointsRedemptionOption;
40
+ exports.validatePointsRedemption = validatePointsRedemption;
41
+ exports.confirmPointsRedemption = confirmPointsRedemption;
27
42
  exports.GrowthClient = __importStar(require("./growthServiceClient"));
28
43
  const serviceClient_1 = require("../serviceClient");
29
44
  const GROWTH_ENDPOINT = "/growth";
@@ -32,28 +47,23 @@ async function getUserReferrer(userId) {
32
47
  .get(`${GROWTH_ENDPOINT}/referrals/referrer/${userId}`)
33
48
  .then((res) => res.data);
34
49
  }
35
- exports.getUserReferrer = getUserReferrer;
36
50
  async function initializePointsRedemption(input) {
37
51
  return serviceClient_1.baseClient
38
52
  .post(`${GROWTH_ENDPOINT}/v2/points/redemption/initialize`, input)
39
53
  .then((res) => res.data);
40
54
  }
41
- exports.initializePointsRedemption = initializePointsRedemption;
42
55
  async function getPointsRedemptionOption(input) {
43
56
  return serviceClient_1.baseClient
44
57
  .post(`${GROWTH_ENDPOINT}/v2/points/redemption/option`, input)
45
58
  .then((res) => res.data);
46
59
  }
47
- exports.getPointsRedemptionOption = getPointsRedemptionOption;
48
60
  async function validatePointsRedemption(input) {
49
61
  return serviceClient_1.baseClient
50
62
  .post(`${GROWTH_ENDPOINT}/v2/points/redemption/validate`, input)
51
63
  .then((res) => res.data);
52
64
  }
53
- exports.validatePointsRedemption = validatePointsRedemption;
54
65
  async function confirmPointsRedemption(input) {
55
66
  return serviceClient_1.baseClient
56
67
  .post(`${GROWTH_ENDPOINT}/v2/points/redemption/confirm`, input)
57
68
  .then((res) => res.data);
58
69
  }
59
- exports.confirmPointsRedemption = confirmPointsRedemption;
package/lib/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./exchangeRates/types";
7
7
  export { FeaturesClient } from "./features/featuresServiceClient";
8
8
  export * from "./features/types";
9
9
  export * from "./graphClient";
10
+ export * from "./graphTypes";
10
11
  export { GrowthClient } from "./growth/growthServiceClient";
11
12
  export * from "./growth/types";
12
13
  export { LiabilitiesClient } from "./liabilities/liabilitiesServiceClient";
package/lib/index.js CHANGED
@@ -28,6 +28,7 @@ var featuresServiceClient_1 = require("./features/featuresServiceClient");
28
28
  Object.defineProperty(exports, "FeaturesClient", { enumerable: true, get: function () { return featuresServiceClient_1.FeaturesClient; } });
29
29
  __exportStar(require("./features/types"), exports);
30
30
  __exportStar(require("./graphClient"), exports);
31
+ __exportStar(require("./graphTypes"), exports);
31
32
  var growthServiceClient_1 = require("./growth/growthServiceClient");
32
33
  Object.defineProperty(exports, "GrowthClient", { enumerable: true, get: function () { return growthServiceClient_1.GrowthClient; } });
33
34
  __exportStar(require("./growth/types"), exports);
@@ -4,16 +4,16 @@ import { ExternalBillInput } from "../payableAccounts/types";
4
4
  import { CheckbookCardResponse, CheckbookDebitCardResponse, CheckbookDigitalAccountResponse, CheckbookUpdateCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateDigitalAccountInput, CreateEntityParams, DirectPaymentResponse, MethodFiEntity, RewardTransaction } from "./types";
5
5
  export declare function getRewardTransaction(transactionId: string): Promise<RewardTransaction>;
6
6
  export declare function createMethodFiEntity(args: CreateEntityParams): Promise<MethodFiEntity>;
7
- export declare function getMethodFiEntity(userId: string): Promise<MethodFiEntity>;
8
- export declare function createCheckbookUser(args: CreateCheckbookUserParams): Promise<CheckbookUser>;
7
+ export declare function getMethodFiEntity(userId: string): Promise<MethodFiEntity | null>;
8
+ export declare function createCheckbookUser(args: CreateCheckbookUserParams): Promise<CheckbookUser | null>;
9
9
  export declare function upsertCheckbookUser(args: CreateCheckbookUserParams): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CheckbookUser>>;
10
- export declare function getCheckbookUser(userId: string): Promise<CheckbookUser>;
10
+ export declare function getCheckbookUser(userId: string): Promise<CheckbookUser | null>;
11
11
  export declare function createCheckbookVirtualCard(userId: string): Promise<CheckbookCardResponse>;
12
12
  export declare function createCheckbookDebitCard(input: CreateDebitCardInput): Promise<CheckbookDebitCardResponse>;
13
13
  export declare function createCheckbookDigitalAccount(input: CreateDigitalAccountInput): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CheckbookDigitalAccountResponse>>;
14
14
  export declare function createUSBillFromAccountNumber(userId: string, accountNumber: string, merchantId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<ExternalBillInput>>;
15
15
  export declare function getVirtualCardBalance(cardExternalId: string, userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<number>>;
16
- export declare function getUserIdForDirectPayment(directPaymentId: string): Promise<string>;
16
+ export declare function getUserIdForDirectPayment(directPaymentId: string): Promise<string | null>;
17
17
  export declare function updateCheckbookVirtualCard(userId: string, cardExternalId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<CheckbookUpdateCardResponse>>;
18
18
  export declare function addPromotionCredit(input: {
19
19
  userId: string;