@fabriktor/client 0.0.107 → 0.0.109

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,4 +1,4 @@
1
- import { type CreditLedgerEntry, type InCreditLedgerEntry, type InPayment, type InPmtAccount, type InPmtBankAccount, type InPmtCard, type InPmtCustomer, type InPmtPublicSession, type InPmtRefund, type OperationResult, type Payment, type PLPaymentsBalance, type PLPaymentsOnboarding, type PLPaymentsOpenPublicSession, type PLPaymentsPaymentFromPublicSession, type PLPaymentsPurchaseCredits, type PLPaymentsTotalCredits, type PmtAccount, type PmtBankAccount, type PmtCard, type PmtCustomer, type PmtPublicSession, type PmtRefund, type RPPaymentsOnboarding, type RPPaymentsTotalCredits, type SortStripeBalanceResult } from "@fabriktor/schema";
1
+ import { type CreditGrant, type CreditLedgerEntry, type InCreditLedgerEntry, type InPayment, type InPmtAccount, type InPmtBankAccount, type InPmtCard, type InPmtCustomer, type InPmtPublicSession, type InPmtRefund, type OperationResult, type Payment, type PLPaymentsBalance, type PLPaymentsClaimCredits, type PLPaymentsOnboarding, type PLPaymentsOpenPublicSession, type PLPaymentsPaymentFromPublicSession, type PLPaymentsPurchaseCredits, type PLPaymentsTotalCredits, type PmtAccount, type PmtBankAccount, type PmtCard, type PmtCustomer, type PmtPublicSession, type PmtRefund, type RPPaymentsOnboarding, type RPPaymentsTotalCredits, type SortStripeBalanceResult } from "@fabriktor/schema";
2
2
  import type { TokenProvider } from "../core/auth.js";
3
3
  import type { DeleteOneOptionsCRUD, FindOneOptionsCRUD, InsertOneOptionsCRUD, OperationResultOf, QueryOptionsCRUD, ReplaceOneOptionsCRUD, SearchManyOptionsCRUD, SearchResultOf } from "../core/crud.js";
4
4
  import type { HTTPDoer, RequestOptions } from "../core/http.js";
@@ -10,6 +10,7 @@ export type PaymentsBalance = SortStripeBalanceResult;
10
10
  export type OpenPmtPublicSessionOptions = CompletePayload<PLPaymentsOpenPublicSession>;
11
11
  export type PaymentFromPublicSessionOptions = CompletePayload<PLPaymentsPaymentFromPublicSession>;
12
12
  export type PurchaseCreditsOptions = CompletePayload<PLPaymentsPurchaseCredits>;
13
+ export type ClaimCreditsOptions = CompletePayload<PLPaymentsClaimCredits>;
13
14
  export type TotalCreditsOptions = CompletePayload<PLPaymentsTotalCredits>;
14
15
  export type PaymentsClientOptions = {
15
16
  http: HTTPDoer;
@@ -71,6 +72,7 @@ export interface PaymentsOperator {
71
72
  openPmtPublicSession(opts: OpenPmtPublicSessionOptions): Promise<OperationResultOf<PmtPublicSession> | void>;
72
73
  paymentFromPublicSession(opts: PaymentFromPublicSessionOptions): Promise<OperationResult>;
73
74
  purchaseCredits(opts: PurchaseCreditsOptions): Promise<OperationResult>;
75
+ claimCredits(opts: ClaimCreditsOptions): Promise<OperationResultOf<CreditGrant>>;
74
76
  totalCredits(opts: TotalCreditsOptions): Promise<OperationResultOf<RPPaymentsTotalCredits>>;
75
77
  }
76
78
  export declare class PaymentsClient implements PaymentsOperator {
@@ -140,6 +142,7 @@ export declare class PaymentsClient implements PaymentsOperator {
140
142
  openPmtPublicSession(opts: OpenPmtPublicSessionOptions): Promise<OperationResultOf<PmtPublicSession> | void>;
141
143
  paymentFromPublicSession(opts: PaymentFromPublicSessionOptions): Promise<OperationResult>;
142
144
  purchaseCredits(opts: PurchaseCreditsOptions): Promise<OperationResult>;
145
+ claimCredits(opts: ClaimCreditsOptions): Promise<OperationResultOf<CreditGrant>>;
143
146
  totalCredits(opts: TotalCreditsOptions): Promise<OperationResultOf<RPPaymentsTotalCredits>>;
144
147
  }
145
148
  export declare function newPaymentsClient(opts: PaymentsClientOptions): PaymentsClient;
@@ -1,4 +1,4 @@
1
- import { ColPaymentsCreditLedger, ColPaymentsPayments, ColPaymentsPmtAccounts, ColPaymentsPmtBankAccounts, ColPaymentsPmtCards, ColPaymentsPmtCustomers, ColPaymentsPmtPublicSessions, ColPaymentsPmtRefunds, HTTPMethodPost, HTTPMethodGet, PathPaymentsBalance, PathPaymentsFromPublicSession, PathPaymentsOnboarding, PathPaymentsOpen, PathPaymentsPurchase, PathPaymentsTotal, SvcPayments, } from "@fabriktor/schema";
1
+ import { ColPaymentsCreditGrants, ColPaymentsCreditLedger, ColPaymentsPayments, ColPaymentsPmtAccounts, ColPaymentsPmtBankAccounts, ColPaymentsPmtCards, ColPaymentsPmtCustomers, ColPaymentsPmtPublicSessions, ColPaymentsPmtRefunds, HTTPMethodPost, HTTPMethodGet, PathPaymentsBalance, PathPaymentsClaim, PathPaymentsFromPublicSession, PathPaymentsOnboarding, PathPaymentsOpen, PathPaymentsPurchase, PathPaymentsTotal, SvcPayments, } from "@fabriktor/schema";
2
2
  import { requiredToken } from "../core/auth.js";
3
3
  import { newCRUDClient } from "../core/crud.js";
4
4
  import { newIdempotencyKey } from "../core/idempotency.js";
@@ -282,6 +282,21 @@ export class PaymentsClient {
282
282
  body: opts,
283
283
  });
284
284
  }
285
+ async claimCredits(opts) {
286
+ const token = await requiredToken(this.get_token);
287
+ return await this.http.do({
288
+ base_url: this.base_url,
289
+ path: buildPath({
290
+ svc: SvcPayments,
291
+ col: ColPaymentsCreditGrants,
292
+ action: PathPaymentsClaim,
293
+ }),
294
+ method: HTTPMethodPost,
295
+ token,
296
+ body: opts,
297
+ idempotency_key: newIdempotencyKey(),
298
+ });
299
+ }
285
300
  async totalCredits(opts) {
286
301
  const token = await requiredToken(this.get_token);
287
302
  return await this.http.do({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/client",
3
- "version": "0.0.107",
3
+ "version": "0.0.109",
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.78"
20
+ "@fabriktor/schema": "0.0.81"
21
21
  }
22
22
  }