Skip to content

Commit

Permalink
[IMP] terminate_payment_provider_mandate
Browse files Browse the repository at this point in the history
  • Loading branch information
tarteo committed Sep 11, 2024
1 parent 5dfe6ef commit 232cefa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sale_recurring_payment_mollie/models/sale_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def update_sale_subscription_payments(self, date_ref):
if not invoices and date_ref == self.recurring_next_date:
self.generate_invoice()
unpaid_invoice = self.invoice_ids.filtered(
lambda i: i.invoice_date == date_ref and i.payment_state == "not_paid"
lambda i: i.invoice_date == date_ref
and i.payment_state == "not_paid" # TODO: Do we need to check here on date?
)
if not unpaid_invoice:
return False
Expand All @@ -38,10 +39,9 @@ def update_sale_subscription_payments(self, date_ref):
@api.model
def terminate_payment_provider_mandate(self):
# This method terminates the mandate on mollie
vals = super().terminate_payment_provider_mandate()
if self.payment_provider_mandate_id.provider_id.code != "mollie":
return super().terminate_payment_provider_mandate()
else:
vals = super().terminate_payment_provider_mandate()
return vals
mollie = self.env.ref("payment.payment_provider_mollie")
mollie_client = mollie._api_mollie_get_client()
customer = mollie_client.customers.get(self.partner_id.mollie_customer_id)
Expand All @@ -54,4 +54,4 @@ def terminate_payment_provider_mandate(self):
self.sudo().message_post(body=msg)
vals["is_payment_provider_mandate_terminated"] = True
self.write(vals)
return True
return vals

0 comments on commit 232cefa

Please sign in to comment.