Brille24 / SyliusCustomOptionsPlugin

A Sylius plugin that adds customer options
MIT License
46 stars 34 forks source link

CUSTOMER_OPTION_ADJUSTMENT not taken in Payum #63

Open Loocos opened 3 years ago

Loocos commented 3 years ago

Hi there,

When u try to pay with Paypal using this plugin. The price amout sent is not the right one. It miss the CUSTOMER_OPTION_ADJUSTMENT.

We need to override it by ourself the ConvertPaymentAction from the Sylius framework.

Need more details?

mamazu commented 3 years ago

Hello, thanks for reporting the bug.

This should be handled by Sylius however. Sylius should create a payment with the correct amount. It would be possible that it doesn't display the individual additions in Paypal but the total should be correct.

It would be nice though if you could explain the issue further (as we only use this plugin with offline payments this might really be an undiscovered bug.)

mamazu commented 11 months ago

I think this could be related to #143

chitkalaakella commented 1 month ago

Was the issue resolved and adjusted to new code

mamazu commented 1 month ago

Nope but there is an easy fix for it. Just add this to your OrderItem class:

    /**
     * Overriding sylius' total calculation to also take customer options into account.
     */
    public function getSubtotal(): int
    {
        return parent::getSubtotal() + $this->getAdjustmentsTotalRecursively(CustomerOptionRecalculator::CUSTOMER_OPTION_ADJUSTMENT);
    }