Skip to content

Allow capturing or voiding payments only with positive amount#3761

Merged
kennyadsl merged 2 commits into
solidusio:masterfrom
nebulab:spaghetticode/positive-amount-capture
Sep 18, 2020
Merged

Allow capturing or voiding payments only with positive amount#3761
kennyadsl merged 2 commits into
solidusio:masterfrom
nebulab:spaghetticode/positive-amount-capture

Conversation

@spaghetticode

Copy link
Copy Markdown
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

@kennyadsl kennyadsl left a comment

Copy link
Copy Markdown
Member

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