Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛(backend) fix installment update #1036

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

kernicPanel
Copy link
Member

Purpose

When we check for installemnt payment after retrying, only the first transaction was taken into account.

@kernicPanel kernicPanel self-assigned this Jan 31, 2025
@kernicPanel kernicPanel force-pushed the fix-installment-update-2-try branch 3 times, most recently from b538b06 to cb4794e Compare January 31, 2025 16:18
self._do_on_payment_failure(order, installment["id"])
return False

order.set_installment_refused(installment["id"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should not continue to set the installment to refused state only if an UNPAID transaction is found. But we should continue to iterate over the transactions list.
Actually, if a transaction has never been debited, its state will be set to refused first.

@kernicPanel kernicPanel requested a review from jbpenrath February 3, 2025 09:45
# Mail is sent
self._check_installment_refused_email_sent(owner.email, order)
# No mail is sent
self.assertEqual(mail.outbox, [])

mail.outbox.clear()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we take away this line too ?
mail.outbox.clear()

json_response["answer"]["transactions"].append(
json_response["answer"]["transactions"][0]
)
json_response["answer"]["transactions"] = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
json_response["answer"]["transactions"].append(
json_response["answer"]["transactions"][0]
)
json_response["answer"]["transactions"] = []
json_response["answer"]["transactions"] = []

Comment on lines 2235 to 2237
When backend checks if an installment has already been paid, it should return True
if the payment has been made and should update the installment state to paid.
Last transaction is paid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When backend checks if an installment has already been paid, it should return True
if the payment has been made and should update the installment state to paid.
Last transaction is paid.
When backend checks if an installment has already been paid, it should return False
if the no payment has been made and should not update the installment state.
No transaction paid.

When we check for installemnt payment after retrying,
only the first transaction was taken into account.
@kernicPanel kernicPanel force-pushed the fix-installment-update-2-try branch from 9a95030 to cc4e48e Compare February 3, 2025 10:06
@kernicPanel kernicPanel enabled auto-merge (rebase) February 3, 2025 11:37
@kernicPanel kernicPanel merged commit 720e0e6 into main Feb 3, 2025
16 of 17 checks passed
@kernicPanel kernicPanel deleted the fix-installment-update-2-try branch February 3, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants