handle multiple refresh sessions correctly for refunded coins
This commit is contained in:
parent
8080c9a285
commit
8f973c69c4
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
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."
|
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
|
#, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:124
|
#: src/webex/pages/pay.tsx:129
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr "Bezahlung bestätigen"
|
msgstr "Bezahlung bestätigen"
|
||||||
|
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
msgid "The merchant %1$s offers you to purchase:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:119
|
#: src/webex/pages/pay.tsx:124
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:124
|
#: src/webex/pages/pay.tsx:129
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
msgid "The merchant %1$s offers you to purchase:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:119
|
#: src/webex/pages/pay.tsx:124
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:124
|
#: src/webex/pages/pay.tsx:129
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
msgid "The merchant %1$s offers you to purchase:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:119
|
#: src/webex/pages/pay.tsx:124
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:124
|
#: src/webex/pages/pay.tsx:129
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
msgid "The merchant %1$s offers you to purchase:"
|
||||||
msgstr "Säljaren %1$s erbjuder följande:"
|
msgstr "Säljaren %1$s erbjuder följande:"
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:119
|
#: src/webex/pages/pay.tsx:124
|
||||||
#, fuzzy, c-format
|
#, fuzzy, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr "Det totala priset är %1$s (plus %2$s avgifter).\n"
|
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
|
#, fuzzy, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr "Det totala priset är %1$s."
|
msgstr "Det totala priset är %1$s."
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr "Godkän betalning"
|
msgstr "Godkän betalning"
|
||||||
|
@ -37,27 +37,27 @@ msgstr ""
|
|||||||
msgid "time (ms/op)"
|
msgid "time (ms/op)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:113
|
#: src/webex/pages/pay.tsx:118
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The merchant %1$s offers you to purchase:"
|
msgid "The merchant %1$s offers you to purchase:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:119
|
#: src/webex/pages/pay.tsx:124
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s (plus %2$s fees)."
|
msgid "The total price is %1$s (plus %2$s fees)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:124
|
#: src/webex/pages/pay.tsx:129
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "The total price is %1$s."
|
msgid "The total price is %1$s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:138
|
#: src/webex/pages/pay.tsx:149
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Retry"
|
msgid "Retry"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/webex/pages/pay.tsx:146
|
#: src/webex/pages/pay.tsx:158
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Confirm payment"
|
msgid "Confirm payment"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -388,6 +388,12 @@ export class ContractTerms {
|
|||||||
@Checkable.String(timestampCheck)
|
@Checkable.String(timestampCheck)
|
||||||
refund_deadline: string;
|
refund_deadline: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deadline for the wire transfer.
|
||||||
|
*/
|
||||||
|
@Checkable.String(timestampCheck)
|
||||||
|
wire_transfer_deadline: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time when the contract was generated by the merchant.
|
* Time when the contract was generated by the merchant.
|
||||||
*/
|
*/
|
||||||
|
@ -114,6 +114,7 @@ import {
|
|||||||
parseTipUri,
|
parseTipUri,
|
||||||
parseRefundUri,
|
parseRefundUri,
|
||||||
} from "./taleruri";
|
} from "./taleruri";
|
||||||
|
import { isFirefox } from "./webex/compat";
|
||||||
|
|
||||||
interface SpeculativePayData {
|
interface SpeculativePayData {
|
||||||
payCoinInfo: PayCoinInfo;
|
payCoinInfo: PayCoinInfo;
|
||||||
@ -965,7 +966,9 @@ export class Wallet {
|
|||||||
let resp;
|
let resp;
|
||||||
const payReq = { ...purchase.payReq, session_id: sessionId };
|
const payReq = { ...purchase.payReq, session_id: sessionId };
|
||||||
|
|
||||||
const payUrl = new URI("pay").absoluteTo(purchase.contractTerms.merchant_base_url).href()
|
const payUrl = new URI("pay")
|
||||||
|
.absoluteTo(purchase.contractTerms.merchant_base_url)
|
||||||
|
.href();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resp = await this.http.postJson(payUrl, payReq);
|
resp = await this.http.postJson(payUrl, payReq);
|
||||||
@ -1925,12 +1928,18 @@ export class Wallet {
|
|||||||
!versionMatch.compatible &&
|
!versionMatch.compatible &&
|
||||||
versionMatch.currentCmp === -1
|
versionMatch.currentCmp === -1
|
||||||
) {
|
) {
|
||||||
console.log("wallet version might be outdated, checking for updates");
|
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) => {
|
chrome.runtime.requestUpdateCheck((status, details) => {
|
||||||
console.log("update check status:", status);
|
console.log("update check status:", status);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const ret: ReserveCreationInfo = {
|
const ret: ReserveCreationInfo = {
|
||||||
earliestDepositExpiration,
|
earliestDepositExpiration,
|
||||||
@ -2215,6 +2224,9 @@ export class Wallet {
|
|||||||
paybackAmount: z,
|
paybackAmount: z,
|
||||||
pendingIncoming: z,
|
pendingIncoming: z,
|
||||||
pendingPayment: z,
|
pendingPayment: z,
|
||||||
|
pendingIncomingDirty: z,
|
||||||
|
pendingIncomingRefresh: z,
|
||||||
|
pendingIncomingWithdraw: z,
|
||||||
};
|
};
|
||||||
let entryCurr = balance.byCurrency[amount.currency];
|
let entryCurr = balance.byCurrency[amount.currency];
|
||||||
if (!entryCurr) {
|
if (!entryCurr) {
|
||||||
@ -2240,6 +2252,7 @@ export class Wallet {
|
|||||||
}
|
}
|
||||||
if (c.status === CoinStatus.Dirty) {
|
if (c.status === CoinStatus.Dirty) {
|
||||||
addTo(balance, "pendingIncoming", c.currentAmount, c.exchangeBaseUrl);
|
addTo(balance, "pendingIncoming", c.currentAmount, c.exchangeBaseUrl);
|
||||||
|
addTo(balance, "pendingIncomingDirty", c.currentAmount, c.exchangeBaseUrl);
|
||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
return balance;
|
return balance;
|
||||||
@ -2259,6 +2272,7 @@ export class Wallet {
|
|||||||
amount = Amounts.add(amount, r.precoin_amount).amount;
|
amount = Amounts.add(amount, r.precoin_amount).amount;
|
||||||
if (Amounts.cmp(smallestWithdraw[r.exchange_base_url], amount) < 0) {
|
if (Amounts.cmp(smallestWithdraw[r.exchange_base_url], amount) < 0) {
|
||||||
addTo(balance, "pendingIncoming", amount, r.exchange_base_url);
|
addTo(balance, "pendingIncoming", amount, r.exchange_base_url);
|
||||||
|
addTo(balance, "pendingIncomingWithdraw", amount, r.exchange_base_url);
|
||||||
}
|
}
|
||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
@ -2286,6 +2300,7 @@ export class Wallet {
|
|||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
addTo(balance, "pendingIncoming", r.valueOutput, r.exchangeBaseUrl);
|
addTo(balance, "pendingIncoming", r.valueOutput, r.exchangeBaseUrl);
|
||||||
|
addTo(balance, "pendingIncomingRefresh", r.valueOutput, r.exchangeBaseUrl);
|
||||||
|
|
||||||
return balance;
|
return balance;
|
||||||
}
|
}
|
||||||
@ -2340,6 +2355,7 @@ export class Wallet {
|
|||||||
tx.iter(Stores.reserves).fold(collectPaybacks, balanceStore);
|
tx.iter(Stores.reserves).fold(collectPaybacks, balanceStore);
|
||||||
tx.iter(Stores.purchases).fold(collectPayments, balanceStore);
|
tx.iter(Stores.purchases).fold(collectPayments, balanceStore);
|
||||||
await tx.finish();
|
await tx.finish();
|
||||||
|
console.log("computed balances:", balanceStore)
|
||||||
return balanceStore;
|
return balanceStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2443,9 +2459,12 @@ export class Wallet {
|
|||||||
.iter(Stores.refresh)
|
.iter(Stores.refresh)
|
||||||
.toArray();
|
.toArray();
|
||||||
for (const session of oldRefreshSessions) {
|
for (const session of oldRefreshSessions) {
|
||||||
|
if (session.finished) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Wallet.enableTracing &&
|
Wallet.enableTracing &&
|
||||||
console.log("got old refresh session for", oldCoinPub, session);
|
console.log("waiting for unfinished old refresh session for", oldCoinPub, session);
|
||||||
return this.continueRefreshSession(session);
|
await this.continueRefreshSession(session);
|
||||||
}
|
}
|
||||||
const coin = await this.q().get(Stores.coins, oldCoinPub);
|
const coin = await this.q().get(Stores.coins, oldCoinPub);
|
||||||
if (!coin) {
|
if (!coin) {
|
||||||
@ -2456,6 +2475,7 @@ export class Wallet {
|
|||||||
coin.status === CoinStatus.Useless ||
|
coin.status === CoinStatus.Useless ||
|
||||||
coin.status === CoinStatus.Fresh
|
coin.status === CoinStatus.Fresh
|
||||||
) {
|
) {
|
||||||
|
Wallet.enableTracing && console.log("not refreshing due to coin status", CoinStatus[coin.status])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const refreshSession = await this.createRefreshSession(oldCoinPub);
|
const refreshSession = await this.createRefreshSession(oldCoinPub);
|
||||||
@ -3034,7 +3054,8 @@ export class Wallet {
|
|||||||
merchant: {},
|
merchant: {},
|
||||||
merchant_pub: pub,
|
merchant_pub: pub,
|
||||||
order_id: "none",
|
order_id: "none",
|
||||||
pay_deadline: `/Date(${stampSecNow + 60 * 5})/`,
|
pay_deadline: `/Date(${stampSecNow + 30 * 5})/`,
|
||||||
|
wire_transfer_deadline: `/Date(${stampSecNow + 60 * 5})/`,
|
||||||
merchant_base_url: "taler://return-to-account",
|
merchant_base_url: "taler://return-to-account",
|
||||||
products: [],
|
products: [],
|
||||||
refund_deadline: `/Date(${stampSecNow + 60 * 5})/`,
|
refund_deadline: `/Date(${stampSecNow + 60 * 5})/`,
|
||||||
@ -3552,7 +3573,9 @@ export class Wallet {
|
|||||||
|
|
||||||
const abortReq = { ...purchase.payReq, mode: "abort-refund" };
|
const abortReq = { ...purchase.payReq, mode: "abort-refund" };
|
||||||
|
|
||||||
const payUrl = new URI("pay").absoluteTo(purchase.contractTerms.merchant_base_url).href()
|
const payUrl = new URI("pay")
|
||||||
|
.absoluteTo(purchase.contractTerms.merchant_base_url)
|
||||||
|
.href();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
resp = await this.http.postJson(payUrl, abortReq);
|
resp = await this.http.postJson(payUrl, abortReq);
|
||||||
|
@ -187,6 +187,10 @@ export interface WalletBalanceEntry {
|
|||||||
* Amount that was paid back and we could withdraw again.
|
* Amount that was paid back and we could withdraw again.
|
||||||
*/
|
*/
|
||||||
paybackAmount: AmountJson;
|
paybackAmount: AmountJson;
|
||||||
|
|
||||||
|
pendingIncomingWithdraw: AmountJson;
|
||||||
|
pendingIncomingRefresh: AmountJson;
|
||||||
|
pendingIncomingDirty: AmountJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user