GithubHelp home page GithubHelp logo

Comments (7)

MercuryKojo avatar MercuryKojo commented on September 2, 2024 1

Hi @kingjia90 here is the Stacktrace:
[2023-03-18T09:57:04.352127+01:00] request.CRITICAL: Uncaught PHP Exception Pimcore\Bundle\EcommerceFrameworkBundle\Exception\VoucherServiceException: "Token has already been used." at /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/VoucherService/TokenManager/Pattern.php line 140 {"exception":"[object] (Pimcore\Bundle\EcommerceFrameworkBundle\Exception\VoucherServiceException(code: 1): Token has already been used. at /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/VoucherService/TokenManager/Pattern.php:140)"} []

[2023-03-18T09:57:04.352301+01:00] app.ERROR: Pimcore\Bundle\EcommerceFrameworkBundle\Exception\VoucherServiceException: Token has already been used. in /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/VoucherService/TokenManager/Pattern.php:140 Stack trace:
#0 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/VoucherService/DefaultService.php(136): Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\TokenManager\Pattern->applyToken('STUcard-AfWkb', Object(App\Ecommerce\CartManager\SessionCart), Object(App\Model\DataObject\OnlineShopOrder))
#1 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/OrderManager/V7/OrderManager.php(744): Pimcore\Bundle\EcommerceFrameworkBundle\VoucherService\DefaultService->applyToken('STUcard-AfWkb', Object(App\Ecommerce\CartManager\SessionCart), Object(App\Model\DataObject\OnlineShopOrder))
#2 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/OrderManager/V7/OrderManager.php(246): Pimcore\Bundle\EcommerceFrameworkBundle\OrderManager\V7\OrderManager->applyVoucherTokens(Object(App\Model\DataObject\OnlineShopOrder), Object(App\Ecommerce\CartManager\SessionCart)) #3 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/OrderManager/V7/OrderManager.php(349): Pimcore\Bundle\EcommerceFrameworkBundle\OrderManager\V7\OrderManager->getOrCreateOrderFromCart(Object(App\Ecommerce\CartManager\SessionCart))
#4 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/CheckoutManager/V7/CheckoutManager.php(227): Pimcore\Bundle\EcommerceFrameworkBundle\OrderManager\V7\OrderManager->recreateOrder(Object(App\Ecommerce\CartManager\SessionCart))
#5 /home/.../www/vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/CheckoutManager/V7/CheckoutManager.php(247): Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\CheckoutManager->checkIfPaymentIsPossible()
#6 /home/.../www/src/Controller/PaymentController.php(72): Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\CheckoutManager->initOrderPayment()
#7 /home/.../www/vendor/symfony/http-kernel/HttpKernel.php(153): App\Controller\PaymentController->paymentAction(Object(Symfony\Component\HttpFoundation\Request), Object(Pimcore\Log\ApplicationLogger))
#8 /home/.../www/vendor/symfony/http-kernel/HttpKernel.php(75): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#9 /home/.../www/vendor/symfony/http-kernel/Kernel.php(202): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 /home/.../www/public/index.php(35): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#11 {main} [] []

Pimcore Demo definitely throws an Error with this steps:

Configure Commercial voucher
image
add commercial car and voucher
image
Checkout until payment and start creditcard payment (but don't complete the payment)
image
Go Back to Cart and Change the amount to 2 (so pimcore will recreate the order)
image
checkout again until Payment select and click on creditcard again and it will throw an error:
image

from ecommerce-framework-bundle.

github-actions avatar github-actions commented on September 2, 2024

Thanks a lot for reporting the issue. We did not consider the issue as "Priority" or "Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

from ecommerce-framework-bundle.

kingjia90 avatar kingjia90 commented on September 2, 2024

Is it reproducible on the Pimcore demo?
I wasn't able to simulate, can you check if usages of the given token is still 0?

image
can you also provide the screenshot of the error message (stack trace or any code/error message)?

from ecommerce-framework-bundle.

kingjia90 avatar kingjia90 commented on September 2, 2024

Confirming the problem.
When one step into the payment, in the backend it would create the order which logs the payment history and there the price is the already discounted as if it applied the voucher and triggers its usage.
From user perspective, going back to change the cart should be naturally possible, but i am having some concern about concurrent same one-time vouchers on these pending orders, if we trigger usage only at successfull payments. 🤔 Need digging some more on how to fix this

from ecommerce-framework-bundle.

fashxp avatar fashxp commented on September 2, 2024

My thoughts on this:
Finishing the original and the recreated order is most likely some unwanted scenario. It is possible though, and to make it traceable and also fixable for customer service we decided to do it that way and keeping both orders.

From that perspective, I think most reasonable fix for that would be to remove the voucher from the original order when recreating the order (and place the information in notes or version notes for traceability)?

@kingjia90 WDYT?

from ecommerce-framework-bundle.

kingjia90 avatar kingjia90 commented on September 2, 2024

@fashxp had some time to look into it and seems that #121 may fix it

from ecommerce-framework-bundle.

dvesh3 avatar dvesh3 commented on September 2, 2024

Fixed by #121

from ecommerce-framework-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.