Implemented Omnipay Mollie gateway not sending email after succesful order

  • Hello,


    I have implemented the Mollie payment gateway in Perch, but the webhook is handled outside of Perch.

    Using this webhook I am setting the order status to paid once the order is succesful. Sample code below:



    Now when creating an order, so when my checkout page sends me to the payment gateway, the created email gets sent (not needed, but for testing purposes). So the payment is succesful and the gateway sends me back to my thankyou page and updates the order status in the database to paid.


    After updating the order status, no email gets sent out. How could I handle that last piece, which would send the paid order email?


    Mike

  • drewm

    Approved the thread.
  • It's not being sent because you're bypassing Perch and writing directly to the database. Obviously that's not something we offer support for.


    If you were to implement a gateway adapter within Perch itself then all the correct events would be fired and the integrity of the system would be maintained.

  • I understand what you mean, but everything is being done by Perch with a gateway class, until it redirects to the Mollie gateway website.


    For example I am using the below code to give options to the gateway:



    This is all being done with Perch, so it is not totally bypassed from Perch, right?

  • Quote

    the webhook is handled outside of Perch


    You need to handle the webhook inside of Perch. If you just jam data into the database, Perch has no way of knowing that has happened and you bypass all the logic and functionality within the software. Plus you're leaving yourself with an un-updatable installation, as you've tightly coupled your code to our internal storage implementation, which could well change. Even adding a new non-nullable column to a table would cause your code to fail.

  • The only thing I need is to call the below code somewhere:

    Code
    1. $Order->set_status('paid');

    I now put it inside /perch/addons/apps/perch_shop/runtime/orders.php

    My gateway is changing the order status to paid_gateway when payment was succesful.


    This is ofcourse not the best solution, and will be overwritten wel updating perch_shop in the future. Does anyone have another option to call the set_status somewhere?