@fabriktor/fx 0.0.106 → 0.0.108
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,5 +1,5 @@
|
|
|
1
1
|
import { type CreditLedgerEntry, type Payment, type PmtAccount, type PmtBankAccount, type PmtCard, type PmtCustomer, type PmtPublicSession, type PmtRefund } from "@fabriktor/schema";
|
|
2
|
-
import type
|
|
2
|
+
import { type PaymentsOperator } from "@fabriktor/client";
|
|
3
3
|
import { type OwnerSearchOptions, type SearchPage } from "../core/search.js";
|
|
4
4
|
type PurchaseCreditsPayload = Parameters<PaymentsOperator["purchaseCredits"]>[0];
|
|
5
5
|
type OpenPublicSessionPayload = Parameters<PaymentsOperator["openPmtPublicSession"]>[0];
|
|
@@ -33,7 +33,7 @@ export type SearchPmtAccountsOptions = OwnerSearchOptions;
|
|
|
33
33
|
export type SearchPmtAccountsPage = SearchPage<PmtAccount>;
|
|
34
34
|
export type CreatePmtBankAccountOptions = PmtBankAccountInsertOptions;
|
|
35
35
|
export type ReplacePmtBankAccountOptions = PmtBankAccountReplaceOptions;
|
|
36
|
-
export type SearchPmtBankAccountsOptions = OwnerSearchOptions
|
|
36
|
+
export type SearchPmtBankAccountsOptions = OwnerSearchOptions & Partial<Pick<PmtBankAccount, "psp_account_psp_id">>;
|
|
37
37
|
export type SearchPmtBankAccountsPage = SearchPage<PmtBankAccount>;
|
|
38
38
|
export type CreatePmtCardOptions = PmtCardInsertOptions;
|
|
39
39
|
export type ReplacePmtCardOptions = PmtCardReplaceOptions;
|
|
@@ -69,6 +69,7 @@ export type PmtAccountAccess = {
|
|
|
69
69
|
};
|
|
70
70
|
export type GetPmtAccountAccessOptions = {
|
|
71
71
|
owner_id: string;
|
|
72
|
+
signal?: AbortSignal;
|
|
72
73
|
};
|
|
73
74
|
export declare function isPmtAccountReady(account: PmtAccount | null): boolean;
|
|
74
75
|
export declare function currentPmtAccount(accounts: readonly PmtAccount[]): PmtAccount | null;
|
|
@@ -4,6 +4,7 @@
|
|
|
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
6
|
import { CreditLedgerSourceAndroidIAP, CreditLedgerSourceAppleIAP, CreditLedgerSourceStripe, ZeroID, } from "@fabriktor/schema";
|
|
7
|
+
import { queryParams } from "@fabriktor/client";
|
|
7
8
|
import { errResolveFailed, errValidation } from "../core/err.js";
|
|
8
9
|
import { requiredOperationID, resolvedID } from "../core/id.js";
|
|
9
10
|
import { runOwnerSearch, } from "../core/search.js";
|
|
@@ -154,9 +155,11 @@ export class PaymentsFX {
|
|
|
154
155
|
const accounts = [];
|
|
155
156
|
let page = 1;
|
|
156
157
|
while (true) {
|
|
158
|
+
opts.signal?.throwIfAborted();
|
|
157
159
|
const out = await this.searchPmtAccounts({
|
|
158
160
|
owner_id: opts.owner_id,
|
|
159
161
|
page,
|
|
162
|
+
signal: opts.signal,
|
|
160
163
|
});
|
|
161
164
|
accounts.push(...out.results);
|
|
162
165
|
const account = currentPmtAccount(accounts);
|
|
@@ -178,6 +181,9 @@ export class PaymentsFX {
|
|
|
178
181
|
async searchPmtBankAccounts(opts) {
|
|
179
182
|
return await runOwnerSearch({
|
|
180
183
|
...opts,
|
|
184
|
+
query: queryParams({
|
|
185
|
+
psp_account_psp_id: resolvedID(opts.psp_account_psp_id),
|
|
186
|
+
}),
|
|
181
187
|
search: (searchOpts) => this.payments.searchManyPmtBankAccounts(searchOpts),
|
|
182
188
|
});
|
|
183
189
|
}
|