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

Fix incorrect payment total calculation in process_payments_with #1416

Merged

Conversation

jhawthorn
Copy link
Contributor

@jhawthorn jhawthorn commented Sep 2, 2016

In 11de63f we added the inverse_of relation between order and payments, which caused some issues in process_payments_with from Order::Payments.

Payment has an after_save which triggers an order.update!, which updates the payment_total. process_payments_with was doing self.payment_total += payment.amount on each successful payment, making each payment amount counted twice.

This removes the addition in process_payments_with and relies on the callback performing the order update (which will update the payment total properly).

This commit also removes stubbing from a specs which now exposes this issue.

@jhawthorn jhawthorn changed the title Fix incorrect payment total calculation Fix incorrect payment total calculation in process_payments_with Sep 2, 2016
@cbrunsdon
Copy link
Contributor

👍

1 similar comment
@stewart
Copy link
Contributor

stewart commented Sep 2, 2016

👍

In 11de63f we added the inverse_of
relation between order and payments, which caused some issues in
process_payments_with from Order::Payments.

Payment has an after_save which triggers an order.update!, which updates
the payment_total. process_payments_with was doing self.payment_total +=
payment.amount on each successful payment, making each payment amount
counted twice.

This removes the addition in process_payments_with and relies on the
callback performing the order update (which will update the payment
total properly).

This commit also removes stubbing from a specs which now exposes this
issue.
@jhawthorn jhawthorn force-pushed the payment_total_inverse_of_issue branch from 6cee93d to 196ea27 Compare September 6, 2016 21:12
@jhawthorn jhawthorn merged commit 379e29c into solidusio:master Sep 6, 2016
@jhawthorn jhawthorn deleted the payment_total_inverse_of_issue branch September 6, 2016 21:33
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