mollie / magento2

Mollie Payments for Magento 2
https://www.mollie.com
Other
101 stars 53 forks source link

[urgent] - Second chance emails does not work! Second chance email webhookurl is containing the admin panels url (baseurl/admin/mollie/checkout) #520

Closed erwinschaap closed 2 years ago

erwinschaap commented 2 years ago

Describe the bug When someone creates an order and the person is not paying the order and we send a second chance email from the backoffice in Magento the webhook url contains {baseurl}/admin/mollie/checkout. The purchase point of the automatic send email: Complete your payment at {company} is admin instead of the purchase point of the initial order. Also the link in the second chance email is to {baseurl}/admin/mollie etc (this is only when you send a second chance email from the new order created by the first time second chance but when I send the second email from the first order (initial order) I will get a link to mollie with a new order number instead of the one of the initial (its from the admin it looks like..)

Used versions

To Reproduce Steps to reproduce the behavior:

  1. Create an order
  2. do not pay the order first
  3. send a second chance email to the customer

Expected behavior The second chance creates a new order base on the store eg 300000140 and the webhook url contains no admin url

Actual behavior The second chance creates a new order from the backoffice with no store eg 3000000140-1 and the webhook url contains an admin url and also the redirect url

Screenshots No

Additional context This is also when people clicks on the second chance email from Mollie.

dennisvanderweide commented 2 years ago

I fixed it by setting the storeId for the cart when recreating an order in Mollie\Payment\Service\Order\Reorder::recreate

private function recreate(
    OrderInterface $originalOrder,
    string $method = 'mollie_methods_reorder'
): OrderInterface {
    ...

    $cart = $this->orderCreate->getQuote();
    $cart->setCustomerId($originalOrder->getCustomerId());
    $cart->setCustomerIsGuest($originalOrder->getCustomerIsGuest());
    $cart->setStoreId($originalOrder->getStoreId());

    ...

    return $order;
}
Frank-Magmodules commented 2 years ago

HI @dennisvanderweide and @erwinschaap , 

Thank you for opening this issue and sorry for my late response on this, we've tried to reproduce the issue that you describe but we can't reproduce this issue. Can you please share the details of this environment through our support form so we can take a look with you?

Frank-Magmodules commented 2 years ago

HI @dennisvanderweide and @erwinschaap

I didn't receive anything regarding this issue yet, can you please share this using our contact form so we can debug this issue with you, or please close the ticket once this is not easy anymore.

erwinschaap commented 2 years ago

@Frank-Magmodules It's difficult to share environment information, but the fix above by setting the storeId is working for us.

Frank-Magmodules commented 2 years ago

Allright @erwinschaap , great that it's working, therefore we are closing this issue now but please feel free to reopen the issue if this still occurs or if you have an environment available where we can take a closer on this.