Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Usa Epay Database issues


loveccb

Recommended Posts

So I downloaded the Usa Epay module and everything works great with a few exceptions.

 

When modifying the Payment Module in the Admin for USAePay, no matter what Card Types you selected, the change would never be saved. AFter much noodling around, I think I have a fix. Let me precusor this fix by saying I am a total novice when it comes to PHP and MySQL. I come from the land of vbscript, so please excuse the messy code. Basically the Array of credit cards wasn't being split up before pushed into the database. So I added this block of code around line 43 of modules.php. My added code starts with ***BOB CODE***

 

if (tep_not_null($action)) {
   switch ($action) {
     case 'save':
       while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
             
//****BOB CODE 4/15/04****** For multiple values, break array into comma delimited values for DB
   if (count($value) > 1) {
      $count = count($value); 	 
      for ($i=0; $i<$count-1; $i++) {	
        $finalvalue .= $value[$i] . ',';
     }   	 

//trim off final comma
$finalvalue = substr($finalvalue,0,-1);
  	 
//set database value to be the comma delimited list for storage
$value = $finalvalue;
}
//****BOB CODE******

 

Also I had to make a slight change in general.php on line 787

Used to be this

$key_values = explode( " ,", $key_value);

 

Now is this

$key_values = explode( ",", $key_value);

Just deleted the space before the comma.

 

Hope that helps anyone out there having a similar problem.

Now I just have to figure out why I'm being pushed back to the loggin screen after I complete the transaction and I'll be all set!

 

Cheers.

Link to comment
Share on other sites

As a follow up to my last post, I've found that a Form Post to USA ePay is generating the following return.

 

UMversion=2.8&

UMstatus=Approved

&UMauthCode=00000

&UMrefNum=0

&UMavsResult=Address%3A%20Match%20%26%205%20Digit%20Zip%3A%20Match

&UMavsResultCode=YYY

&UMcvv2Result=No%20CVV2%2FCVC%20data%20available%20for%20transaction.

&UMcvv2ResultCode=

&UMresult=A

&UMerror=

&UMbatch=

&UMfiller=filled

 

Based on the form below.

Example is taken directly from http://www.usaepay.com/topics/api.html#over

(using a different UMkey)

 

<form action="https://www.usaepay.com/gate.php" method="POST">

<input type="hidden" name="UMkey" value="h328dtwj834jhs98d">

<input type="hidden" name="UMredir"

value="http://www.mycompany.com/cgi-bin/myorderform.cgi">

<input type="hidden" name="UMticket" value="101">

<input type="hidden" name="UMamount" value="1.00">

First Name: <input type="text" name="fname"><br>

Last Name: <input type="text" name="lname"><br>

Street: <input type="text" name="UMstreet"><br>

City: <input type="text" name="city"><br>

State: <input type="text" name="state"><br>

Zip: <input type="text" name="UMzip"><br>

<br><br>

Credit Card Info:<br>

Card Type: <select name=cardtype>

<option>Visa

<option>Mastercard

<option>Amex</select><br>

Card Number: <input type=text name=UMcard><br>

Expiration: <input type=text name=UMexpir><br>

Name On Card: <input type=text name=UMname><br>

<br><br>

<input type=submit value="Place Order">

</form>

 

[code]

 

I've tried adding and leaving out different fields but to no avail. I've written USA Epay but haven't heard back yet. Will keep everyone up-to-date as to my findings.

Link to comment
Share on other sites

Ok. I think I figured out why the page was being redirected to the login page after "Confirm order" was hit. When the form is posted to https://www.usaepay.com/gate.php and then comes back to your store, it loses the session ID. Therefore, upon returning to your store after the post, a new session ID is created because it thinks you are a new person coming to the store. A simple fix(but probably not a very secure one) is to attach the session ID onto the url going to usaepay.com. The following code is added to usaepay.php starting on line 16.

 

  class usaepay {
//***BOB CODE Added 4/24/04.  Added $formurl variable*******
   var $code, $title, $description, $enabled, $formurl;

// class constructor
   function usaepay() {
   
//**Added $SID variable to pull global session ID
     global $order, $SID;
     
     $this->code = 'usaepay';
     $this->title = MODULE_PAYMENT_USAEPAY_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_USAEPAY_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_USAEPAY_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_USAEPAY_STATUS == 'True') ? true : false);

     if ((int)MODULE_PAYMENT_USAEPAY_ORDER_STATUS_ID > 0) {
       $this->order_status = MODULE_PAYMENT_USAEPAY_ORDER_STATUS_ID;
     }

     if (is_object($order)) $this->update_status();

//Added $SID to URL to retain Session ID when navigating away from store
$formurl = "https://www.usaepay.com/gate.php?$SID";


     $this->form_action_url = $formurl;
    }
//****End BOB Code*****

 

Hope that helps you out there. Specifically for Wayne who sent me an email a few weeks back. Cheers.

Link to comment
Share on other sites

  • 2 weeks later...

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...