Need some help with a payment plugin.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #66381

Ok, slowly making progress one ant step at the time.

I now get the following return_url (notify_url)

http://meradog.colorconsult.se/index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=auriga&tmpl=component&lang=sv&Itemid=161&
Merchant_id=_HIDDEN_&
Version=3&
Customer_refno=B5B6M3&
Status=E&
Status_code=3&
Payment_method=KORTINSE&
Currency=SEK&
MAC=_HIDDEN_

But it now makes two orders, first one with all the data and status Created.
And secondly it makes a totally blank order with Status Cancelled.

I would expect it to make a Cancelled order since the gateway refuse my order at the moment. An issue I haven't got solved with the provider yet (status=E).

It looks like it runs through the first part of the notification function and creates an order (As if Status=A) and then continue to the other part (the one I added if Status is not A)

And the resulting page is a totally blank page.


Jan

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #66414

I have finally got an answer on why I get error from the provider, they need the Response_URL to be HTTPS.

That means that I have to set up my server and host configured to work with that.

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #66531

For the fact that you have two orders, it's probably because the order_id is not specified in the order when you save it in the notification.
Thus, the system creates a new one instead of updating the existing one.

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #66677

I had a setting parameter for "Allow payment notifications from Nets ePayment" when I turned it off it only creates one order.
But this only has the status "Created" not "Cancelled" as I want. (Since the payment is rejected)


Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #66886

When you turn that option off, it doesn't process any payment notification. So it's normal that it only creates one order and that is keeps the status created since basically the plugin doesn't do anything

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #66888

Ok so that setting should be permantently ON?

BTW, did you see my PM?

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #67042

Yes, it should be on.

I just saw it and answered you.

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #67110

Hi,

I've sent you an email.

I found another problem with the outgoing call to the payment gateway.

The notify_url is used as response_url but it acts a little strange.

This is used, I have to urlencode the ampersands.

$return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop%26ctrl=checkout%26task=notify%26notif_payment=auriga%26tmpl=component%26lang='.$locale.$url_itemid;

The part "notify%26notif_payment" is somehow changed so in the MD5 hash it has become "notify¬if_payment" this results in that the call is rejected.

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #68358

It seems that the URL I send that includes "notify%26notif_payment" is somehow interpreted at the gateway as "notify¬if_payment" and that makes the MD5 hash not approved.

If I send notify¬if_payment it will break the URL in to parameters and the URL gets broken.

Is there any solution to this?

Thanks

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #68555

Isn't the problem that you're passing the URL with %26 to the gateway but that you're doing the md5 with = ?
Or maybe that would be the solution ?

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #68595

Well, I have tried both ways.

The gateway uses & as a separator for the fields in the URL so if I send the request with plain ampersands the gateway breaks up the return and cancel URL's after the first ampersand. That is the reason for URLencode the ampersand to %26.

Apparently the gateway reads the %26not as this character: ¬

I will test with a SEF-url and see how that works.

Thanks

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #68601

Thanks Nicolas,

I needed to URL encode the other characters like the ? you did point out :blush: :blush:

When doing that for the = ? and & I got through to the gateway. Yipee :woohoo: :woohoo:

The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #69157

I have finally got everything working, sort of...

After the payment gateway returns to Hikashop I get redirected to after_end.php.

$app->redirect(HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$order->order_id.$url_itemid);

I have modified after_end.php so that it shows different messages depending on payment success or not.

BUT I would like to end up on my plugins _end.php page. The after_end.php might be needed of other things and it is nicer to have everything in one package for others who might want to use this plugin.

I tried to change the redirect_url to point to my plugin instead but that doesn't work properly.

What is needed to redirect it correctly?


Thanks

Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #69165

You would have to redirect to the notify URL of your payment plugin and add a special parameter that you would check at the beginning of the onPaymentNotification function to either do the normal processing of the payment notification when the parameter is missing, or display the end page of your plugin

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #69169

Hi,

The line of code I submitted in my last post is in the onPaymentNotification function where I check if the payment is OK at the gateway or not depending on the return_url I get from them.

So depending on the outcome of the payment I want to end up at the plugins after page with a message telling the customer that the payment succeded or not.

Are you saying the the processing here is meant to end up on different pages? Like if it is not a good payment I should end up on the plugins after page and if it is OK I would end up on the normal after_end.php

As I have set it up of the payment is OK the order is saved with a status of Confirmed. If the payment don't get thru the order is saved but with status Created, and then the customer will get a message to contact the store for instructions on how to pay.

Thanks


Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #69171

Well, you do like you want in the onPaymentNotification function. If you want to redirect your users to the default thank you page of HikaShop, you can do as I explained with the after_end URL. But if you want to display stuff on the page or redirect them somewhere else, then you can do it too. It's up to you based on what options you want to give to your users and how you want to handle the thank you page.

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #69372

I have a strange problem now.

The payment plugin works in Firefox on my Mac but when using Safari or Chrome I get the following error when trying to go to the payment gateway.

Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/controllers/checkout.php on line 1284

Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/views/checkout/view.html.php on line 439

Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/views/checkout/view.html.php on line 439

Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/views/checkout/tmpl/payment.php on line 12

Notice: Trying to get property of non-object in /mydomain/components/com_hikashop/views/checkout/tmpl/payment.php on line 12


The order is created.

Jan


Edit this problem also happens in Firefox.

Last edit: 12 years 1 month ago by jansuhr.

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #69392

I have a problem on the configuration page that might be related to the error page I described in previous post.

If I have this code in the _configuration.php

<tr>
	<td class="key">
		<label for="data[payment][payment_params][order_status]">
			<?php echo JText::_( 'ORDER_STATUS' ); ?>
		</label>
	</td>
	<td>
		<?php echo $this->data['category']->display("data[payment][payment_params][order_status]",@$this->element->payment_params->order_status); ?>
	</td>
</tr>

I get this error when trying to go in to the settings of the payment plugin:

Order status
Notice: Undefined index: category in /mydomain/plugins/hikashoppayment/auriga/auriga_configuration.php on line 96

Fatal error: Call to a member function display() on a non-object in /mydomain/plugins/hikashoppayment/auriga/auriga_configuration.php on line 96

Line 96 being this code from above:
<?php echo $this->data->display("data[payment][payment_params][order_status]",@$this->element->payment_params->order_status); ?>

In the pluginfile I have this in the onPaymentConfiguration function:
		function onPaymentConfiguration(&$element){
			$this->auriga = JRequest::getCmd('name','auriga');
			if(empty($element)){
				$element = null;
				$element->payment_name='Auriga';
				$element->payment_description='Du kan betala med kort eller genom direktbetalning i din bank.';
				$element->payment_images='MasterCard,VISA';
				$element->payment_type=$this->auriga;
				$element->payment_params=null;
				$element->payment_params->notification=1;
				$element->payment_params->order_status='confirmed';
				$element = array($element);
			}
			$bar = & JToolBar::getInstance('toolbar');
			
			JToolBarHelper::save();
			JToolBarHelper::apply();
			JToolBarHelper::cancel();
			JToolBarHelper::divider();
			$bar->appendButton( 'Pophelp','payment-auriga-form');
			hikashop::setTitle('AURIGA','plugin','plugins&plugin_type=payment&task=edit&name='.$this->auriga);
			$app =& JFactory::getApplication();
			$app->setUserState( HIKASHOP_COMPONENT.'.payment_plugin_type', $this->auriga);
			$this->address = hikashop::get('type.address');
			$this->category = hikashop::get('type.categorysub');
			$this->category->type = 'status';
			}

Apparently I have missed something, but what? The order_status setting code is copied from the banktransfer plugin.


Jan

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 1 month ago #69552

That error means that the $this->category is missing but in the onPaymentConfiguration function I can see that you're adding it, so I don't understand why it wouldn't find it.

In any case, you can directly initialize it in the _configuration.php file like below before using the display function :
$this->data = hikashop::get('type.categorysub');
$this->data->type = 'status';

The following user(s) said Thank You: jansuhr

Please Log in or Create an account to join the conversation.

  • Posts: 182
  • Thank you received: 15
12 years 1 month ago #69601

Thanks

That solved the problem on the _configuration page.

Still there is the problem in the checkout that ends up with errors before going to the gateway.

Any clues??

BTW Nicolas did you get my email?


Jan

Please Log in or Create an account to join the conversation.

Time to create page: 0.090 seconds
Powered by Kunena Forum