taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 1833ea601440e1ac7924c454ffbea611bf07b8b3
parent 8be3a041a40297ae1a54980bb4c73849ed2a040d
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon, 20 Oct 2025 12:41:40 -0300

fix: pay delay was too short

Diffstat:
Mpackages/merchant-backoffice-ui/src/paths/newAccount/index.tsx | 45++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/paths/newAccount/index.tsx b/packages/merchant-backoffice-ui/src/paths/newAccount/index.tsx @@ -14,7 +14,11 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Duration, HttpStatusCode, MerchantAuthMethod } from "@gnu-taler/taler-util"; +import { + Duration, + HttpStatusCode, + MerchantAuthMethod, +} from "@gnu-taler/taler-util"; import { undefinedIfEmpty, useChallengeHandler, @@ -48,6 +52,10 @@ export interface Account { email: string; phone: string; } + +const twoHours = Duration.fromSpec({ hours: 2 }); +const twoDays = Duration.fromSpec({ days: 2 }); + interface Props { onCancel: () => void; onCreated: () => void; @@ -57,14 +65,7 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { const { state: session, lib, logIn } = useSessionContext(); const [notif, setNotif] = useState<Notification | undefined>(undefined); - const [value, setValue] = useState<Partial<Account>>({ - id: "rnd"+ Math.random(), - email:"ccc@cc.com", - name: "testing instance", - password: "ccc", - repeat:"ccc", - phone:"+54", - }); + const [value, setValue] = useState<Partial<Account>>({ }); const errors = undefinedIfEmpty<FormErrors<Account>>({ id: !value.id ? i18n.str`Required` @@ -110,7 +111,7 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { ({ challengeIds, onChallengeRequired }) => async function doCreateImpl() { try { - const id = value.id! + const id = value.id!; const resp = await lib.instance.createInstanceSelfProvision( { address: {}, @@ -118,12 +119,9 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { method: MerchantAuthMethod.TOKEN, password: value.password!, }, - default_pay_delay: { - d_us: 1000, - }, - default_wire_transfer_delay: { - d_us: 1000, - }, + default_pay_delay: Duration.toTalerProtocolDuration(twoHours), + default_wire_transfer_delay: + Duration.toTalerProtocolDuration(twoDays), id, jurisdiction: {}, name: value.name!, @@ -131,9 +129,10 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { email: value.email!, phone_number: value.phone, }, - { - tokenValidity: Duration.fromSpec({months: 6}), - challengeIds }, + { + tokenValidity: Duration.fromSpec({ months: 6 }), + challengeIds, + }, ); if (resp.type === "fail") { @@ -149,7 +148,7 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { return; } if (resp.body) { - logIn(id, resp.body.access_token) + logIn(id, resp.body.access_token); } onCreated(); } catch (error) { @@ -246,7 +245,11 @@ export function NewAccount({ onCancel, onCreated }: Props): VNode { <button class="button" onClick={onCancel}> <i18n.Translate>Cancel</i18n.Translate> </button> - <AsyncButton type="is-info" disabled={!!errors} onClick={doCreate}> + <AsyncButton + type="is-info" + disabled={!!errors} + onClick={doCreate} + > <i18n.Translate>Create</i18n.Translate> </AsyncButton> </footer>