diff --git a/.gitignore b/.gitignore index 9b4601c70..554c6be6c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,10 +12,13 @@ yarn-error.log npm-packages-offline-cache/ -config.mk +/configure +/config.mk + \#*\# *~ # old folder build-scripts/ + diff --git a/.npmignore b/.npmignore deleted file mode 100644 index f0340a384..000000000 --- a/.npmignore +++ /dev/null @@ -1,19 +0,0 @@ -/articles -/packages -/npm-packages-offline-cache -/.vscode -/*.log -/contrib -/.* -/configure -/selenium -/*.json -*.tsbuildinfo - -/Makefile -/*.js - -/dist/* -!/dist/node - -config.mk \ No newline at end of file diff --git a/Makefile b/Makefile index 31142ede5..9372fe1b6 100644 --- a/Makefile +++ b/Makefile @@ -93,3 +93,14 @@ endif .PHONY: watch watch: tsconfig.json ./node_modules/.bin/webpack --watch + + +# Create the node_modules directory for the android wallet +package-android: + rm -rf dist/android + mkdir -p dist/android + yarn pack --filename dist/android/taler-wallet.tar.gz + cp contrib/package-android.json dist/android/package.json + cd dist/android && yarn install + #cd dist/android && npm install --global --prefix $(CURDIR)/dist/android $(CURDIR) + diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts index b2c9672f2..253680192 160000 --- a/build-system/taler-build-scripts +++ b/build-system/taler-build-scripts @@ -1 +1 @@ -Subproject commit b2c9672f2e493db810865b7de1e568a466b59360 +Subproject commit 2536801927781ea38fefc3de924934e1c6a74d88 diff --git a/configure b/configure deleted file mode 100755 index 45837b56b..000000000 --- a/configure +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -# This file is part of TALER -# (C) 2019 GNUnet e.V. -# -# This is very simple POSIX sh script which -# identifies the first matching -# python3 identifier in $PATH and produces -# configure.py from configure.py.in, and then -# calls the new executable configure.py. -# -# It should be portable on Unices. Report bugs on -# the bugtracker if you discover that it isn't -# working as intended. -# -# Authors: -# Author: ng0 -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE -# LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES -# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -# THIS SOFTWARE. -# -# SPDX-License-Identifier: 0BSD - -# there is a function used in curl to replicate which(1), but -# it uses too many other tools. this one uses command and in -# gnunet so far has no reports about failures. -existence() -{ - command -v "$1" >/dev/null 2>&1 -} - -# We have to check every possible variant of the -# executable name because there is a PEP which -# defines the executable to be like this. -if existence python3; then - if test ! -z "`python3 --version | awk '$2 ~ /3.7/ { print }'`"; then - python="python3" - else - echo "*** At least python 3.7 is required for the buildsystem" - exit 1 - fi -# elif existence python3.1; then -# python="python3.1" -# elif existence python3.2; then -# python="python3.2" -# elif existence python3.3; then -# python="python3.3" -# elif existence python3.4; then -# python="python3.4" -# elif existence python3.5; then -# python="python3.5" -# elif existence python3.6; then -# python="python3.6" -elif existence python3.7; then - python="python3.7" -elif existence python3.8; then - python="python3.8" -else - echo "*** No known python3 executable found in path ***" - echo "*** falling back to env(1) python ***" - # Unreliable, but if env finds no python, we still can - # not assume python in a fixed location. - # TODO: Check this in a clean chroot! - python="env python" -fi - -# we could check the return value here via || echo "blafoo" -# or fail anyway once configure.py is invoked because we -# don't have python if we reach the point to fail. -PYTHON=$($python -c 'import sys; print(sys.executable)') - - -# Call configure.py, assuming all went well. -# $1 is read by configure.py as the prefix. -# If $1 is empty, the python script checks the -# environment for PREFIX. We might need more -# variables and switches, such as DESTDIR. -exec "$PYTHON" ./configure.py $@ diff --git a/configure.py b/configure.py index 3a5a8de1c..89d143325 100644 --- a/configure.py +++ b/configure.py @@ -1,15 +1,8 @@ -#!/usr/bin/env python3 +# This configure.py file is places in the public domain. -import sys -from pathlib import Path - -base_dir = Path(__file__, "../build-system/taler-build-scripts").resolve() -if not base_dir.exists(): - print( - f"build system directory ({base_dir}) missing", file=sys.stderr - ) - sys.exit(1) -sys.path.insert(0, str(base_dir)) +# Configure the build directory. +# This file is invoked by './configure' and should usually not be invoked +# manually. from talerbuildconfig import * diff --git a/contrib/package-android.json b/contrib/package-android.json new file mode 100644 index 000000000..995df392e --- /dev/null +++ b/contrib/package-android.json @@ -0,0 +1,8 @@ +{ + "name": "android-taler-wallet", + "version": "0.6.0", + "license": "AGPL3+", + "dependencies": { + "taler-wallet": "./taler-wallet.tar.gz" + } +} diff --git a/manifest.json b/manifest.json index 86928bf0d..5abbccae0 100644 --- a/manifest.json +++ b/manifest.json @@ -4,8 +4,8 @@ "name": "GNU Taler Wallet (git)", "description": "Privacy preserving and transparent payments", "author": "GNU Taler Developers", - "version": "0.6.68", - "version_name": "0.6.0pre1", + "version": "0.6.70", + "version_name": "0.6.0pre3", "minimum_chrome_version": "51", "minimum_opera_version": "36", diff --git a/package.json b/package.json index 31cf91b13..2b2efcf0c 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,15 @@ "scripts": { "build": "make tsc" }, + "files": [ + "AUTHORS", + "README", + "COPYING", + "bin/", + "dist/node", + "src/", + "emscripten/" + ], "devDependencies": { "@types/react": "^16.4.0", "@types/react-dom": "^16.0.0", diff --git a/src/i18n/de.po b/src/i18n/de.po index 7358c5507..0181420ae 100644 --- a/src/i18n/de.po +++ b/src/i18n/de.po @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, fuzzy, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "Der Händler %1$s möchte einen Vertrag über %2$s mit Ihnen abschließen." -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, c-format msgid "The total price is %1$s." msgstr "" -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, fuzzy, c-format msgid "Confirm payment" msgstr "Bezahlung bestätigen" diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po index 508a1f1f9..fd4a9c983 100644 --- a/src/i18n/en-US.po +++ b/src/i18n/en-US.po @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "" -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, c-format msgid "The total price is %1$s." msgstr "" -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, c-format msgid "Confirm payment" msgstr "" diff --git a/src/i18n/fr.po b/src/i18n/fr.po index 56eee1dd4..bbc02869a 100644 --- a/src/i18n/fr.po +++ b/src/i18n/fr.po @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "" -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, c-format msgid "The total price is %1$s." msgstr "" -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, c-format msgid "Confirm payment" msgstr "" diff --git a/src/i18n/it.po b/src/i18n/it.po index 56eee1dd4..bbc02869a 100644 --- a/src/i18n/it.po +++ b/src/i18n/it.po @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "" -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, c-format msgid "The total price is %1$s." msgstr "" -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, c-format msgid "Confirm payment" msgstr "" diff --git a/src/i18n/sv.po b/src/i18n/sv.po index c1c0d4560..dd546b77c 100644 --- a/src/i18n/sv.po +++ b/src/i18n/sv.po @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, fuzzy, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "Säljaren %1$s erbjuder följande:" -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, fuzzy, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "Det totala priset är %1$s (plus %2$s avgifter).\n" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, fuzzy, c-format msgid "The total price is %1$s." msgstr "Det totala priset är %1$s." -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, c-format msgid "Confirm payment" msgstr "Godkän betalning" diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot index 56eee1dd4..bbc02869a 100644 --- a/src/i18n/taler-wallet-webex.pot +++ b/src/i18n/taler-wallet-webex.pot @@ -37,27 +37,27 @@ msgstr "" msgid "time (ms/op)" msgstr "" -#: src/webex/pages/pay.tsx:113 +#: src/webex/pages/pay.tsx:118 #, c-format msgid "The merchant %1$s offers you to purchase:" msgstr "" -#: src/webex/pages/pay.tsx:119 +#: src/webex/pages/pay.tsx:124 #, c-format msgid "The total price is %1$s (plus %2$s fees)." msgstr "" -#: src/webex/pages/pay.tsx:124 +#: src/webex/pages/pay.tsx:129 #, c-format msgid "The total price is %1$s." msgstr "" -#: src/webex/pages/pay.tsx:138 +#: src/webex/pages/pay.tsx:149 #, c-format msgid "Retry" msgstr "" -#: src/webex/pages/pay.tsx:146 +#: src/webex/pages/pay.tsx:158 #, c-format msgid "Confirm payment" msgstr "" diff --git a/src/talerTypes.ts b/src/talerTypes.ts index 73b97c93d..ebb13f4a5 100644 --- a/src/talerTypes.ts +++ b/src/talerTypes.ts @@ -388,6 +388,12 @@ export class ContractTerms { @Checkable.String(timestampCheck) refund_deadline: string; + /** + * Deadline for the wire transfer. + */ + @Checkable.String(timestampCheck) + wire_transfer_deadline: string; + /** * Time when the contract was generated by the merchant. */ @@ -402,10 +408,10 @@ export class ContractTerms { order_id: string; /** - * URL to post the payment to. + * Base URL of the merchant's backend. */ @Checkable.String() - pay_url: string; + merchant_base_url: string; /** * Fulfillment URL to view the product or diff --git a/src/taleruri-test.ts b/src/taleruri-test.ts index bf4e9d493..360f565f7 100644 --- a/src/taleruri-test.ts +++ b/src/taleruri-test.ts @@ -15,7 +15,7 @@ */ import test from "ava"; -import { parsePayUri, parseWithdrawUri } from "./taleruri"; +import { parsePayUri, parseWithdrawUri, parseRefundUri, parseTipUri } from "./taleruri"; test("taler pay url parsing: http(s)", (t) => { const url1 = "https://example.com/bar?spam=eggs"; @@ -150,3 +150,57 @@ test("taler withdraw uri parsing", (t) => { } t.is(r1.statusUrl, "https://bank.example.com/api/withdraw-operation/12345"); }); + + +test("taler refund uri parsing", (t) => { + const url1 = "taler://refund/merchant.example.com/-/-/1234"; + const r1 = parseRefundUri(url1); + if (!r1) { + t.fail(); + return; + } + t.is(r1.refundUrl, "https://merchant.example.com/public/refund?order_id=1234"); +}); + + +test("taler refund uri parsing with instance", (t) => { + const url1 = "taler://refund/merchant.example.com/-/myinst/1234"; + const r1 = parseRefundUri(url1); + if (!r1) { + t.fail(); + return; + } + t.is(r1.refundUrl, "https://merchant.example.com/public/instances/myinst/refund?order_id=1234"); +}); + +test("taler tip pickup uri", (t) => { + const url1 = "taler://tip/merchant.example.com/-/-/tipid"; + const r1 = parseTipUri(url1); + if (!r1) { + t.fail(); + return; + } + t.is(r1.tipPickupUrl, "https://merchant.example.com/public/tip-pickup?tip_id=tipid"); +}); + + +test("taler tip pickup uri with instance", (t) => { + const url1 = "taler://tip/merchant.example.com/-/tipm/tipid"; + const r1 = parseTipUri(url1); + if (!r1) { + t.fail(); + return; + } + t.is(r1.tipPickupUrl, "https://merchant.example.com/public/instances/tipm/tip-pickup?tip_id=tipid"); +}); + + +test("taler tip pickup uri with instance and prefix", (t) => { + const url1 = "taler://tip/merchant.example.com/my%2fpfx/tipm/tipid"; + const r1 = parseTipUri(url1); + if (!r1) { + t.fail(); + return; + } + t.is(r1.tipPickupUrl, "https://merchant.example.com/my/pfx/instances/tipm/tip-pickup?tip_id=tipid"); +}); diff --git a/src/taleruri.ts b/src/taleruri.ts index 0af5c4c95..c810def29 100644 --- a/src/taleruri.ts +++ b/src/taleruri.ts @@ -147,17 +147,18 @@ export function parseTipUri(s: string): TipUriResult | undefined { } if (maybePath === "-") { - maybePath = "public/tip-pickup"; + maybePath = "public/"; } else { - maybePath = decodeURIComponent(maybePath); + maybePath = decodeURIComponent(maybePath) + "/"; } - if (maybeInstance === "-") { - maybeInstance = "default"; + let maybeInstancePath = ""; + if (maybeInstance !== "-") { + maybeInstancePath = `instances/${maybeInstance}/`; } const tipPickupUrl = new URI( - "https://" + host + "/" + decodeURIComponent(maybePath), - ).href(); + "https://" + host + "/" + maybePath + maybeInstancePath + "tip-pickup", + ).addQuery({ tip_id: tipId }).href(); return { tipPickupUrl, @@ -197,20 +198,20 @@ export function parseRefundUri(s: string): RefundUriResult | undefined { } if (maybePath === "-") { - maybePath = "public/refund"; + maybePath = "public/"; } else { - maybePath = decodeURIComponent(maybePath); + maybePath = decodeURIComponent(maybePath) + "/"; } - if (maybeInstance === "-") { - maybeInstance = "default"; + let maybeInstancePath = ""; + if (maybeInstance !== "-") { + maybeInstancePath = `instances/${maybeInstance}/`; } const refundUrl = new URI( - "https://" + host + "/" + decodeURIComponent(maybePath), + "https://" + host + "/" + maybePath + maybeInstancePath + "refund", ) - .addQuery({ instance: maybeInstance, order_id: orderId }) + .addQuery({ order_id: orderId }) .href(); - return { refundUrl, }; diff --git a/src/types-test.ts b/src/types-test.ts index 51c4d69c7..56a826441 100644 --- a/src/types-test.ts +++ b/src/types-test.ts @@ -115,7 +115,8 @@ test("contract terms validation", (t) => { merchant_pub: "12345", order_id: "test_order", pay_deadline: "Date(12346)", - pay_url: "https://example.com/pay", + wire_transfer_deadline: "Date(12346)", + merchant_base_url: "https://example.com/pay", products: [], refund_deadline: "Date(12345)", summary: "hello", diff --git a/src/wallet.ts b/src/wallet.ts index 25857870c..c73af9062 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -114,6 +114,7 @@ import { parseTipUri, parseRefundUri, } from "./taleruri"; +import { isFirefox } from "./webex/compat"; interface SpeculativePayData { payCoinInfo: PayCoinInfo; @@ -965,15 +966,19 @@ export class Wallet { let resp; const payReq = { ...purchase.payReq, session_id: sessionId }; + const payUrl = new URI("pay") + .absoluteTo(purchase.contractTerms.merchant_base_url) + .href(); + try { - resp = await this.http.postJson(purchase.contractTerms.pay_url, payReq); + resp = await this.http.postJson(payUrl, payReq); } catch (e) { // Gives the user the option to retry / abort and refresh console.log("payment failed", e); throw e; } const merchantResp = resp.responseJson; - console.log("got success from pay_url"); + console.log("got success from pay URL"); const merchantPub = purchase.contractTerms.merchant_pub; const valid: boolean = await this.cryptoApi.isValidPaymentSignature( @@ -1923,10 +1928,16 @@ export class Wallet { !versionMatch.compatible && versionMatch.currentCmp === -1 ) { - console.log("wallet version might be outdated, checking for updates"); - chrome.runtime.requestUpdateCheck((status, details) => { - console.log("update check status:", status); - }); + console.warn( + `wallet version ${WALLET_PROTOCOL_VERSION} might be outdated (exchange has ${exchangeInfo.protocolVersion}), checking for updates`, + ); + if (isFirefox()) { + console.log("skipping update check on Firefox") + } else { + chrome.runtime.requestUpdateCheck((status, details) => { + console.log("update check status:", status); + }); + } } } @@ -2213,6 +2224,9 @@ export class Wallet { paybackAmount: z, pendingIncoming: z, pendingPayment: z, + pendingIncomingDirty: z, + pendingIncomingRefresh: z, + pendingIncomingWithdraw: z, }; let entryCurr = balance.byCurrency[amount.currency]; if (!entryCurr) { @@ -2238,6 +2252,7 @@ export class Wallet { } if (c.status === CoinStatus.Dirty) { addTo(balance, "pendingIncoming", c.currentAmount, c.exchangeBaseUrl); + addTo(balance, "pendingIncomingDirty", c.currentAmount, c.exchangeBaseUrl); return balance; } return balance; @@ -2257,6 +2272,7 @@ export class Wallet { amount = Amounts.add(amount, r.precoin_amount).amount; if (Amounts.cmp(smallestWithdraw[r.exchange_base_url], amount) < 0) { addTo(balance, "pendingIncoming", amount, r.exchange_base_url); + addTo(balance, "pendingIncomingWithdraw", amount, r.exchange_base_url); } return balance; } @@ -2284,6 +2300,7 @@ export class Wallet { return balance; } addTo(balance, "pendingIncoming", r.valueOutput, r.exchangeBaseUrl); + addTo(balance, "pendingIncomingRefresh", r.valueOutput, r.exchangeBaseUrl); return balance; } @@ -2338,6 +2355,7 @@ export class Wallet { tx.iter(Stores.reserves).fold(collectPaybacks, balanceStore); tx.iter(Stores.purchases).fold(collectPayments, balanceStore); await tx.finish(); + console.log("computed balances:", balanceStore) return balanceStore; } @@ -2441,9 +2459,12 @@ export class Wallet { .iter(Stores.refresh) .toArray(); for (const session of oldRefreshSessions) { + if (session.finished) { + continue; + } Wallet.enableTracing && - console.log("got old refresh session for", oldCoinPub, session); - return this.continueRefreshSession(session); + console.log("waiting for unfinished old refresh session for", oldCoinPub, session); + await this.continueRefreshSession(session); } const coin = await this.q().get(Stores.coins, oldCoinPub); if (!coin) { @@ -2454,6 +2475,7 @@ export class Wallet { coin.status === CoinStatus.Useless || coin.status === CoinStatus.Fresh ) { + Wallet.enableTracing && console.log("not refreshing due to coin status", CoinStatus[coin.status]) return; } const refreshSession = await this.createRefreshSession(oldCoinPub); @@ -3032,8 +3054,9 @@ export class Wallet { merchant: {}, merchant_pub: pub, order_id: "none", - pay_deadline: `/Date(${stampSecNow + 60 * 5})/`, - pay_url: "", + pay_deadline: `/Date(${stampSecNow + 30 * 5})/`, + wire_transfer_deadline: `/Date(${stampSecNow + 60 * 5})/`, + merchant_base_url: "taler://return-to-account", products: [], refund_deadline: `/Date(${stampSecNow + 60 * 5})/`, timestamp: `/Date(${stampSecNow})/`, @@ -3466,9 +3489,7 @@ export class Wallet { throw Error("invalid taler://tip URI"); } - const tipStatusUrl = new URI(res.tipPickupUrl) - .addQuery({ tip_id: res.tipId }) - .href(); + const tipStatusUrl = new URI(res.tipPickupUrl).href(); console.log("checking tip status from", tipStatusUrl); const merchantResp = await this.http.get(tipStatusUrl); console.log("resp:", merchantResp.responseJson); @@ -3552,8 +3573,12 @@ export class Wallet { const abortReq = { ...purchase.payReq, mode: "abort-refund" }; + const payUrl = new URI("pay") + .absoluteTo(purchase.contractTerms.merchant_base_url) + .href(); + try { - resp = await this.http.postJson(purchase.contractTerms.pay_url, abortReq); + resp = await this.http.postJson(payUrl, abortReq); } catch (e) { // Gives the user the option to retry / abort and refresh console.log("aborting payment failed", e); diff --git a/src/walletTypes.ts b/src/walletTypes.ts index d29e3812e..fddf05680 100644 --- a/src/walletTypes.ts +++ b/src/walletTypes.ts @@ -187,6 +187,10 @@ export interface WalletBalanceEntry { * Amount that was paid back and we could withdraw again. */ paybackAmount: AmountJson; + + pendingIncomingWithdraw: AmountJson; + pendingIncomingRefresh: AmountJson; + pendingIncomingDirty: AmountJson; } /** diff --git a/src/webex/background.ts b/src/webex/background.ts index 3c63f323e..dbc540df4 100644 --- a/src/webex/background.ts +++ b/src/webex/background.ts @@ -23,7 +23,7 @@ /** * Imports. */ -import {wxMain} from "./wxBackend"; +import { wxMain } from "./wxBackend"; window.addEventListener("load", () => { wxMain(); 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 Loading payment information ...; } + let insufficientBalance = false; + if (payStatus.status == "insufficient-balance") { + insufficientBalance = true; + } + if (payStatus.status === "error") { return Error: {payStatus.error}; } @@ -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 }) { )}

+ {insufficientBalance ? ( +
+

Unable to pay: Your balance is insufficient.

+
+ ) : null} + {payErrMsg ? (

Payment failed: {payErrMsg}

@@ -142,6 +153,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
doPayment()}> {i18n.str`Confirm payment`} diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx index 0a066053b..148b8203c 100644 --- a/src/webex/pages/tip.tsx +++ b/src/webex/pages/tip.tsx @@ -88,7 +88,7 @@ function TipDisplay(props: { talerTipUri: string }) {

accept()}> - AcceptTip + Accept Tip {" "}