gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-wallet-webex] 01/02: rename data -> contract_terms


From: gnunet
Subject: [GNUnet-SVN] [taler-wallet-webex] 01/02: rename data -> contract_terms
Date: Wed, 17 Jan 2018 03:50:04 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-webex.

commit 894a09a51c1111257be56809f1d3daf0146f8509
Author: Florian Dold <address@hidden>
AuthorDate: Tue Jan 16 17:57:29 2018 +0100

    rename data -> contract_terms
---
 src/webex/notify.ts | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/webex/notify.ts b/src/webex/notify.ts
index 1a447c0a..a7d393a6 100644
--- a/src/webex/notify.ts
+++ b/src/webex/notify.ts
@@ -213,27 +213,16 @@ async function downloadContract(url: string, nonce: 
string): Promise<any> {
 
 async function processProposal(proposal: any) {
 
-  if (!proposal.data) {
-    console.error("field proposal.data field missing");
+  if (!proposal.contract_terms) {
+    console.error("field proposal.contract_terms field missing");
     return;
   }
 
-  if (!proposal.hash) {
-    console.error("proposal.hash field missing");
-    return;
-  }
-
-  const contractHash = await wxApi.hashContract(proposal.data);
-
-  if (contractHash !== proposal.hash) {
-    console.error(`merchant-supplied contract hash is wrong (us: 
${contractHash}, merchant: ${proposal.hash})`);
-    console.dir(proposal.data);
-    return;
-  }
+  const contractHash = await wxApi.hashContract(proposal.contract_terms);
 
   const proposalId = await wxApi.saveProposal({
-    contractTerms: proposal.data,
-    contractTermsHash: proposal.hash,
+    contractTerms: proposal.contract_terms,
+    contractTermsHash: contractHash,
     merchantSig: proposal.sig,
     timestamp: (new Date()).getTime(),
   });
@@ -375,7 +364,7 @@ function talerPay(msg: any): Promise<any> {
     if (msg.contract_url) {
       const nonce = await wxApi.generateNonce();
       const proposal = await downloadContract(msg.contract_url, nonce);
-      if (proposal.data.nonce !== nonce) {
+      if (proposal.contract_terms.nonce !== nonce) {
         console.error("stale contract");
         return;
       }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]