VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Payment Modules => Topic started by: saint65 on November 08, 2006, 00:57:17 AM

Title: Paymate gateway script
Post by: saint65 on November 08, 2006, 00:57:17 AM
I have played a bit with the PAYMATE - Australian Payment Gateway, and the configuration script that installs with Virtuemart may hang if your client has ' (apostrophes) included in name or address- example: O'Neil or O'Brien, O'Reilly.
The boxed script is
<script type="text/javascript" language="javascript">
  function openExpress(){
var url = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid=<?php echo PAYMATE_USERNAME.
  "&amt=".$db->f("order_total").
  "&currency=".$_SESSION['vendor_currency'].
  "&ref=".$db->f("order_id").
  "&pmt_sender_email=".$user->email.
  "&pmt_contact_firstname="$user->first_name.
  "&pmt_contact_surname="$user->last_name.
  "&regindi_address1="$user->address_1.
  "&regindi_address2="$user->address_2.
  "&regindi_sub="$user->city.
                  
"&regindi_state=".$user->state.
                  
"&regindi_phone=".$user->phone.
  "&regindi_pcode=".$user->zip.
                  
"&regindi_country=".$user->country;?>
'
var newWin = window.open(url,'wizard','height=640,width=500,scrollbars=0,toolbar=no,status=1,location=yes');
self.name = 'parent';
newWin.focus();
  }
  </script>
  <div align="left">
  <p>
To complete your order, please click ONCE on the PAYMATE logo below. This will bring up a secure PAYMATE window, where you will pay with confidence.
In the meantime your order has been placed, and it will be processed as soon as payment is made.
Once you have completed the transaction you may close the PAYMATE window and return to your surfing pleasure,
<br />
Thank You<br />
From Vivienne Lee. <br /><br /></div><div align="center">
  <a href="javascript:openExpress();">
  <img src="https://www.paymate.com.au/homepage/images/butt_PayNow.gif" border="0" alt="Pay with Paymate Express">
  <br />click here to pay your account</a>
  </p>
  </div>


You will need to replace the above script which adds addslashes to the fields that will be passed onto Paymate. Paymate gateway strips the slashes so you don't have to worry about that.

<script type="text/javascript" language="javascript">
  function openExpress(){
var url = 'https://www.paymate.com.au/PayMate/ExpressPayment?mid=<?php echo PAYMATE_USERNAME.
  "&amt=".$db->f("order_total").
  "&currency=".$_SESSION['vendor_currency'].
  "&ref=".$db->f("order_id").
  "&pmt_sender_email=".$user->email.
  "&pmt_contact_firstname=".addslashes($user->first_name).
  "&pmt_contact_surname=".addslashes($user->last_name).
  "&regindi_address1=".addslashes($user->address_1).
  "&regindi_address2=".addslashes($user->address_2).
  "&regindi_sub=".addslashes($user->city).
                  
"&regindi_state=".$user->state.
                  
"&regindi_phone=".$user->phone.
  "&regindi_pcode=".$user->zip.
                  
"&regindi_country=".$user->country;?>
'
var newWin = window.open(url,'wizard','height=640,width=500,scrollbars=0,toolbar=no,status=1,location=yes');
self.name = 'parent';
newWin.focus();
  }
  </script>
  <div align="left">
  <p>
To complete your order, please click ONCE on the PAYMATE logo below. This will bring up a secure PAYMATE window, where you will pay with confidence.
In the meantime your order has been placed, and it will be processed as soon as payment is made.
Once you have completed the transaction you may close the PAYMATE window and return to your surfing pleasure,
<br />
Thank You<br />
From Vivienne Lee. <br /><br /></div><div align="center">
  <a href="javascript:openExpress();">
  <img src="https://www.paymate.com.au/homepage/images/butt_PayNow.gif" border="0" alt="Pay with Paymate Express">
  <br />click here to pay your account</a>
  </p>
  </div>
Title: Re: Paymate gateway script
Post by: John Savs on November 28, 2006, 01:50:54 AM
Hi, I'm new to the whole paymate and vituremart thing, and I was wondering if this script can be applied to the new zealand version of paymate....
Any help would be great!
Title: Re: Paymate gateway script
Post by: Aushops on January 28, 2008, 11:44:29 AM
Hi,
I have tried the above code
I have been testing and it won't carry over the phone number, country, or state
Also I'm looking to have the amount locked

Anyone have any clues
Cheers
Title: Re: Paymate gateway script
Post by: Kyliefun on June 01, 2008, 03:44:38 AM
Hi Aushops

I too have had problems with PayMate links not appearing and data carrying over correctly.  Here is the code I have, which seems very close to right except that I don't know how to identify the table and field name to carry across.

<script type="text/javascript" language="javascript">
   function openExpress(){
      var url = ''https://www.paymate.com.au/PayMate/ExpressPayment?mid=<?php echo PAYMATE_USERNAME.
 "&amt=".$db->f("order_total").
 "&currency=".$_SESSION['vendor_currency'].
 "&ref=".$db->f("order_id").
 "&pmt_sender_email=".$user->email.
 "&pmt_contact_firstname=".addslashes($user->first_name).
 "&pmt_contact_surname=".addslashes($user->last_name).
 "&regindi_address1=".addslashes($user->address_1).
 "&regindi_address2=".addslashes($user->address_2).
 "&regindi_sub=".addslashes($user->city).
         
"&regindi_state=".$user->state.
         
"&regindi_phone=".$user->phone.
         
"&regindi_pcode=".$user->zip.
         
"&regindi_country=".$user->country;?>
'
      var newWin = window.open(url,'wizard','height=640,width=500,scrollbars=0,toolbar=no,status=1,location=yes');
    self.name = 'parent';
newWin.focus();
}
</script>
      <div align="left">
  <p>
To complete your order and pay by credit card, please click ONCE on the <br>
PAYMATE logo below.  This will bring up a secure PAYMATE window, where <br>
you will pay with confidence. <br><br>
In the meantime your order has been placed, and it will be processed as <br>
soon as payment acknowledgement has been received. <br><br>
Once you have completed the transaction you may close the PAYMATE window. <br>
<br />
Thank You<br />
From The Team at Ecobub Nappies. <br /></div><div align="center">
  <a onclick="self.name = 'parent';" target="_blank" href="https://www.paymate.com/PayMate/ExpressPayment?mid=ebbus&pmt_sender_email=.$user.email.&ref=.$db.f("order_id").
&email_address=info@ecobubnappies.com.au&pmt_contact_firstname=.$user.first_name.&pmt_contact_surname=.$user.last_name.
&pmt_contact_phone=.$user.phone_1.&regindi_address1=.$user.address_1.&regindi_address2=.$user.address_2.
&regindi_sub=.$user.city.&regindi_state=.$user.state.&regindi_pcode=.$user.zip.&pmt_country=.$user.country.
&pmt_country=.$user.country.&amt=.$db.f("order_total").">
  <img src="https://www.paymate.com.au/homepage/images/Paymate-Express-Banner-190x60.gif" border="0" alt="Pay with Credit Card via Paymate"></a>
</p>
  </div>


Cheers
Kyliefun