MultiSafepay / Magento2Msp

MultiSafepay plugin for Magento 2 (Deprecated) see: https://github.com/MultiSafepay/magento2
Open Software License 3.0
29 stars 25 forks source link

payment_link not created and saved in sales_order_payment table when order is created via REST API #139

Closed trebb0r closed 3 years ago

trebb0r commented 3 years ago

Hello,

When I create an order via REST API (using V1/carts/min/items, V1/carts/mine/estimate-shipping-methods, V1/carts/mine-shipping-information and V1/carts/mine/payment-information), the following info is then found in the sales_order_payment table under additional_information: {"issuerid":null,"method_title":"iDEAL"}.

That's it. I'm missing the payment_link that does get created and saved there when you create an order via the regular Magento 2 frontend checkout.

Is this a bug or did I created the order incorrectly via the REST API of Magento 2?

Hexmage commented 3 years ago

I don't believe the rest api triggers the correct functions to create a paymentlink.

You could try adding

 <event name="sales_order_place_after">
        <observer name="msp_order_place_after" instance="MultiSafepay\Connect\Model\Observers\Order"/>
    </event>

to etc/webapi_rest/events.xml because that is how graphql creates the payment link.

trebb0r commented 3 years ago

I have tested this a bit more, I do get a payment_link now, however: it's missing some parameters and also, when you go to the link, it'll redirect to a different link of MultiSafepay, so parameters won't even work.

Also I'm getting a different kind of payment link, compared to when I order via Magento 2 frontend checkout:

The next step = We would like to be able to change the merchantReturnURL link, because it does not redirect to the correct URL after we complete the payment via MSP.

vinodsowdagar commented 3 years ago

Hi @trebb0r ,

Thank you for your message. We are currently looking into this and testing this feature ourselves. As soon as we know more, we will let you know.

Jasper-MultiSafepay commented 3 years ago

As @Hexmage described,

 <event name="sales_order_place_after">
        <observer name="msp_order_place_after" instance="MultiSafepay\Connect\Model\Observers\Order"/>
    </event>

In etc/webapi_rest/events.xml