@fabriktor/fx 0.0.62 → 0.0.63

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.
@@ -8,6 +8,7 @@ type PaymentInsertOptions = Parameters<PaymentsOperator["insertOnePayment"]>[0];
8
8
  type PaymentReplaceOptions = Parameters<PaymentsOperator["replaceOnePayment"]>[0];
9
9
  type PmtAccountInsertOptions = Parameters<PaymentsOperator["insertOnePmtAccount"]>[0];
10
10
  type PmtAccountReplaceOptions = Parameters<PaymentsOperator["replaceOnePmtAccount"]>[0];
11
+ type PmtAccountOnboardingOptions = Parameters<PaymentsOperator["onboarding"]>[0];
11
12
  type PmtBankAccountInsertOptions = Parameters<PaymentsOperator["insertOnePmtBankAccount"]>[0];
12
13
  type PmtBankAccountReplaceOptions = Parameters<PaymentsOperator["replaceOnePmtBankAccount"]>[0];
13
14
  type PmtCardInsertOptions = Parameters<PaymentsOperator["insertOnePmtCard"]>[0];
@@ -31,6 +32,8 @@ export type ReplacePaymentOptions = PaymentReplaceOptions;
31
32
  export type SearchPaymentsOptions = SearchPaymentRecordsOptions;
32
33
  export type SearchPaymentsPage = SearchPage<Payment>;
33
34
  export type CreatePmtAccountOptions = PmtAccountInsertOptions;
35
+ export type ContinuePmtAccountOnboardingOptions = PmtAccountOnboardingOptions;
36
+ export type ContinuePmtAccountOnboardingResult = string;
34
37
  export type ReplacePmtAccountOptions = PmtAccountReplaceOptions;
35
38
  export type SearchPmtAccountsOptions = SearchPaymentRecordsOptions;
36
39
  export type SearchPmtAccountsPage = SearchPage<PmtAccount>;
@@ -93,6 +96,7 @@ export interface PaymentsFXOperator {
93
96
  replacePayment(opts: ReplacePaymentOptions): Promise<Payment>;
94
97
  searchPayments(opts: SearchPaymentsOptions): Promise<SearchPaymentsPage>;
95
98
  createPmtAccount(opts: CreatePmtAccountOptions): Promise<PmtAccount>;
99
+ continuePmtAccountOnboarding(opts: ContinuePmtAccountOnboardingOptions): Promise<ContinuePmtAccountOnboardingResult>;
96
100
  replacePmtAccount(opts: ReplacePmtAccountOptions): Promise<PmtAccount>;
97
101
  searchPmtAccounts(opts: SearchPmtAccountsOptions): Promise<SearchPmtAccountsPage>;
98
102
  createPmtBankAccount(opts: CreatePmtBankAccountOptions): Promise<PmtBankAccount>;
@@ -129,6 +133,7 @@ export declare class PaymentsFX implements PaymentsFXOperator {
129
133
  replacePayment(opts: ReplacePaymentOptions): Promise<Payment>;
130
134
  searchPayments(opts: SearchPaymentsOptions): Promise<SearchPaymentsPage>;
131
135
  createPmtAccount(opts: CreatePmtAccountOptions): Promise<PmtAccount>;
136
+ continuePmtAccountOnboarding(opts: ContinuePmtAccountOnboardingOptions): Promise<ContinuePmtAccountOnboardingResult>;
132
137
  replacePmtAccount(opts: ReplacePmtAccountOptions): Promise<PmtAccount>;
133
138
  searchPmtAccounts(opts: SearchPmtAccountsOptions): Promise<SearchPmtAccountsPage>;
134
139
  createPmtBankAccount(opts: CreatePmtBankAccountOptions): Promise<PmtBankAccount>;
@@ -10,6 +10,7 @@ import { runSearch } from "../core/search.js";
10
10
  const publicAmountPattern = /^\d+$/;
11
11
  const resourcePayment = "payment";
12
12
  const resourcePmtAccount = "pmt_account";
13
+ const resourcePmtAccountOnboarding = "pmt_account_onboarding";
13
14
  const resourcePmtBankAccount = "pmt_bank_account";
14
15
  const resourcePmtCard = "pmt_card";
15
16
  const resourcePmtRefund = "pmt_refund";
@@ -22,6 +23,8 @@ const msgCreatedPaymentIDMissing = "Created payment response did not contain an
22
23
  const msgPaymentMissing = "Payment could not be resolved after the mutation.";
23
24
  const msgCreatedPmtAccountIDMissing = "Created payment account response did not contain an ID.";
24
25
  const msgPmtAccountMissing = "Payment account could not be resolved after the mutation.";
26
+ const msgPmtAccountOnboardingIDMissing = "Payment account onboarding requires a valid account ID.";
27
+ const msgPmtAccountOnboardingLinkMissing = "Payment account onboarding did not return a link.";
25
28
  const msgCreatedPmtBankAccountIDMissing = "Created payment bank account response did not contain an ID.";
26
29
  const msgPmtBankAccountMissing = "Payment bank account could not be resolved after the mutation.";
27
30
  const msgCreatedPmtCardIDMissing = "Created payment card response did not contain an ID.";
@@ -81,6 +84,26 @@ export class PaymentsFX {
81
84
  const id = requiredOperationID(out, msgCreatedPmtAccountIDMissing);
82
85
  return await this.findPmtAccount(id);
83
86
  }
87
+ async continuePmtAccountOnboarding(opts) {
88
+ const id = resolvedID(opts.pmt_account_id);
89
+ if (id === undefined) {
90
+ throw errValidation({
91
+ field: "pmt_account_id",
92
+ msg: msgPmtAccountOnboardingIDMissing,
93
+ });
94
+ }
95
+ const out = await this.payments.onboarding({
96
+ pmt_account_id: id,
97
+ });
98
+ const accountLink = out.value?.account_link.trim() ?? "";
99
+ if (accountLink === "") {
100
+ throw errResolveFailed({
101
+ resource: resourcePmtAccountOnboarding,
102
+ msg: msgPmtAccountOnboardingLinkMissing,
103
+ });
104
+ }
105
+ return accountLink;
106
+ }
84
107
  async replacePmtAccount(opts) {
85
108
  await this.payments.replaceOnePmtAccount(opts);
86
109
  return await this.findPmtAccount(opts.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "0.0.58",
21
- "@fabriktor/schema": "0.0.40"
20
+ "@fabriktor/client": "0.0.59",
21
+ "@fabriktor/schema": "0.0.41"
22
22
  }
23
23
  }