gnunet-svn
[Top][All Lists]
Advanced

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

[taler-docs] branch master updated: merchant spec: compare fulfillment U


From: gnunet
Subject: [taler-docs] branch master updated: merchant spec: compare fulfillment URL for already paid order
Date: Wed, 11 Aug 2021 16:55:01 +0200

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

dold pushed a commit to branch master
in repository docs.

The following commit(s) were added to refs/heads/master by this push:
     new e8dc761  merchant spec: compare fulfillment URL for already paid order
e8dc761 is described below

commit e8dc761f3bc93ec7c41fad9aa2e5d994b6357686
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Aug 11 16:54:49 2021 +0200

    merchant spec: compare fulfillment URL for already paid order
---
 merchant-spec/public-orders-get.ts | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/merchant-spec/public-orders-get.ts 
b/merchant-spec/public-orders-get.ts
index dbc3b8b..f966800 100644
--- a/merchant-spec/public-orders-get.ts
+++ b/merchant-spec/public-orders-get.ts
@@ -102,9 +102,15 @@ function handlePublicOrdersGet(mos: MerchantOrderStore, 
req: Req): Resp {
   }
 
   if (!!req.sessionId && req.sessionId !== ord.lastPaidSessionId) {
-    const alreadyPaidOrd = findAlreadyPaid(mos, req.sessionId);
-    if (!!alreadyPaidOrd) {
-      return respAlreadyPaid(req, alreadyPaidOrd);
+    if (!!ord.fulfillmentUrl) {
+      const alreadyPaidOrd = findAlreadyPaid(
+        mos,
+        req.sessionId,
+        ord.fulfillmentUrl
+      );
+      if (!!alreadyPaidOrd) {
+        return respAlreadyPaid(req, alreadyPaidOrd);
+      }
     }
     return respUnpaid(req, ord);
   }
@@ -219,10 +225,14 @@ function respPaid(req: Req, ord: MerchantOrderInfo): Resp 
{
 // Helper to find an already paid order ID.
 function findAlreadyPaid(
   mos: MerchantOrderStore,
-  sessionId: string
+  sessionId: string,
+  fulfillmentUrl: string
 ): MerchantOrderInfo | undefined {
   for (const orderId of Object.keys(mos)) {
-    if (mos[orderId].lastPaidSessionId === sessionId) {
+    if (
+      mos[orderId].lastPaidSessionId === sessionId &&
+      mos[orderId].fulfillmentUrl === fulfillmentUrl
+    ) {
       return mos[orderId];
     }
   }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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