make summary optional

This commit is contained in:
Florian Dold 2017-02-12 19:23:29 +01:00
parent f8edc4f430
commit bd02776f86
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
2 changed files with 12 additions and 17 deletions

View File

@ -235,31 +235,26 @@ namespace TalerNotify {
return; return;
} }
const offer = msg.contract_wrapper; const proposal = msg.contract_wrapper;
if (!offer.contract) { if (!proposal.data) {
console.error("contract field missing"); console.error("field proposal.data field missing");
return; return;
} }
if (!offer.H_contract) { if (!proposal.hash) {
console.error("H_contract field missing"); console.error("proposal.hash field missing");
return; return;
} }
let walletHashContractMsg = { let contractHash = await hashContract(proposal.data);
type: "hash-contract",
detail: {contract: offer.contract}
};
let contractHash = await hashContract(offer.contract); if (contractHash != proposal.hash) {
if (contractHash != offer.H_contract) {
console.error("merchant-supplied contract hash is wrong"); console.error("merchant-supplied contract hash is wrong");
return; return;
} }
let resp = await checkRepurchase(offer.contract); let resp = await checkRepurchase(proposal.data);
if (resp.error) { if (resp.error) {
console.error("wallet backend error", resp); console.error("wallet backend error", resp);
@ -277,7 +272,7 @@ namespace TalerNotify {
let merchantName = "(unknown)"; let merchantName = "(unknown)";
try { try {
merchantName = offer.contract.merchant.name; merchantName = proposal.data.merchant.name;
} catch (e) { } catch (e) {
// bad contract / name not included // bad contract / name not included
} }
@ -292,7 +287,7 @@ namespace TalerNotify {
} }
}; };
await putHistory(historyEntry); await putHistory(historyEntry);
let offerId = await saveOffer(offer); let offerId = await saveOffer(proposal);
const uri = URI(chrome.extension.getURL( const uri = URI(chrome.extension.getURL(
"/src/pages/confirm-contract.html")); "/src/pages/confirm-contract.html"));

View File

@ -441,8 +441,8 @@ export class Contract {
@Checkable.String @Checkable.String
H_wire: string; H_wire: string;
@Checkable.String @Checkable.Optional(Checkable.String)
summary: string; summary?: string;
@Checkable.Value(AmountJson) @Checkable.Value(AmountJson)
amount: AmountJson; amount: AmountJson;