@fabriktor/client 0.0.93 → 0.0.95

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.
@@ -6,6 +6,7 @@
6
6
  import { ColBillableBills, ColBillableCharges, ColBillableEquipments, ColBillableFolders, ColBillableItems, ColBillableLaborRates, ColBillableMeterReadings, ColBillableQuantifiers, ColBillableTaxes, ColBillableTmpBillNumbers, ColBillableVendorInvoices, ColBillableWarehouses, HTTPMethodPost, PathBillableAcceptFixedEstimate, PathBillableCompleteBill, PathBillableCancelBill, PathBillableRetryBillReport, PathBillableFromBill, PathBillableGenerate, PathBillablePeriodsFromDates, PathBillableSetQuantity, PathBillableYearSpan, SvcBillable, } from "@fabriktor/schema";
7
7
  import { requiredToken } from "../core/auth.js";
8
8
  import { newCRUDClient } from "../core/crud.js";
9
+ import { newIdempotencyKey } from "../core/idempotency.js";
9
10
  import { buildPath } from "../core/path.js";
10
11
  export class BillableClient {
11
12
  bills;
@@ -364,6 +365,7 @@ export class BillableClient {
364
365
  base_url: this.base_url,
365
366
  path: billPath(PathBillableYearSpan),
366
367
  method: HTTPMethodPost,
368
+ idempotency_key: newIdempotencyKey(),
367
369
  token,
368
370
  body: opts,
369
371
  });
@@ -374,6 +376,7 @@ export class BillableClient {
374
376
  base_url: this.base_url,
375
377
  path: billPath(PathBillablePeriodsFromDates),
376
378
  method: HTTPMethodPost,
379
+ idempotency_key: newIdempotencyKey(),
377
380
  token,
378
381
  body: opts,
379
382
  });
@@ -4,6 +4,7 @@ import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, Op
4
4
  import type { HTTPDoer, RequestOptions } from "../core/http.js";
5
5
  import type { CompletePayload } from "../core/type.js";
6
6
  export type BalanceOptions = CompletePayload<PLPaymentsBalance>;
7
+ export type OnboardingStatusOptions = Pick<Payment, "recipient_id"> & Pick<RequestOptions, "signal">;
7
8
  export type OnboardingOptions = CompletePayload<PLPaymentsOnboarding>;
8
9
  export type PaymentsBalance = SortStripeBalanceResult;
9
10
  export type OpenPmtPublicSessionOptions = CompletePayload<PLPaymentsOpenPublicSession>;
@@ -65,6 +66,7 @@ export interface PaymentsOperator {
65
66
  deleteOneCreditLedgerEntry(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
66
67
  searchManyCreditLedger(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<CreditLedgerEntry>>>;
67
68
  balance(opts: BalanceOptions, request?: RequestOptions): Promise<OperationResultOf<PaymentsBalance>>;
69
+ onboardingStatus(opts: OnboardingStatusOptions): Promise<OperationResultOf<boolean>>;
68
70
  onboarding(opts: OnboardingOptions): Promise<OperationResultOf<RPPaymentsOnboarding>>;
69
71
  openPmtPublicSession(opts: OpenPmtPublicSessionOptions): Promise<OperationResultOf<PmtPublicSession> | void>;
70
72
  paymentFromPublicSession(opts: PaymentFromPublicSessionOptions): Promise<OperationResult>;
@@ -133,6 +135,7 @@ export declare class PaymentsClient implements PaymentsOperator {
133
135
  deleteOneCreditLedgerEntry(opts: DeleteOneOptionsCRUD): Promise<OperationResult>;
134
136
  searchManyCreditLedger(opts?: SearchManyOptionsCRUD): Promise<OperationResultOf<SearchResultOf<CreditLedgerEntry>>>;
135
137
  balance(opts: BalanceOptions, request?: RequestOptions): Promise<OperationResultOf<PaymentsBalance>>;
138
+ onboardingStatus(opts: OnboardingStatusOptions): Promise<OperationResultOf<boolean>>;
136
139
  onboarding(opts: OnboardingOptions): Promise<OperationResultOf<RPPaymentsOnboarding>>;
137
140
  openPmtPublicSession(opts: OpenPmtPublicSessionOptions): Promise<OperationResultOf<PmtPublicSession> | void>;
138
141
  paymentFromPublicSession(opts: PaymentFromPublicSessionOptions): Promise<OperationResult>;
@@ -3,10 +3,11 @@
3
3
  // Licensed under the Apache License, Version 2.0 (the "License"); you may
4
4
  // not use this file except in compliance with the License. You may obtain
5
5
  // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
- import { ColPaymentsCreditLedger, ColPaymentsPayments, ColPaymentsPmtAccounts, ColPaymentsPmtBankAccounts, ColPaymentsPmtCards, ColPaymentsPmtCustomers, ColPaymentsPmtPublicSessions, ColPaymentsPmtRefunds, HTTPMethodPost, PathPaymentsBalance, PathPaymentsFromPublicSession, PathPaymentsOnboarding, PathPaymentsOpen, PathPaymentsPurchase, PathPaymentsTotal, SvcPayments, } from "@fabriktor/schema";
6
+ import { ColPaymentsCreditLedger, ColPaymentsPayments, ColPaymentsPmtAccounts, ColPaymentsPmtBankAccounts, ColPaymentsPmtCards, ColPaymentsPmtCustomers, ColPaymentsPmtPublicSessions, ColPaymentsPmtRefunds, HTTPMethodPost, HTTPMethodGet, PathPaymentsBalance, PathPaymentsFromPublicSession, PathPaymentsOnboarding, PathPaymentsOpen, PathPaymentsPurchase, PathPaymentsTotal, SvcPayments, } from "@fabriktor/schema";
7
7
  import { requiredToken } from "../core/auth.js";
8
8
  import { newCRUDClient } from "../core/crud.js";
9
9
  import { newIdempotencyKey } from "../core/idempotency.js";
10
+ import { queryParam, withQuery } from "../core/col.js";
10
11
  import { buildPath } from "../core/path.js";
11
12
  export class PaymentsClient {
12
13
  payments;
@@ -238,6 +239,18 @@ export class PaymentsClient {
238
239
  idempotency_key: request?.idempotency_key ?? newIdempotencyKey(),
239
240
  });
240
241
  }
242
+ async onboardingStatus(opts) {
243
+ const token = await requiredToken(this.get_token);
244
+ return await this.http.do({
245
+ base_url: this.base_url,
246
+ path: withQuery(pmtAccountPath(PathPaymentsOnboarding), {
247
+ query: queryParam("recipient_id", opts.recipient_id),
248
+ }),
249
+ method: HTTPMethodGet,
250
+ token,
251
+ signal: opts.signal,
252
+ });
253
+ }
241
254
  async onboarding(opts) {
242
255
  const token = await requiredToken(this.get_token);
243
256
  return await this.http.do({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,6 +17,6 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/schema": "0.0.66"
20
+ "@fabriktor/schema": "0.0.67"
21
21
  }
22
22
  }