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 negative amount for items #1

Open
engram-design opened this issue Oct 3, 2019 · 1 comment
Open

Allow negative amount for items #1

engram-design opened this issue Oct 3, 2019 · 1 comment

Comments

@engram-design
Copy link

engram-design commented Oct 3, 2019

Having an issue whenever there's a negative item (not line item) in the order - namely a discount. For example, refer to the below cart:

image

The above has a discount set to remove the shipping value from the order, but any discount will do the same thing. Tested with taking a flat $5 off the order.

Trying to pay throws a A negative amount is not allowed..

Drilling into it, it seems mostly an omnipay issue. Refer to Getting the items in the cart, which in turn calls a common method, checking if each item is negative. Give the example above:

Money\Money#1
(
    [Money\Money:amount] => '29595'
    [Money\Money:currency] => Money\Currency#2
    (
        [Money\Currency:code] => 'AUD'
    )
) 
Money\Money#1
(
    [Money\Money:amount] => '1350'
    [Money\Money:currency] => Money\Currency#2
    (
        [Money\Currency:code] => 'AUD'
    )
) 
Money\Money#1
(
    [Money\Money:amount] => '-1350'
    [Money\Money:currency] => Money\Currency#2
    (
        [Money\Currency:code] => 'AUD'
    )
)

Because one value in that is negative, this check ($money->isNegative()) is thrown.

Slightly related to this is thephpleague/omnipay-paypal#198, where the PayPal plugin includes protected $negativeAmountAllowed = true;. I have confirmed adding this the the eway plugin works.

This begs the question though - is this really not an issue for anyone else using this plugin? I would've thought this would've been picked up sooner, so just trying to figure out if I'm doing something wrong. In any case, it would probably require a fork of the omnipay-eway package?

Any ideas @lukeholder or @nfourtythree ?

@engram-design
Copy link
Author

This can also be solved by setting sendCartInfo => false for the gateway.

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

No branches or pull requests

1 participant