From fabee83b5d8d444ab32019e7f21b306ea4d96494 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Tue, 28 Nov 2017 18:03:44 +0200 Subject: [PATCH] View for expired invoices --- checkout.js | 2 +- views/checkout.pug | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/checkout.js b/checkout.js index ac8e708..06ac469 100644 --- a/checkout.js +++ b/checkout.js @@ -28,7 +28,7 @@ module.exports = app => { if (req.invoice.completed && opt.redirect_url) return res.redirect(opt.redirect_url) - res.render('checkout', { ...req.invoice, qr: makeQR(req.invoice) }) + res.render('checkout', { ...req.invoice, expired: req.invoice_expired, qr: makeQR(req.invoice) }) }) // like /invoice/:invoice/wait, but user-accessible, doesn't reveal the full invoice fields, diff --git a/views/checkout.pug b/views/checkout.pug index b97d47b..4d2b6f7 100644 --- a/views/checkout.pug +++ b/views/checkout.pug @@ -30,7 +30,13 @@ mixin css(path) else h3 #{ formatMsat(msatoshi) } - if !completed + if completed + p.thankyou= opt.thank_you || 'Thank you! Your payment has been received.' + + else if expired + p.expired= opt.expired || 'Your invoice has expired. Please try again.' + + else .row .qr.col-sm-4: img(src=qr) .pay.col-sm-8 @@ -38,8 +44,5 @@ mixin css(path) a.btn.btn-lg.btn-primary(href=`lightning:${payreq}`)= opt.button || 'Pay with wallet' p.expiry.text-muted Invoice expires in #[span] - else - p.thankyou= opt.thank_you || 'Thank you! Your payment has been received.' -if !completed - script(src=settings.static_url+'checkout.js') + script(src=settings.static_url+'checkout.js')