mollie / magento2

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

[FEATURE REQUEST] External POS // Access POS Payment method #717

Closed simonmaass closed 4 months ago

simonmaass commented 7 months ago

Describe the bug We are not able to access the payment method "mollie_methods_pointofsale" over the REST Api in magento. We are building a POS software for stationary retail stores and need to access the payment method POS for mollie.

When fetching the payment methods it is not included in the allowed payment methods. Could you maybe push us into the right direction? Thank you so much!

fjbender commented 7 months ago

This is not supported (yet) - we have it on the roadmap, but I don't have an ETA at this time.

simonmaass commented 7 months ago

That is very unfortunate as this was the only reason we bought the POS System from mollie... is there any workaround at this time maybe?

fjbender commented 7 months ago

The team is looking into it, we might have something for you :)

simonmaass commented 7 months ago

@fjbender thank you!

Frank-Magmodules commented 7 months ago

Hello @simonmaass , Apologies for the delayed reply here. Could you clarify the specific scenario that you are trying to achieve? Currently, you can display the POS method via the REST API by using a customer within the designated customer group set up in the POS settings. Does this answer your question? Or are you looking for something else?

simonmaass commented 7 months ago

@Frank-Magmodules thank you for getting back!

We have the following setup: Magento 2.4.6 Instance only used as backend Laravel 10.x application consuming magento rest api to place orders.

The laravel application is a POS software for stationary retail stores that will add products to cart and place the order. After a successful order place the POS software should trigger the mollie POS device the capture the payment.

In the checkout flow of the laravel app we fetch the shipping and payment methods but we are not able to get the payment method mollie_methods_pointofsale from the backend...the payment method is enabled on magento 2 side but is not returned...

You are probably referring to this method: Service\Mollie\PointOfSaleAvailability.php But the laravel POS software will not have an active customer session as the sales staff are using the laravel app

this is the endpoint we currently use to get them: https://xxx/rest/xxx/V1/guest-carts/xxxx/shipping-information

fjbender commented 7 months ago

Hmm, maybe it makes sense to alter the Mollie\Payment\Service\Mollie\PointOfSaleAvailability::isAvailable() portion then. Can we make it configurable (per Sales Channel or something) that POS also works for Guest Checkouts? What do you think @Frank-Magmodules ?

@simonmaass Have you tried (just for the lolz) to override this method to return true in any case?

Frank-Magmodules commented 7 months ago

Goodmorning @simonmaass ,

It looks like you have 2 options here:

  1. Go with the earlier suggestion by using a customer that is in the allowed customer group, or;
  2. Go for the suggestion from @fjbender. In that case, you need to implement your own logic whether to show the method or not by adding a plugin to Mollie\Payment\Service\Mollie\PointOfSaleAvailability::isAvailable(). This can be done by identifying the sales staff by either user-agent, IP address, session, or something else.
simonmaass commented 7 months ago

@Frank-Magmodules @fjbender thank you for your input!

We have created a plugin and successfully overrode the method... we are now able to fetch the payment method...

When creating an order over the REST Api: PUT https://xxx/rest/xxx/V1/guest-carts/xxx/order we now receive the following error: Error executing API call (422: Unprocessable Entity): No terminal ID specified.

Where can we specifiy this over the rest api? Thank you for your help!

Frank-Magmodules commented 7 months ago

Hello @simonmaass,

At this moment, there is no way to retrieve the terminal ID through the API. We have added that to our backlog. To retrieve an ID, you can create an order through the backend, check what the valid values are, and use that as a hard-coded value in the meantime.

To send the selected terminal in the API requests, you can set it as selected_terminal in the additional data like you would with selected_issuer, card_token or applepay_payment_token. An example can be found here: https://github.com/mollie/magento2/blob/master/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html#L487-L489

simonmaass commented 7 months ago

@Frank-Magmodules Thank you!

We were able to hard code the terminal id as described by you and are able to place an order via the rest api with pos as payment method with the plugin that overrides the "isAvailable" method...

Frank-Magmodules commented 4 months ago

Hi There @simonmaass ,

We are happy to announce that in our latest release, we address this too. For more information on how to retrieve the available terminals, you can check these pages:

REST - https://github.com/mollie/magento2/wiki/REST-Integration#payment-method-meta GraphQL - https://github.com/mollie/magento2/wiki/GraphQL-integration#retrieve-the-available-payment-methods

Thanks again for your patience and your contribution here @simonmaass !