mollie / PrestaShop

iDEAL, Creditcard, Bancontact, SOFORT, Bank transfer, PayPal & paysafecard for Prestashop
http://www.mollie.com
BSD 2-Clause "Simplified" License
69 stars 42 forks source link

Subscription is not created if product (combination) has other attribute(s) than Mollie subscription one #965

Open zorrobiwan opened 2 weeks ago

zorrobiwan commented 2 weeks ago

Expected behavior

One product with combinations (for example for these attributes : "Colors" and "Mollie subscription"). When creating an order for a combination with these attribute values "Red" and "Daily", the subscription is not created and error is logged if debug is enabled Log ID (66cf166be3aa86.38147825) | Failed to create recurring order . context: {\"Exception message\":\"Failed to create subscription data.\",\"Exception code\":1014} Order is well created.

Order AND subscription are created if the combination has only the "Mollie Subscription" attribute.

Actual behavior

Order AND subscription should be created even combination has other attributes than "Mollie Subscription"

Steps to reproduce the behavior

Create a product and combination with multiple attributes (ex: "Colors" and "Mollie subscription"). Create an order and check your subscription which is not created. If Mollie debug is enabled, check the logs and see the error message.

Environment

Extra debug log :

Mollie\\Subscription\\Exception\\SubscriptionIntervalException: No interval exists for this 241 attribute in /var/www/html/staging/modules/mollie/subscription/Provider/SubscriptionStartDateProvider.php:72
Stack trace:
#0 /var/www/html/staging/modules/mollie/subscription/Factory/CreateSubscriptionDataFactory.php(159): Mollie\\Subscription\\Provider\\SubscriptionStartDateProvider->getSubscriptionStartDate(Object(Combination))
#1 /var/www/html/staging/modules/mollie/subscription/Handler/SubscriptionCreationHandler.php(85): Mollie\\Subscription\\Factory\\CreateSubscriptionDataFactory->build(Object(Order), Array)
#2 /var/www/html/staging/modules/mollie/src/Handler/Order/OrderCreationHandler.php(294): Mollie\\Subscription\\Handler\\SubscriptionCreationHandler->handle(Object(Order), \'creditcard\')
#3 /var/www/html/staging/modules/mollie/src/Handler/Order/OrderCreationHandler.php(164): Mollie\\Handler\\Order\\OrderCreationHandler->createRecurringOrderEntity(Object(Order), \'creditcard\')
#4 /var/www/html/staging/modules/mollie/src/Service/TransactionService.php(204): Mollie\\Handler\\Order\\OrderCreationHandler->createOrder(Object(Mollie\\Api\\Resources\\Payment), 12993)
#5 /var/www/html/staging/modules/mollie/controllers/front/webhook.php(140): Mollie\\Service\\TransactionService->processTransaction(Object(Mollie\\Api\\Resources\\Payment))
#6 /var/www/html/staging/modules/mollie/controllers/front/webhook.php(96): MollieWebhookModuleFrontController->executeWebhook(\'tr_MvfE5AApqL\')
#7 /var/www/html/staging/classes/controller/Controller.php(306): MollieWebhookModuleFrontController->initContent()
#8 /var/www/html/staging/classes/Dispatcher.php(518): ControllerCore->run()
#9 /var/www/html/staging/index.php(28): DispatcherCore->dispatch()
#10 {main}
zorrobiwan commented 2 weeks ago

Solved by PR https://github.com/mollie/PrestaShop/pull/966

justelis22 commented 2 weeks ago

hi there @zorrobiwan, thank you for the information!

I forwarded everything to the development team, we will overview your PR and if everything is good include it to the upcoming release.

Best Regards, Invertus Support team.