diff options
author | Sebastian <sebasjm@gmail.com> | 2023-04-26 14:20:18 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-04-26 14:20:18 -0300 |
commit | 03d3cce8274fcbf6fb9cb8be03e867136f196c5d (patch) | |
tree | 4358ce334c9cccf95755271dbdca46f3eb7787d0 /packages/merchant-backoffice-ui/src/paths | |
parent | 982fc51a97389ef8863de806dab496b0fe2102c6 (diff) |
fix #6363, breaking with merchant backend that accounts implemented
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx | 12 | ||||
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx | 25 |
2 files changed, 25 insertions, 12 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx index 0ef1f1270..4087908a2 100644 --- a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx @@ -47,7 +47,7 @@ interface Props { function with_defaults(id?: string): Partial<Entity> { return { id, - payto_uris: [], + accounts: [], user_type: "business", default_pay_delay: { d_us: 2 * 1000 * 60 * 60 * 1000 }, // two hours default_wire_fee_amortization: 1, @@ -75,12 +75,14 @@ export function CreatePage({ onCreate, onBack, forceId }: Props): VNode { : value.user_type !== "business" && value.user_type !== "individual" ? i18n.str`should be business or individual` : undefined, - payto_uris: - !value.payto_uris || !value.payto_uris.length + accounts: + !value.accounts || !value.accounts.length ? i18n.str`required` : undefinedIfEmpty( - value.payto_uris.map((p) => { - return !PAYTO_REGEX.test(p) ? i18n.str`is not valid` : undefined; + value.accounts.map((p) => { + return !PAYTO_REGEX.test(p.payto_uri) + ? i18n.str`is not valid` + : undefined; }), ), default_max_deposit_fee: !value.default_max_deposit_fee diff --git a/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx index 2b57ab429..ecf6e2ae5 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/update/UpdatePage.tsx @@ -53,14 +53,23 @@ interface Props { function convert( from: MerchantBackend.Instances.QueryInstancesResponse, ): Entity { - const { accounts, ...rest } = from; - const payto_uris = accounts.filter((a) => a.active).map((a) => a.payto_uri); + const { accounts: qAccounts, ...rest } = from; + const accounts = qAccounts + .filter((a) => a.active) + .map( + (a) => + ({ + payto_uri: a.payto_uri, + credit_facade_url: a.credit_facade_url, + credit_facade_credentials: a.credit_facade_credentials, + } as MerchantBackend.Instances.MerchantBankAccount), + ); const defaults = { default_wire_fee_amortization: 1, default_pay_delay: { d_us: 2 * 1000 * 1000 * 60 * 60 }, //two hours default_wire_transfer_delay: { d_us: 2 * 1000 * 1000 * 60 * 60 * 2 }, //two hours }; - return { ...defaults, ...rest, payto_uris }; + return { ...defaults, ...rest, accounts }; } function getTokenValuePart(t?: string): string | undefined { @@ -103,12 +112,14 @@ export function UpdatePage({ : value.user_type !== "business" && value.user_type !== "individual" ? i18n.str`should be business or individual` : undefined, - payto_uris: - !value.payto_uris || !value.payto_uris.length + accounts: + !value.accounts || !value.accounts.length ? i18n.str`required` : undefinedIfEmpty( - value.payto_uris.map((p) => { - return !PAYTO_REGEX.test(p) ? i18n.str`is not valid` : undefined; + value.accounts.map((p) => { + return !PAYTO_REGEX.test(p.payto_uri) + ? i18n.str`is not valid` + : undefined; }), ), default_max_deposit_fee: !value.default_max_deposit_fee |