diff options
-rw-r--r-- | merchant-spec/public-orders-get.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/merchant-spec/public-orders-get.ts b/merchant-spec/public-orders-get.ts index 03c4f7af..b256860c 100644 --- a/merchant-spec/public-orders-get.ts +++ b/merchant-spec/public-orders-get.ts @@ -33,6 +33,8 @@ interface Resp { responseType: string; // Redirect "Location: " if applicable to status code redirectLocation?: string; + // "Taler: " header in the response + talerHeader?: string; // Additional details about response response?: any; } @@ -60,7 +62,7 @@ function handlePublicOrdersGet(mos: MerchantOrderStore, req: Req): Resp { // Contract terms hash given but wrong return respForbidden(req); } - if (req.claimToken && ord.claimToken !== req.claimToken) { + if (req.claimToken && !ctOk) { // Claim token given but wrong return respForbidden(req); } @@ -165,11 +167,18 @@ function respGoto(req: Req, publicReorderUrl: string): Resp { function respUnpaid(req: Req, ord: MerchantOrderInfo): Resp { if (req.accept === "html") { - return; + return { + httpStatus: "402 Payment Required", + contentType: "html", + responseType: "StatusUnpaidResponse", + // This must include the claim token. The same taler:// + // URI should also be shown as the QR code. + talerHeader: "taler://pay/..." + }; } return { httpStatus: "402 Payment Required", - contentType: "html", + contentType: "json", responseType: "StatusUnpaidResponse", response: { // Required for repurchase detection |