def _send_payment_receipt(self, invoice, payment_record):
        from corehq.apps.accounting.tasks import send_purchase_receipt
        receipt_email_template = 'accounting/invoice_receipt_email.html'
        receipt_email_template_plaintext = 'accounting/invoice_receipt_email_plaintext.txt'
        try:
            domain = invoice.subscription.subscriber.domain
            product = SoftwareProductType.get_type_by_domain(Domain.get_by_name(domain))

            context = {
                'invoicing_contact_email': settings.INVOICING_CONTACT_EMAIL,
                'balance': fmt_dollar_amount(invoice.balance),
                'is_paid': invoice.is_paid,
                'date_due': invoice.date_due.strftime(USER_DATE_FORMAT) if invoice.date_due else 'None',
                'invoice_num': invoice.invoice_number,
            }
            send_purchase_receipt.delay(
                payment_record, product, domain, receipt_email_template, receipt_email_template_plaintext, context,
            )
        except:
            self._handle_email_failure(payment_record)
 def core_product(self):
     domain = Domain.get_by_name(self.domain)
     return SoftwareProductType.get_type_by_domain(domain)
 def core_product(self):
     domain = Domain.get_by_name(self.payment_method.billing_admin.domain)
     return SoftwareProductType.get_type_by_domain(domain)
 def core_product(self):
     domain = Domain.get_by_name(self.payment_method.billing_admin.domain)
     return SoftwareProductType.get_type_by_domain(domain)
 def core_product(self):
     domain = Domain.get_by_name(self.domain)
     return SoftwareProductType.get_type_by_domain(domain)