From e28129903772b99ad63613ba203c2d0dd20937c9 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 8 Aug 2021 18:33:12 +0200 Subject: comments --- merchant-spec/public-orders-get.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'merchant-spec') diff --git a/merchant-spec/public-orders-get.ts b/merchant-spec/public-orders-get.ts index d46475f1..20b893a6 100644 --- a/merchant-spec/public-orders-get.ts +++ b/merchant-spec/public-orders-get.ts @@ -16,6 +16,7 @@ interface MerchantOrderInfo { lastPaidSessionId?: string; } +// Data from the client's request to /orders/{id} interface Req { orderId: string; contractHash?: string; @@ -24,15 +25,19 @@ interface Req { accept: "json" | "html"; } +// (Abstract) response to /orders/{id} interface Resp { httpStatus: string; + // Schema type of the response responseType: string; // Additional details about response response?: any; } +// Abstracted merchant database type MerchantOrderStore = { [orderId: string]: MerchantOrderInfo }; +// Logic for /orders/{id} function handlePublicOrdersGet(mos: MerchantOrderStore, req: Req): Resp { const ord = mos[req.orderId]; if (!ord) { @@ -132,6 +137,7 @@ function handlePublicOrdersGet(mos: MerchantOrderStore, req: Req): Resp { }; } +// Helper to find an already paid order ID. function findAlreadyPaid( mos: MerchantOrderStore, sessionId: string -- cgit v1.2.3