Setono / SyliusGiftCardPlugin

Sell gift cards on your Sylius store and let users use them in the checkout process
MIT License
45 stars 39 forks source link

Purchased card has a zero amount #193

Closed jum4 closed 2 years ago

jum4 commented 2 years ago

On 0.12.x branch, when a gift card is automatically created during a purchase, the amount is filled only if the card amount is configurable. For fixed amount, the amount is allways 0.

I think it is because the card is created in the AddToCartTypeExtension, and the cartItem prices are not already calculated at this step.

I can suggest a working pull request, but I am not sure about the method to use

Roshyo commented 2 years ago

I don't really get the problem here, as if the gift card has not a configurable amount (so fixed one) then Sylius mechanics takes place and set the OrderItem price itself.

What is your issue exactly ?

jum4 commented 2 years ago

My issue is the gift card is actually created with a 0 amount, maybe I misconfigured something ?

Roshyo commented 2 years ago

The gift card amount should be done on OrderProcess. Can you come up with either some test to reproduce, or a scenario ?

jum4 commented 2 years ago

GiftCardPlugin: 0.12.x Sylius: 1.10

Roshyo commented 2 years ago

Thank you @jum4 , I could reproduce with your scenario, and your PR is indeed fixing the issue. I'm just adding tests and we'll be able to proceed with merge