Raiffeisen bank payment gateway for Phoca cart

Phoca Cart - complex e-commerce extension
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

I am adapting the Raiffeisen bank payment gateway for Phoca cart.

I have already made it possible to make a payment as well as a refund from the bank application, but I want to go one step further and enable a refund from the Phoca cart admin part.

Is it possible to make an AJAX call from a custom button inside the admin order edit view (com_phocacart, view=phocacartorder, layout=edit) without triggering the Joomla form submit?

What is the recommended way to add custom functionality (like a payment refund button) to the order edit page in admin?


Image
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49365
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Jan »

Hi, you can use standard joomla com_ajax feature to run your own script per AJAX (of course security testing needs to be done there), The button needs to be then displayed per some Phoca Cart event in the order view.

So the way is to add this button per event and trigger com_ajax and run the plugin code per ajax (unfortunately no more clue advice from me as I don't know how your plugin works)

We have one event: GetPaymentBranchInfoAdminList in orders list, unfortunately no such in edit of the order, isn't it possible to have such button directly in orders list for each order?

Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

We have one event: GetPaymentBranchInfoAdminList in orders list, unfortunately no such in edit of the order, isn't it possible to have such button directly in orders list for each order?
That is the solution that I am focused now.

Do you have any suggestions because I'm currently unable to display anything in orders list?

Also I want to share this project for free. It is functional now for payments, Phoca Cart status changes, Refunds from bank control panel.

It will be available on GitHub soon.
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

How does a pcp plugin register a listener for GetPaymentBranchInfoAdminList? I implemented onPCPgetPaymentBranchInfoAdminList method but it's never called. What should I use?

GitHub
https://github.com/nidzo80/Raiffeisen-P ... Phoca-Cart
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49365
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Jan »

Hi, the event should be displayed when you select some payment method, then the orders get information about the additional payment. The question is, what exactly do you need? If only to display some part of html/js, maybe we can add some event to display specific html/js plugin code in edit view :idea:

Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

Thank you Jan! Two questions:

Regarding GetPaymentBranchInfoAdminList — orders do have payment_id set and params_payment contains {"method":"raiaccept",...}. The event fires (I can see it in the template code) but plugin method onPCPgetPaymentBranchInfoAdminList is never called. Could you share a minimal example of how a pcp plugin should implement this method in Joomla 6? I suspect the issue is in the PSR-14 event listener is registered.

Yes, a new event for the edit view would be very helpful! I need to display a small HTML form (amount input + button) that triggers a refund via com_ajax. Something like onPCPgetPaymentBranchInfoAdminEdit would be perfect.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49365
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Jan »

I don't know if some payment method uses it but it is similar to shipping method:

GetShippingBranchInfoAdminList (onPCSgetShippingBranchInfoAdminList) bot triggered in
administrator/components/com_phocacart/views/phocacartorders/tmpl/default.php

You can see example in Zasikovna plugin:
plugins/pcs/shipping_zasilkovna/shipping_zasilkovna.php


function onPCSgetShippingBranchInfoAdminList($pid, $item, $shippingInfo, $eventData) {

so for payment it will be:

function onPCPgetPaymentBranchInfoAdminList($pid, $item, $paymentInfo, $eventData) {


Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

Thanks Jan. I made progress. Refund now works from Phoca cart order list. Button is visible by selecting payment method from filter.
Now i have another problem.
After payment is confirmed and order status is changed to Confirmed by payment plugin, customer receives two identical emails. In the log I can see only one Payment - RaiAccept - SUCCESS entry and one status change.

Is there any other place in Phoca Cart where email is sent on order status change that I might be missing? :idea:
Could it be related to changeStatus + setHistory both triggering email?

Default status is Pending with option not to send email.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49365
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Jan »

Hi, usually, the email is sent by status change, then it comes to saving info into history table (without sending again). The question is if the emails are send twice from Phoca Cart or not e.g. from the email service provider. For this a debug must be done, e.g. some log added when email is sent. I am testing different status changes and still only one email sent. So the question is if e.g. some method is not called twice (some method which ten ask to send the email) :idea:

Jan
If you find Phoca extensions useful, please support the project
User avatar
Nidzo
Phoca Expert
Phoca Expert
Posts: 501
Joined: 07 Nov 2018, 14:55

Re: Raiffeisen bank payment gateway for Phoca cart

Post by Nidzo »

Thanks Jan. I found and solved the problem.
I am starting extensive testing, after which a stable version of the plugin will be available.
Post Reply