diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-12 19:23:29 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-12 19:23:29 +0100 |
commit | bd02776f86604eab5a267b39421d0d444f512f15 (patch) | |
tree | 4313a24672b76102f5fd07ced04dae6ea13bd75d | |
parent | f8edc4f430fbc5c92d63f8d01655183e84d67d99 (diff) | |
download | wallet-core-bd02776f86604eab5a267b39421d0d444f512f15.tar.xz |
make summary optional
-rw-r--r-- | src/content_scripts/notify.ts | 25 | ||||
-rw-r--r-- | src/types.ts | 4 |
2 files changed, 12 insertions, 17 deletions
diff --git a/src/content_scripts/notify.ts b/src/content_scripts/notify.ts index ef3a3ed62..fda5d3fec 100644 --- a/src/content_scripts/notify.ts +++ b/src/content_scripts/notify.ts @@ -235,31 +235,26 @@ namespace TalerNotify { return; } - const offer = msg.contract_wrapper; + const proposal = msg.contract_wrapper; - if (!offer.contract) { - console.error("contract field missing"); + if (!proposal.data) { + console.error("field proposal.data field missing"); return; } - if (!offer.H_contract) { - console.error("H_contract field missing"); + if (!proposal.hash) { + console.error("proposal.hash field missing"); return; } - let walletHashContractMsg = { - type: "hash-contract", - detail: {contract: offer.contract} - }; - - let contractHash = await hashContract(offer.contract); + let contractHash = await hashContract(proposal.data); - if (contractHash != offer.H_contract) { + if (contractHash != proposal.hash) { console.error("merchant-supplied contract hash is wrong"); return; } - let resp = await checkRepurchase(offer.contract); + let resp = await checkRepurchase(proposal.data); if (resp.error) { console.error("wallet backend error", resp); @@ -277,7 +272,7 @@ namespace TalerNotify { let merchantName = "(unknown)"; try { - merchantName = offer.contract.merchant.name; + merchantName = proposal.data.merchant.name; } catch (e) { // bad contract / name not included } @@ -292,7 +287,7 @@ namespace TalerNotify { } }; await putHistory(historyEntry); - let offerId = await saveOffer(offer); + let offerId = await saveOffer(proposal); const uri = URI(chrome.extension.getURL( "/src/pages/confirm-contract.html")); diff --git a/src/types.ts b/src/types.ts index b04453767..f3080ec78 100644 --- a/src/types.ts +++ b/src/types.ts @@ -441,8 +441,8 @@ export class Contract { @Checkable.String H_wire: string; - @Checkable.String - summary: string; + @Checkable.Optional(Checkable.String) + summary?: string; @Checkable.Value(AmountJson) amount: AmountJson; |