summaryrefslogtreecommitdiff
path: root/merchant-spec
diff options
context:
space:
mode:
Diffstat (limited to 'merchant-spec')
-rw-r--r--merchant-spec/public-orders-get.ts6
1 files changed, 6 insertions, 0 deletions
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