Example #1
0
def webhook_invoice_chargeback(iID, amount, date, mollie_payment_id,
                               mollie_chargeback_id, note):
    """
    Actuall add chargeback invoice payment
    This function is separate for testability
    """
    from openstudio.os_invoice import Invoice
    invoice = Invoice(iID)

    print("note in wic")
    print(note)

    ipID = invoice.payment_add(
        amount,
        date,
        payment_methods_id=100,  # Static id for Mollie payments
        mollie_payment_id=mollie_payment_id,
        mollie_chargeback_id=mollie_chargeback_id,
        note=note)

    # Notify customer of chargeback
    cuID = invoice.get_linked_customer_id()
    os_mail = OsMail()
    msgID = os_mail.render_email_template('payment_recurring_failed')
    os_mail.send_and_archive(msgID, cuID)
Example #2
0
def webhook_invoice_paid(iID, payment_amount, payment_date, mollie_payment_id):
    """
        :param iID: db.invoices.id
        :return: None
    """
    invoice = Invoice(iID)

    ipID = invoice.payment_add(
        payment_amount,
        payment_date,
        payment_methods_id=100,  # Static id for Mollie payments
        mollie_payment_id=mollie_payment_id)
Example #3
0
def webhook_invoice_paid(iID, payment_amount, payment_date, mollie_payment_id):
    """
        :param iID: db.invoices.id
        :return: None
    """
    query = (db.invoices_payments.mollie_payment_id == mollie_payment_id)
    if not db(query).count():
        # Don't process a payment twice
        invoice = Invoice(iID)

        ipID = invoice.payment_add(
            payment_amount,
            payment_date,
            payment_methods_id=100,  # Static id for Mollie payments
            mollie_payment_id=mollie_payment_id)
Example #4
0
def webhook_invoice_refund(iID, amount, date, mollie_payment_id,
                           mollie_refund_id, note):
    """
    Actually add refund invoice payment
    This function is separate for testability
    """
    from openstudio.os_invoice import Invoice
    invoice = Invoice(iID)

    ipID = invoice.payment_add(
        amount,
        date,
        payment_methods_id=100,  # Static id for Mollie payments
        mollie_payment_id=mollie_payment_id,
        mollie_refund_id=mollie_refund_id,
        note=note)
Example #5
0
def webhook_invoice_chargeback(iID, chargeback_amount, chargeback_date,
                               mollie_payment_id, chargeback_id,
                               chargeback_details):
    """
    Chargebacks happen when a direct debit payment fails due to insufficient funds in the customers' bank account
    :return:
    """
    invoice = Invoice(iID)

    ipID = invoice.payment_add(
        chargeback_amount,
        chargeback_date,
        payment_methods_id=100,  # Static id for Mollie payments
        mollie_payment_id=mollie_payment_id,
        note="Mollie Chargeback (%s) - %s" %
        (chargeback_id, chargeback_details))

    # Notify customer of chargeback
    cuID = invoice.get_linked_customer_id()
    os_mail = OsMail()
    msgID = os_mail.render_email_template('payment_recurring_failed')
    os_mail.send(msgID, cuID)