News:

Looking for documentation? Take a look on our wiki

Main Menu

paymentResponseHtml not set if payment do not use POST

Started by Pisu, December 27, 2011, 17:18:24 PM

Previous topic - Next topic

Pisu

If I have a payment plugin that, in the response redirect, is not using POST (doing a simple redirect with parameters in query string), the HTML response code is not shown.

See this function in file /components/com_virtuemart/views/pluginresponse/view.html.php:

public function display($tpl = null) {
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$document = JFactory::getDocument();
                $paymentResponse = JRequest::getVar('paymentResponse', '');

                  $paymentResponseHtml = JRequest::getVar('paymentResponseHtml','','post','STRING',JREQUEST_ALLOWRAW);
$layoutName = $this->getLayout();

                $this->assignRef('paymentResponse', $paymentResponse);
                $this->assignRef('paymentResponseHtml', $paymentResponseHtml);

parent::display($tpl);
}


The  $paymentResponse variable is correctly set because calling the getVar function without explicit POST method. So I would change this function to:

public function display($tpl = null) {
$mainframe = JFactory::getApplication();
$pathway = $mainframe->getPathway();
$document = JFactory::getDocument();
                $paymentResponse = JRequest::getVar('paymentResponse', '');

                  $paymentResponseHtml = JRequest::getVar('paymentResponseHtml','','default','STRING',JREQUEST_ALLOWRAW);
$layoutName = $this->getLayout();

                $this->assignRef('paymentResponse', $paymentResponse);
                $this->assignRef('paymentResponseHtml', $paymentResponseHtml);

parent::display($tpl);
}


In fact, "default" is the default value for that parameter, not post. So this way $paymentResponse and $paymentResponseHtml are get in the same way.
Pisu - Team VMItalia (Supporto Italiano VirtueMart)
www.stefanobagnatica.it | www.vmitalia.net

alatak


Pisu

I have found another similar code... File /components/com_virtuemart/views/cart/view.html.php:

303  private function lOrderDone() {
304          $html = JRequest::getVar('html', JText::_('COM_VIRTUEMART_ORDER_PROCESSED'), 'post', 'STRING', JREQUEST_ALLOWRAW);
305          $this->assignRef('html', $html);
306 
307          //Show Thank you page or error due payment plugins like paypal express
308      }


As a consequence, the message ""Your order has been processed." is not displayed in the page with the payment form (and automatic redirect for paypal). I supposed it was deliberate, because if the payment fail the order is deleted.
Pisu - Team VMItalia (Supporto Italiano VirtueMart)
www.stefanobagnatica.it | www.vmitalia.net

alatak

Hi,

Yes you are again :) rigth.
That page is not called anymore because instead the cart is displayed for paypal. But ther eis no reason to restrict to the post variables. I have done the change .

Txs.

Pisu

Quote from: alatak on December 28, 2011, 22:28:54 PM
That page is not called anymore because instead the cart is displayed for paypal.
What do you mean? The next 2.0.x release will have a different Paypal behavior?
Pisu - Team VMItalia (Supporto Italiano VirtueMart)
www.stefanobagnatica.it | www.vmitalia.net

alatak

Hi,

No i did not meant that.
The behaviour will not change.