diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-01 18:39:23 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-01 18:39:23 +0100 |
commit | ae8a00527168b13aa59ddc2fbd1f88a0f1e2669c (patch) | |
tree | a8599ee8efd254d468ec1ab29ce4ebdabd29c276 /src/webex | |
parent | 1c5a9d2474f6281869c0ed0accbff4944359722a (diff) |
protocol changes
Diffstat (limited to 'src/webex')
-rw-r--r-- | src/webex/pages/pay.tsx | 14 | ||||
-rw-r--r-- | src/webex/wxApi.ts | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx index 579688db3..7f2a174b7 100644 --- a/src/webex/pages/pay.tsx +++ b/src/webex/pages/pay.tsx @@ -53,6 +53,11 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { return <span>Loading payment information ...</span>; } + let insufficientBalance = false; + if (payStatus.status == "insufficient-balance") { + insufficientBalance = true; + } + if (payStatus.status === "error") { return <span>Error: {payStatus.error}</span>; } @@ -93,7 +98,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { const doPayment = async () => { if (payStatus.status !== "payment-possible") { - throw Error("invalid state"); + throw Error(`invalid state: ${payStatus.status}`); } const proposalId = payStatus.proposalId; setNumTries(numTries + 1); @@ -128,6 +133,12 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { )} </p> + {insufficientBalance ? ( + <div> + <p style={{color: "red", fontWeight: "bold"}}>Unable to pay: Your balance is insufficient.</p> + </div> + ) : null} + {payErrMsg ? ( <div> <p>Payment failed: {payErrMsg}</p> @@ -142,6 +153,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) { <div> <ProgressButton loading={loading} + disabled={insufficientBalance} onClick={() => doPayment()}> {i18n.str`Confirm payment`} </ProgressButton> diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts index 65c14ac48..39c31ca51 100644 --- a/src/webex/wxApi.ts +++ b/src/webex/wxApi.ts @@ -86,6 +86,7 @@ async function callBackend<T extends MessageType>( return new Promise<MessageMap[T]["response"]>((resolve, reject) => { chrome.runtime.sendMessage({ type, detail }, (resp) => { if (typeof resp === "object" && resp && resp.error) { + console.warn("response error:", resp) const e = new WalletApiError(resp.error.message, resp.error); reject(e); } else { |