From 27a42f92572abfdb2e60f3f212e4f0fcc71a6961 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 24 May 2016 17:30:27 +0200 Subject: respond to failed payments --- content_scripts/notify.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'content_scripts/notify.ts') diff --git a/content_scripts/notify.ts b/content_scripts/notify.ts index 8e70b44c4..4a65434af 100644 --- a/content_scripts/notify.ts +++ b/content_scripts/notify.ts @@ -165,9 +165,22 @@ namespace TalerNotify { }); }); + addHandler("taler-payment-failed", (e: CustomEvent) => { + const msg = { + type: "payment-failed", + detail: {}, + }; + chrome.runtime.sendMessage(msg, (resp) => { + let evt = new CustomEvent("taler-payment-failed-ok", { + detail: {} + }); + document.dispatchEvent(evt); + }); + }); + // Should be: taler-request-payment, taler-result-payment - addHandler("taler-execute-contract", function(e: CustomEvent) { + addHandler("taler-execute-contract", (e: CustomEvent) => { console.log("got taler-execute-contract in content page"); const msg = { type: "execute-payment", @@ -195,6 +208,9 @@ namespace TalerNotify { throw Error("contract missing"); } + // We have the details for then payment, the merchant page + // is responsible to give it to the merchant. + let evt = new CustomEvent("taler-notify-payment", { detail: { H_contract: e.detail.H_contract, -- cgit v1.2.3