aboutsummaryrefslogtreecommitdiff
path: root/src/content_scripts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-02-14 19:45:22 +0100
committerFlorian Dold <florian.dold@gmail.com>2017-02-16 23:21:55 +0100
commit93e3d52735b35a0b5405ed774a5bf0dbc8d8e8f2 (patch)
treeed35d024b8fa99eebe10058ebae29e0e8af56b2e /src/content_scripts
parentaf6843a2aa9c0e35d5d400adc85c51af83673eeb (diff)
downloadwallet-core-93e3d52735b35a0b5405ed774a5bf0dbc8d8e8f2.tar.xz
remove repurchase correlation id
Diffstat (limited to 'src/content_scripts')
-rw-r--r--src/content_scripts/notify.ts75
1 files changed, 22 insertions, 53 deletions
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<any> {
- 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<any> {
// 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() {