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

Allow capturing or voiding payments only with positive amount #3761

Merged

Conversation

spaghetticode
Copy link
Member

Description

There's no point in capturing or voiding a payment with zero amount. When capturing zero amount, ActiveMerchant will respond with the error This value must be greater than or equal to 1., while if payment amount is zero, the error from ActiveMerchant responds with the error Amount must be at least $0.50 usd.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

@spaghetticode spaghetticode self-assigned this Sep 15, 2020
@spaghetticode spaghetticode force-pushed the spaghetticode/positive-amount-capture branch from 3aa00c7 to 9a165de Compare September 15, 2020 13:23
There's no point in capturing or voiding a payment with zero amount.

When capturing zero amount, ActiveMerchant will respond with the
error `This value must be greater than or equal to 1.`, while if
payment amount is zero, the error from ActiveMerchant responds
with the error `Amount must be at least $0.50 usd`.
The paramenter `amount` is renamed to avoid shadowing the method with
the same name in `Spree::Payment`, which includes this module.
@spaghetticode spaghetticode force-pushed the spaghetticode/positive-amount-capture branch from 9a165de to 9a58a45 Compare September 15, 2020 14:21
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.

Thanks, Andrea!

@kennyadsl kennyadsl merged commit a36a825 into solidusio:master Sep 18, 2020
@kennyadsl kennyadsl deleted the spaghetticode/positive-amount-capture branch September 18, 2020 07:35
spaghetticode added a commit to spaghetticode/solidus_stripe that referenced this pull request Oct 2, 2020
In Solidus we changed the way we void payments. When the payment
has zero amount we don't try to void anymore.
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