def get(self):
        # provide a blank form.
        template = JINJA_ENV.get_template('make.html')
        ctx = CKObject()
        ctx.valid_coins = ACCOUNT_MAP.keys()
        recent = MyInvoice.recent_invoices().fetch(40)
        ctx.recent_invoices = recent

        for inv in recent:
            if inv.paid_at != None:
                inv.text_status = 'PAID'
                continue

            # check if paid.
            try:
                d = get_ck_detail(inv.ck_refnum)
            except:
                logger.error("Failed on %s" % inv.ck_refnum, exc_info=1)
                continue

            inv.details = d
            if d.is_completed or d.amount_so_far.decimal:
                # TODO: should expose total paid so far (for tips and underpayment)
                # and link to transaction numbers displayed at blockr and so on.
                conf = d.events[0].confirmed_at
                if conf != None:
                    inv.paid_at = conf
                    inv.text_status = 'PAID'
                    inv.put_async()
                else:
                    inv.text_status = 'pending'
            else:
                inv.text_status = 'unpaid'

        self.response.write(template.render(ctx))
dataset/ETHPy150Open coinkite/coinkite-real-time-invoice/main.py/MakeHandler.get/original