taler-typescript-core

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

commit 530c74ab22121d25f9db7c6ddf15649b4bad0bcc
parent 382c26b397886985a361cde70dd5e5c1d8d5b411
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Tue, 23 Jun 2026 22:50:51 -0300

fix #11541

Diffstat:
Mpackages/taler-wallet-webextension/src/components/PaymentButtons.tsx | 43++++++++++++++++---------------------------
Mpackages/taler-wallet-webextension/src/cta/Payment/index.ts | 2++
Mpackages/taler-wallet-webextension/src/cta/Payment/state.ts | 2++
3 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx b/packages/taler-wallet-webextension/src/components/PaymentButtons.tsx @@ -57,7 +57,7 @@ export function PaymentButtons({ </i18n.Translate> </Button> </section> - {/* <PayWithMobile uri={state.shareUri} /> */} + <PayWithMobile merchantBaseUrl={state.merchantBaseUrl} orderId={state.orderId} /> </Fragment> ); } @@ -88,17 +88,15 @@ export function PaymentButtons({ case InsufficientBalanceHint.MerchantAcceptInsufficient: { BalanceMessage = i18n.str`Balance is not enough because merchant will just accept ${Amounts.stringifyValue( balanceDetails.balanceReceiverAcceptable, - )} ${ - amount.currency - }. To know more you can check which exchange and auditors the merchant trust.`; + )} ${amount.currency + }. To know more you can check which exchange and auditors the merchant trust.`; break; } case InsufficientBalanceHint.MerchantDepositInsufficient: { BalanceMessage = i18n.str`Balance is not enough because merchant will just accept ${Amounts.stringifyValue( balanceDetails.balanceReceiverDepositable, - )} ${ - amount.currency - }. To know more you can check which wire methods the merchant accepts.`; + )} ${amount.currency + }. To know more you can check which wire methods the merchant accepts.`; break; } case InsufficientBalanceHint.AgeRestricted: { @@ -110,9 +108,8 @@ export function PaymentButtons({ case InsufficientBalanceHint.WalletBalanceMaterialInsufficient: { BalanceMessage = i18n.str`Balance is not enough because you have ${Amounts.stringifyValue( balanceDetails.balanceMaterial, - )} ${ - amount.currency - } to spend right know. There are some coins that need to be refreshed.`; + )} ${amount.currency + } to spend right know. There are some coins that need to be refreshed.`; break; } case InsufficientBalanceHint.WalletBalanceAvailableInsufficient: { @@ -131,9 +128,8 @@ export function PaymentButtons({ Amounts.sub(amount, balanceDetails.maxEffectiveSpendAmount) .amount, ), - )} ${ - amount.currency - } more balance in your wallet or ask your merchant to cover more of the fees.`; + )} ${amount.currency + } more balance in your wallet or ask your merchant to cover more of the fees.`; break; } case undefined: { @@ -160,7 +156,7 @@ export function PaymentButtons({ <i18n.Translate>Get digital cash</i18n.Translate> </Button> </section> - {/* <PayWithMobile uri={state.shareUri} /> */} + <PayWithMobile merchantBaseUrl={state.merchantBaseUrl} orderId={state.orderId} /> </Fragment> ); } @@ -170,31 +166,24 @@ export function PaymentButtons({ } } -function PayWithMobile({ uri }: { uri: string }): VNode { +function PayWithMobile({ merchantBaseUrl, orderId }: { + merchantBaseUrl: string; + orderId: string; +}): VNode { const { i18n } = useTranslationContext(); const api = useBackendContext(); - const payUri = Result.orUndefined(TalerUris.parse(uri)); const [showQR, setShowQR] = useState<string | undefined>(undefined); const privateUri = showQR ? Result.orUndefined(TalerUris.parse(showQR)) : undefined async function sharePrivatePaymentURI() { - if (!payUri || payUri.type !== TalerUriAction.Pay) { - return; - } if (!showQR) { - const result = await api.wallet.call(WalletApiOperation.SharePayment, { - merchantBaseUrl: payUri.merchantBaseUrl, - orderId: payUri.orderId, - }); + const result = await api.wallet.call(WalletApiOperation.SharePayment, { merchantBaseUrl, orderId }); setShowQR(result.privatePayUri); } else { setShowQR(undefined); } } - if (!payUri) { - return <Fragment />; - } return ( <section> <LinkSuccess upperCased onClick={sharePrivatePaymentURI}> @@ -205,7 +194,7 @@ function PayWithMobile({ uri }: { uri: string }): VNode { <QR_Taler uri={privateUri} /> <i18n.Translate> Scan the QR code or &nbsp; - <a href={uri}> + <a href={TalerUris.stringify(privateUri)}> <i18n.Translate>click here</i18n.Translate> </a> </i18n.Translate> diff --git a/packages/taler-wallet-webextension/src/cta/Payment/index.ts b/packages/taler-wallet-webextension/src/cta/Payment/index.ts @@ -63,6 +63,8 @@ export namespace State { expiration: AbsoluteTime; merchant: MerchantInfo | undefined; transactionId: TransactionIdStr; + merchantBaseUrl: string; + orderId:string; error: undefined; goToWalletManualWithdraw: (amount?: string) => Promise<void>; cancel: () => Promise<void>; diff --git a/packages/taler-wallet-webextension/src/cta/Payment/state.ts b/packages/taler-wallet-webextension/src/cta/Payment/state.ts @@ -178,6 +178,8 @@ export function useComponentStateFromTxId({ receiver: contractTerms.merchant, summary: contractTerms.summary, merchant: contractTerms.merchant, + merchantBaseUrl: contractTerms.merchant_base_url, + orderId: contractTerms.order_id, error: undefined, expiration, minimum_age: contractTerms.minimum_age,