From 93e3d52735b35a0b5405ed774a5bf0dbc8d8e8f2 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 14 Feb 2017 19:45:22 +0100 Subject: remove repurchase correlation id --- src/content_scripts/notify.ts | 75 +++++++++++++------------------------------ 1 file changed, 22 insertions(+), 53 deletions(-) (limited to 'src/content_scripts') diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts index 582375e1d..a731e4da1 100644 --- a/src/content_scripts/notify.ts +++ b/src/content_scripts/notify.ts @@ -76,20 +76,6 @@ namespace TalerNotify { }); } - function checkRepurchase(contract: string): Promise { - const walletMsg = { - type: "check-repurchase", - detail: { - contract: contract - }, - }; - return new Promise((resolve, reject) => { - chrome.runtime.sendMessage(walletMsg, (resp: any) => { - resolve(resp); - }); - }); - } - function queryPayment(query: any): Promise { // current URL without fragment const walletMsg = { @@ -239,49 +225,32 @@ namespace TalerNotify { return; } - let resp = await checkRepurchase(proposal.data); - - if (resp.error) { - console.error("wallet backend error", resp); - return; + let merchantName = "(unknown)"; + try { + merchantName = proposal.data.merchant.name; + } catch (e) { + // bad contract / name not included } - if (resp.isRepurchase) { - logVerbose && console.log("doing repurchase"); - console.assert(resp.existingFulfillmentUrl); - console.assert(resp.existingContractHash); - window.location.href = subst(resp.existingFulfillmentUrl, - resp.existingContractHash); - - } else { - - let merchantName = "(unknown)"; - try { - merchantName = proposal.data.merchant.name; - } catch (e) { - // bad contract / name not included + let historyEntry = { + timestamp: (new Date).getTime(), + subjectId: `contract-${contractHash}`, + type: "offer-contract", + detail: { + contractHash, + merchantName, } + }; + await putHistory(historyEntry); + let offerId = await saveOffer(proposal); - let historyEntry = { - timestamp: (new Date).getTime(), - subjectId: `contract-${contractHash}`, - type: "offer-contract", - detail: { - contractHash, - merchantName, - } - }; - await putHistory(historyEntry); - let offerId = await saveOffer(proposal); - - const uri = URI(chrome.extension.getURL( - "/src/pages/confirm-contract.html")); - const params = { - offerId: offerId.toString(), - }; - const target = uri.query(params).href(); - document.location.replace(target); - } + const uri = URI(chrome.extension.getURL( + "/src/pages/confirm-contract.html")); + const params = { + offerId: offerId.toString(), + }; + const target = uri.query(params).href(); + document.location.replace(target); } function registerHandlers() { -- cgit v1.2.3