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

Invalidate existing non store credit payments during checkout #2075

Merged
merged 5 commits into from
Aug 13, 2017

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jul 11, 2017

When creating a new payment for an order having existing payments
we want all previous payments in checkout state to be invalidated; except
if they are store credit payments.

Former implementation only invalidated payments with same payment method.
That led to multiple valid payments per order for stores having more then
one payment method available for customers to choose from.

source: payment_source,
order: order,
amount: 5
)

Choose a reason for hiding this comment

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

Closing method call brace must be on the same line as the last argument when opening brace is on the same line as the first argument.

source: existing_payment_source,
order: order,
amount: 5
)

Choose a reason for hiding this comment

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

Closing method call brace must be on the same line as the last argument when opening brace is on the same line as the first argument.

Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

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

Thank you!

@tvdeyen tvdeyen changed the title Invalidate existing non store credit payments Invalidate existing non store credit payments during checkout Jul 11, 2017
@tvdeyen tvdeyen force-pushed the do-not-allow-multiple-payments branch from 8e11b15 to 438c997 Compare July 11, 2017 09:18
@tvdeyen tvdeyen force-pushed the do-not-allow-multiple-payments branch from 438c997 to 6c88998 Compare July 11, 2017 10:37
@tvdeyen tvdeyen self-assigned this Jul 11, 2017
@tvdeyen tvdeyen added the WIP label Jul 11, 2017
@tvdeyen
Copy link
Member Author

tvdeyen commented Jul 11, 2017

Waits for #2076

Copy link
Contributor

@jordan-brough jordan-brough left a comment

Choose a reason for hiding this comment

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

It still seems not quite right to me to special-case store credits like this. It feels like there must be a better way of accomplishing what's needed here.

But in any case this does feel like a step forward.

@tvdeyen tvdeyen marked this as a duplicate of #2095 Jul 18, 2017
@tvdeyen tvdeyen force-pushed the do-not-allow-multiple-payments branch from 6c88998 to f46a1ca Compare July 19, 2017 10:31
@tvdeyen tvdeyen removed the WIP label Jul 19, 2017
@tvdeyen tvdeyen removed their assignment Jul 19, 2017
@tvdeyen tvdeyen force-pushed the do-not-allow-multiple-payments branch from f46a1ca to 149cd5d Compare July 27, 2017 06:38
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

👍 just needs a Changelog conflict resolution!

The spec setup for the order payment spec creates multiple payments
that all have a different payment method ids because the factory creates
a new payment method object for each payment.

By using the same payment method for all payments we test what actually
happens during checkout.
In order to refactor the Payment#invalidate_old_payments method
we need more test coverage.
Existing payments other then store credit ones should be invalidated
when creating new payments.
When creating a new payment for an order having existing payments
we want all previous payments in checkout state to be invalidated; except
if they are store credit payments.

Former implementation only invalidated payments with same payment method.
That led to multiple valid payments per order for stores having more then
one payment method available for customers to choose from.
@tvdeyen tvdeyen force-pushed the do-not-allow-multiple-payments branch from 149cd5d to b15ab06 Compare August 11, 2017 21:21
@tvdeyen tvdeyen merged commit baf1d25 into solidusio:master Aug 13, 2017
@tvdeyen tvdeyen deleted the do-not-allow-multiple-payments branch August 13, 2017 19:16
@tvdeyen tvdeyen added this to the 2.4.0 milestone Aug 21, 2017
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.

5 participants