summaryrefslogtreecommitdiff
path: root/packages/frontend/src/paths/admin/create/CreatePage.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/paths/admin/create/CreatePage.tsx')
-rw-r--r--packages/frontend/src/paths/admin/create/CreatePage.tsx27
1 files changed, 4 insertions, 23 deletions
diff --git a/packages/frontend/src/paths/admin/create/CreatePage.tsx b/packages/frontend/src/paths/admin/create/CreatePage.tsx
index 76f02e1..f5fa7c9 100644
--- a/packages/frontend/src/paths/admin/create/CreatePage.tsx
+++ b/packages/frontend/src/paths/admin/create/CreatePage.tsx
@@ -32,8 +32,6 @@ import { INSTANCE_ID_REGEX, PAYTO_REGEX } from "../../../utils/constants";
import { Amounts } from "@gnu-taler/taler-util";
export type Entity = MerchantBackend.Instances.InstanceConfigurationMessage & {
- payto_uris_base: string[], // field to construct final payto URI
- creditor_name: string, // name of the receiver for the payto URI
auth_token?: string
}
@@ -47,6 +45,7 @@ interface Props {
function with_defaults(id?: string): Partial<Entity> {
return {
id,
+ payto_uris: [],
default_pay_delay: { d_ms: 1000 * 60 * 60 }, // one hour
default_wire_fee_amortization: 1,
default_wire_transfer_delay: { d_ms: 1000 * 2 * 60 * 60 * 24 }, // one day
@@ -64,23 +63,12 @@ export function CreatePage({ onCreate, onBack, forceId }: Props): VNode {
const i18n = useTranslator()
- if (value.payto_uris && value.payto_uris.length > 0) {
- const payto = new URL(value.payto_uris[0])
- value.creditor_name = payto.searchParams.get('receiver-name') || undefined
- value.payto_uris_base = value.payto_uris.map( p => {
- const payto = new URL(p)
- payto.searchParams.delete('receiver-name')
- return payto.toString()
- })
- }
-
const errors: FormErrors<Entity> = {
id: !value.id ? i18n`required` : (!INSTANCE_ID_REGEX.test(value.id) ? i18n`is not valid` : undefined),
name: !value.name ? i18n`required` : undefined,
- creditor_name: !value.creditor_name ? i18n`required` : undefined,
- payto_uris_base:
- !value.payto_uris_base || !value.payto_uris_base.length ? i18n`required` : (
- undefinedIfEmpty(value.payto_uris_base.map(p => {
+ payto_uris:
+ !value.payto_uris || !value.payto_uris.length ? i18n`required` : (
+ undefinedIfEmpty(value.payto_uris.map(p => {
return !PAYTO_REGEX.test(p) ? i18n`is not valid` : undefined
}))
),
@@ -126,13 +114,6 @@ export function CreatePage({ onCreate, onBack, forceId }: Props): VNode {
if (!value.address) value.address = {}
if (!value.jurisdiction) value.jurisdiction = {}
// remove above use conversion
- const receiverName = value.creditor_name!
- value.payto_uris = value.payto_uris_base?.map(p => {
- const payto = new URL(p)
- payto.searchParams.set('receiver-name', receiverName)
- return payto.toString()
- }) || []
- value.payto_uris_base = undefined
// schema.validateSync(value, { abortEarly: false })
return onCreate(value as Entity);
}