@spritz-finance/service-client 0.5.2 → 0.5.4

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.
@@ -1,7 +1,7 @@
1
1
  export * as LiabilitiesClient from './liabilitiesServiceClient';
2
2
  import { CheckbookUser } from '../lib/graphClient/generated';
3
3
  import { ExternalBillInput } from '../payableAccounts/types';
4
- import { CheckbookCardResponse, CheckbookDebitCardResponse, CheckbookDigitalAccountResponse, CheckbookUpdateCardResponse, CreateCheckbookUserParams, CreateDebitCardInput, CreateDigitalAccountInput, CreateEntityParams, MethodFiEntity, RewardTransaction } from './types';
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
7
  export declare function getMethodFiEntity(userId: string): Promise<MethodFiEntity>;
@@ -26,3 +26,4 @@ export declare function addCashbackCredit(input: {
26
26
  rewardId: string;
27
27
  }): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RewardTransaction>>;
28
28
  export declare function getRewardTransactionsFor(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<RewardTransaction[]>>;
29
+ export declare function getDirectPayment(directPaymentId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<DirectPaymentResponse>>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getRewardTransactionsFor = exports.addCashbackCredit = exports.addPromotionCredit = exports.updateCheckbookVirtualCard = exports.getUserIdForDirectPayment = exports.getVirtualCardBalance = exports.createUSBillFromAccountNumber = exports.createCheckbookDigitalAccount = exports.createCheckbookDebitCard = exports.createCheckbookVirtualCard = exports.getCheckbookUser = exports.upsertCheckbookUser = exports.createCheckbookUser = exports.getMethodFiEntity = exports.createMethodFiEntity = exports.getRewardTransaction = exports.LiabilitiesClient = void 0;
26
+ exports.getDirectPayment = exports.getRewardTransactionsFor = exports.addCashbackCredit = exports.addPromotionCredit = exports.updateCheckbookVirtualCard = exports.getUserIdForDirectPayment = exports.getVirtualCardBalance = exports.createUSBillFromAccountNumber = exports.createCheckbookDigitalAccount = exports.createCheckbookDebitCard = exports.createCheckbookVirtualCard = exports.getCheckbookUser = exports.upsertCheckbookUser = exports.createCheckbookUser = exports.getMethodFiEntity = exports.createMethodFiEntity = exports.getRewardTransaction = exports.LiabilitiesClient = void 0;
27
27
  exports.LiabilitiesClient = __importStar(require("./liabilitiesServiceClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const LIABILITIES_ENDPOINT = '/liabilities';
@@ -129,3 +129,10 @@ async function getRewardTransactionsFor(userId) {
129
129
  .then((res) => res.data);
130
130
  }
131
131
  exports.getRewardTransactionsFor = getRewardTransactionsFor;
132
+ const LIABILITIES_V2_ENDPOINT = '/v2/liabilities/api';
133
+ async function getDirectPayment(directPaymentId) {
134
+ return serviceClient_1.baseClient
135
+ .get(`${LIABILITIES_V2_ENDPOINT}/direct-payment/${directPaymentId}`)
136
+ .then((res) => res.data);
137
+ }
138
+ exports.getDirectPayment = getDirectPayment;
@@ -200,4 +200,110 @@ export type CheckbookUpdateCardResponse = {
200
200
  email: string;
201
201
  holder: string;
202
202
  };
203
+ export type DirectPaymentResponse = {
204
+ _id: string;
205
+ id: string;
206
+ userId: string;
207
+ accountId: string;
208
+ createdAt: string;
209
+ updatedAt: string;
210
+ status: 'CREATED' | 'TRANSACTION_PENDING' | 'TRANSACTION_FAILED' | 'INSUFFICIENT_FUNDS' | 'CONFIRMED' | 'PENDING' | 'FAILED' | 'FAILED_VALIDATION' | 'REFUNDED' | 'COMPLETED';
211
+ toAddress: string;
212
+ amount: number;
213
+ rewardsAmount: number;
214
+ feeAmount: number;
215
+ feeSubsidyAmount: number;
216
+ transactionFee: number;
217
+ feeDiscount: number;
218
+ source: 'Web' | 'Mobile' | 'MobileIOS' | 'MobileAndroid' | 'ExodusDappBrowser' | 'SuiWalletDappBrowser' | 'Integrator' | 'Widget' | 'PaymentAddress' | 'Subscription' | 'External' | 'Admin';
219
+ deliveryMethod: 'INSTANT' | 'STANDARD' | 'SAME_DAY';
220
+ tokenAddress: string;
221
+ network: string;
222
+ targetCurrency: string;
223
+ targetCurrencyRate: number;
224
+ targetCurrencyFee: number;
225
+ targetCurrencyAmount: number;
226
+ isToPaymentAddress: boolean;
227
+ paymentId: string;
228
+ amountDue: number;
229
+ totalAmount: number;
230
+ from?: string[];
231
+ instantPaymentFeeExempt?: boolean;
232
+ transactionHash?: string;
233
+ compoundTransactionIdentifier?: number;
234
+ transaction?: TransactionReference;
235
+ transactionReferences: TransactionReference[];
236
+ pointsRedemptionId?: string;
237
+ pointsRedemptionAmount?: number;
238
+ pointsRedemptionDiscount?: number;
239
+ paymentNote?: string;
240
+ pendingAlertAt?: string;
241
+ subscriptionId?: string;
242
+ utxoInvoiceId?: string;
243
+ message?: string;
244
+ paymentProvider?: 'METHOD_FI' | 'CHECKBOOK' | 'UNBLOCK' | 'BRIDGE' | 'RAIN';
245
+ externalPaymentId?: string;
246
+ integratorId?: string;
247
+ paymentAsset?: PaymentAssetResponse;
248
+ outputAsset?: PaymentAssetResponse;
249
+ invoice: InvoiceResponse | null;
250
+ };
251
+ interface TransactionReference {
252
+ hash: string;
253
+ network: string;
254
+ status: 'PENDING' | 'CONFIRMED';
255
+ asset?: string;
256
+ value?: number;
257
+ sourceToken?: PaymentEventToken;
258
+ paymentToken?: PaymentEventToken;
259
+ from?: string[];
260
+ to?: string;
261
+ }
262
+ interface PaymentEventToken {
263
+ address: string;
264
+ amountRaw: string;
265
+ amount: number;
266
+ decimals: number;
267
+ symbol: string;
268
+ }
269
+ interface PaymentAssetResponse {
270
+ symbol: string;
271
+ quantity: number;
272
+ usdMarketRate: number;
273
+ usdQuotedRate: number;
274
+ usdValue: number;
275
+ usdValueQuoted: number;
276
+ spread: number;
277
+ }
278
+ interface InvoiceResponse {
279
+ _id: string;
280
+ network: string;
281
+ address: string;
282
+ paymentReference: string;
283
+ expiry: string;
284
+ amountFiat: number;
285
+ amount: number;
286
+ marketRate: number;
287
+ quotedRate: number;
288
+ spreadAmount: number;
289
+ spread: number;
290
+ amountFiatAdjusted: number;
291
+ tokenAddress: string;
292
+ symbol: string;
293
+ status: 'CREATED' | 'PENDING' | 'CONFIRMED' | 'INSUFFICCIENT' | 'TRANSFERRED';
294
+ createdAt: string;
295
+ checked: boolean;
296
+ harvested: number;
297
+ decimals: number;
298
+ sweepTransaction?: unknown;
299
+ transaction?: {
300
+ transactionId: string;
301
+ amount: number;
302
+ direction: string;
303
+ firstSeenInMempool: string;
304
+ blockHash?: string;
305
+ blockTimestamp?: string;
306
+ from?: string[];
307
+ };
308
+ }
203
309
  export {};
@@ -57,3 +57,6 @@ export declare function getAllPaymentsForUser(userId: string): Promise<import(".
57
57
  export declare function getUserPaymentById(userId: string, paymentId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Payment>>;
58
58
  export declare function directPaymentsForRiskAnalysis(userId: string): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<DirectPaymentModel[]>>;
59
59
  export declare function queryUserPayments(userId: string, input?: PaymentQueryFilter): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<Payment[]>>;
60
+ export declare function getVoidedLiabilities(): Promise<import("../types").ApiFailure | import("../types").ApiSuccess<{
61
+ total: number;
62
+ }>>;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.queryUserPayments = exports.directPaymentsForRiskAnalysis = exports.getUserPaymentById = exports.getAllPaymentsForUser = exports.getDirectPaymentDetails = exports.getDirectPaymentToken = exports.updateExternalPaymentStatus = exports.scheduleExternalPayment = exports.initializeExternalPayment = exports.getRewardFeeAmount = exports.getRewardTransactionVolume = exports.getValidPaymentsForUser = exports.getValidPaymentsForAccount = exports.validateDirectPayment = exports.validatePaymentAmount = exports.createDirectPayment = exports.PaymentsClient = void 0;
26
+ exports.getVoidedLiabilities = exports.queryUserPayments = exports.directPaymentsForRiskAnalysis = exports.getUserPaymentById = exports.getAllPaymentsForUser = exports.getDirectPaymentDetails = exports.getDirectPaymentToken = exports.updateExternalPaymentStatus = exports.scheduleExternalPayment = exports.initializeExternalPayment = exports.getRewardFeeAmount = exports.getRewardTransactionVolume = exports.getValidPaymentsForUser = exports.getValidPaymentsForAccount = exports.validateDirectPayment = exports.validatePaymentAmount = exports.createDirectPayment = exports.PaymentsClient = void 0;
27
27
  exports.PaymentsClient = __importStar(require("./paymentsClient"));
28
28
  const serviceClient_1 = require("../serviceClient");
29
29
  const PAYMENTS_ENDPOINT = "/liabilities";
@@ -127,3 +127,9 @@ async function queryUserPayments(userId, input = {}) {
127
127
  .then((res) => res.data);
128
128
  }
129
129
  exports.queryUserPayments = queryUserPayments;
130
+ async function getVoidedLiabilities() {
131
+ return serviceClient_1.baseClient
132
+ .get(`${PAYMENTS_ROUTER_ENDPOINT}/checkbook/voided-liabilities`)
133
+ .then((res) => res.data);
134
+ }
135
+ exports.getVoidedLiabilities = getVoidedLiabilities;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/service-client",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "gitHead": "06f8e96b7b38c34df26a38da329331940675e4f8",
5
5
  "description": "Service client",
6
6
  "license": "ISC",