Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HELP NEEDED...im stuck


Snowman

Recommended Posts

I have a payment module im working on which uses a setup similar to Paypal. I have based the module around the Paypal default module (NOT IPN) however im having trouble with getting the vaules to passthru to the payment site correctly, and as such i get a timeout error.

 

The merchant has told me that my form is trying to process a form to the link rather than just posting the vaule thru as a URL.

 

The support staff came back with the following informtaion, based on the code posted below:

 

Hi,

you are submitting a form:

-------------------------------------------

<form name="checkout_confirmation" action="https://www.paymate.com.au/PayMate/ExpressPayment?mid=snowtech" method="post">

<input type="image" src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Confirm Order" title=" Confirm Order ">

</form>

------------------------------------------

 

This is causing our system to attempt to execute code, which fails. you need to call a URL with prepopulation data. You will still be calling code, but the call method needs to look like you are calling a URL.

 

Replace the string with:

 

<a href="https://www.paymate.com.au/PayMate/ExpressPayment?mid=snowtech">

<img src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Confirm Order">

</a>

 

and it will work.

 

If you want to add additional data to the end of the string, you will need to construct a javascript string, replacing the href="xxx...xx" with href="java script:......" etc.

 

Ive stuffed around with this for ages and for the life of me i cant seem to get it to work.

 

Anyone have any ideas, im sure its simple, and as usual the simple things always confuse me.

 

Here is the code:

 

<?php

/*

 $Id: paymate.php,v 1.0 2002/12/20



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



 class paymate {

   var $code, $title, $description, $enabled;



// class constructor

   function paymate() {

     $this->code = 'paymate';

     $this->title = MODULE_PAYMENT_PAYMATE_TEXT_TITLE;

     $this->description = MODULE_PAYMENT_PAYMATE_TEXT_DESCRIPTION;

     $this->enabled = ((MODULE_PAYMENT_PAYMATE_STATUS == 'True') ? true : false);



     $this->form_action_url = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid='. MODULE_PAYMENT_PAYMATE_MID;

   }



// class methods

   function javascript_validation() {

     return false;

   }



   function selection() {

     return array('id' => $this->code,

                  'module' => $this->title);

   }



   function pre_confirmation_check() {

     return false;

   }



   function confirmation() {

     return false;

   }



   function process_button() {

     global $order, $currencies;



     $process_button_string = tep_draw_hidden_field('PMT_RECIPIENT_EMAIL', MODULE_PAYMENT_PAYMATE_ID) .

                              tep_draw_hidden_field('PMT_TRANSACTION_SELLERAMOUNT', number_format(($order->info['total']) * $currencies->currencies['AUD']['value'], $currencies->currencies['AUD']['decimal_points'])) .

                              tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .

                              tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));



     return $process_button_string;

   }



   function before_process() {

     return false;

   }



   function after_process() {

     return false;

   }



   function output_error() {

     return false;

   }



   function check() {

     if (!isset($this->_check)) {

       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_PAYMATE_STATUS'");

       $this->_check = tep_db_num_rows($check_query);

     }

     return $this->_check;

   }



   function install() {

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable PAYMATE Module', 'MODULE_PAYMENT_PAYMATE_STATUS', 'True', 'Do you want to accept PAYMATE payments?', '6', '3', 'tep_cfg_select_option(array('True', 'False'), ', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Paymate ID', 'MODULE_PAYMENT_PAYMATE_MID', 'your Paymate ID', 'The merchant ID paymate assigned to you for the PAYMATE service', '6', '4', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_PAYMATE_ID', '[email protected]', 'The e-mail address registered for the Paymate service', '6', '5', now())");

   }



   function remove() {

     $keys = '';

     $keys_array = $this->keys();

     for ($i=0; $i<sizeof($keys_array); $i++) {

       $keys .= "'" . $keys_array[$i] . "',";

     }

     $keys = substr($keys, 0, -1);



     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");

   }



   function keys() {

     return array('MODULE_PAYMENT_PAYMATE_STATUS', 'MODULE_PAYMENT_PAYMATE_MID', 'MODULE_PAYMENT_PAYMATE_ID');

   }

 }

?>

Link to comment
Share on other sites

I think you are still building a form.

They say you need to pass it on the url.

So all the references to tep_draw_hidden_field etc should be replaced with '?key=value' so that can build the uri.

The return $process_button_string should basically be what they e-mailed you, not a form which it is now.

 

HTH

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Ok i have the string now set to:

 

      $process_button_string = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid='. MODULE_PAYMENT_PAYMATE_MID .

                              '&PMT_RECIPIENT_EMAIL='. MODULE_PAYMENT_PAYMATE_ID .

                              '&PMT_TRANSACTION_SELLERAMOUNT='. number_format(($order->info['total'] * $currencies->currencies['AUD']['value']), 2);

 

i now know i have the string right but how to i make it as an action to open in a new browser???

 

in the old code is used to be $checkout_action or something but what would it be in the new code???

 

this one has me stumped?

Link to comment
Share on other sites

Haven't looked at the code so don't hold it against me but isn't this supposed to spit out a button your client needs to push? That button is basically:

 

<a href="my_self_made_url"><img src="my_groovy_button.jpg"></a>

 

:?:

 

Regards,

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Correction (getting late)

 

it sets a trigger for the CONTINUE button if I am not mistaken...

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

I want it to automatically open a new window when you push the confirm button on checkout_confirmation rather than adding an image for them to click.

 

$this->action_url = 'https://www.paymate.com.au/PayMate/ExpressPayment':

 

doesnt work either as that would be used if it was a form.

Link to comment
Share on other sites

In that case couldn't you just add target="_new" to the url?

 

I'm not sure if that new window is a good thing as you might want to get some data back from the processor site?

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

when you push the confirm button on checkout_confirmation

 

That is exactly what $process_button_string is for.

To set the action on the confirm button...

Or does it spit out a form by default?

 

Mattice

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Link to comment
Share on other sites

Not sure if this helps, but looking at your code, it looks very much like the danish problem we have with our local "dankort".

 

Theres a brilliant guy, who's made a module for this, for the new checkout.

 

You could download it from the danish osc-forum, and compare it to yours right here (download-link):

http://www.neleven.dk/bb/download.php?id=5

 

HTH

Best Regards

olby

Link to comment
Share on other sites

ok well i currently have:

 

    function process_button() {

     global $order, $currencies;



     $process_button_string = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid='. MODULE_PAYMENT_PAYMATE_MID .

                              '&PMT_RECIPIENT_EMAIL='. MODULE_PAYMENT_PAYMATE_ID .

                              '&PMT_TRANSACTION_SELLERAMOUNT='. number_format(($order->info['total'] * $currencies->currencies['AUD']['value']), 2);

                       

     return $process_button_string;

   }

 

and when running thru the checkout once you get to checkout_confirmation it returns the string as a text string on the bottom of the page. example:

 

https://www.paymate.com.au/PayMate/ExpressP...UNT=21.00target

 

Now its just displaying as text.

 

What i need ot to do is to remain hidden and when you click on the confirm order button it opens up the url in a new window. Or alternatively displays as you suggest a button that allows you to click on it to be sent to the url that is returned.

 

I just cant figure this bit out.

Link to comment
Share on other sites

Not sure if this helps, but looking at your code, it looks very much like the danish problem we have with our local "dankort".

 

Theres a brilliant guy, who's made a module for this, for the new checkout.

 

You could download it from the danish osc-forum, and compare it to yours right here (download-link):

http://www.neleven.dk/bb/download.php?id=5

 

HTH

 

Olby this mod uses its own checkout pages to work, wheras i just want a page to pop open just like the paypal mod does, however without the form process function being used/

Link to comment
Share on other sites

True ...

 

but he dosn't use the form_action_url, instead he has made a new one; checkout_pbscc.php, where he builds the form and sends the hidden fields from proccess_button_string.

 

HTH

Best Regards

olby

Link to comment
Share on other sites

Steve,

 

Do you have any developer docs for this.

 

I'm a liitle confused by their reply to you.

 

First point, the way checkout confirmation is built at the moment it is not possible to do what you want.

 

confirmation automatically builds a form. The action of the form is defined by $form_action_url

 

the submit button is fixed and not dynamic.

 

Given that, I can't see why building your url into $form_action_url would not work. Even though it's a form action the url that is presented to paymate is just that, a url with parameters.

Trust me, I'm an Accountant.

Link to comment
Share on other sites

Ian

 

They dont have any documentation as they are a bit unorganised it would seem.

 

I had the module originally based on the paypal module and i sssumed it would work that way but i got timeouts which redirected me to an error page.

 

I spoke to them and thats when they commented on the fact that the checkout was trying to post a form to their url, which doesnt work.

 

The best i can do for now i guess is just to create a "Click Here" to pay by paypal button that appears after the string has been returned.

 

This works, its just not real good as the customer must come back and click continue to ensure the order is posted.

 

This is what used to be the problem with PayPal ages ago wasnt it?

 

anyway i think i have a temporary solution sorted.

 

I hope :?

Link to comment
Share on other sites

Ive just changed the string and return to

 

      $process_button_string = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid='. MODULE_PAYMENT_PAYMATE_MID .

                              '&PMT_RECIPIENT_EMAIL='. MODULE_PAYMENT_PAYMATE_ID .

                              '&PMT_TRANSACTION_SELLERAMOUNT='. number_format(($order->info['total'] * $currencies->currencies['AUD']['value']), 2);

                       

     return '<a href="'.$process_button_string.'target="_blank""><img src="includes/languages/english/images/buttons/button_continue.gif"></a>';

 

now all i need to do is modify it a bit more so that a popup image is created with that link in it ans some instructions....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...