Ejemplo n.º 1
0
 def _handle_card_declined(invoice, payment_method):
     from corehq.apps.accounting.tasks import send_autopay_failed
     log_accounting_error(
         "[Autopay] An automatic payment failed for invoice: {} "
         "because the card was declined. This invoice will not be automatically paid. "
         "Not necessarily actionable, but be aware that this happened.".
         format(invoice.id))
     send_autopay_failed.delay(invoice, payment_method)
Ejemplo n.º 2
0
 def _handle_card_declined(invoice, payment_method):
     from corehq.apps.accounting.tasks import send_autopay_failed
     log_accounting_error(
         "[Autopay] An automatic payment failed for invoice: {} "
         "because the card was declined. This invoice will not be automatically paid. "
         "Not necessarily actionable, but be aware that this happened."
         .format(invoice.id)
     )
     send_autopay_failed.delay(invoice, payment_method)
Ejemplo n.º 3
0
    def _handle_card_declined(invoice, payment_method, e):
        from corehq.apps.accounting.tasks import send_autopay_failed

        # https://stripe.com/docs/api/python#error_handling
        body = e.json_body
        err = body.get('error', {})

        log_accounting_error(
            "[Autopay] An automatic payment failed for invoice: {} "
            "because the card was declined. This invoice will not be automatically paid. "
            "Not necessarily actionable, but be aware that this happened. "
            "error = {}".format(invoice.id, err))
        send_autopay_failed.delay(invoice, payment_method)
Ejemplo n.º 4
0
    def _handle_card_declined(invoice, e):
        from corehq.apps.accounting.tasks import send_autopay_failed

        # https://stripe.com/docs/api/python#error_handling
        body = e.json_body
        err = body.get('error', {})

        log_accounting_error(
            "[Autopay] An automatic payment failed for invoice: {invoice} ({domain})"
            "because the card was declined. This invoice will not be automatically paid. "
            "Not necessarily actionable, but be aware that this happened. "
            "error = {error}"
            .format(invoice=invoice.id, domain=invoice.get_domain(), error=err)
        )
        send_autopay_failed.delay(invoice)