9 replies [Last post]
realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
Was this information Helpful?

Is there anyway to print the fields that are being posted to cybersource when I click the 'Process Card' button in the Order section.

I currently receive this error:

Credit card authorization: £1.00
Decision: REJECT
Reason: One or more fields in the request are missing or invalid.
Possible action: Resend the request with the correct information.

This happens when using http and https on test and production environments (although my CyberSource account isn't Live yet, so whether production would work at all I'm not sure).

Thanks in advance,

Paul

realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
Ok, Is my problem above must

Ok,

Is my problem above must be something to do with HOP.php not being populated.

Could you please tell me at what point the data is posted to HOP.php.

Is it when the client completes the checkout process, or when the store admin processes the order and card payment?

Many thanks,

Paul

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Ok, Is my problem above must

I think the HOP is actually working fine, since you're getting a response from CyberSource. (You wouldn't otherwise.) To see what's being sent, insert this code on line 204 of uc_cybersource.module.

<?php
  drupal_set_message
('<pre>'. print_r($data, TRUE) .'</pre>');
?>
realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
My fields

Having used your code snippet these are my results:

billTo_firstName=Harry&billTo_lastName=Hudson&billTo_street1=*****************
&billTo_city=Benfleet&billTo_country=GB&billTo_state=ESX&billTo_postalCod
e=******&billTo_email=webmaster%40realworksmedia.com&card_accountNumber=***************************
&card_cardType=Visa&card_expirationMonth=**&card_expirationYear=
****&card_cvNumber=***&amount=1.00&currency=usd&merchantID=woodudesign&order
Number=46&orderPage_timestamp=1194904610218&orderPage_ignoreAVS=true&orderPa
ge_signaturePublic=ccW8KcopJmNcG9%2FQfTQRo7mMIoE%3D&orderPage_version=4&orde
rPage_serialNumber=****************************&orderPage_transactionType=authoriz
ation

It seems to me that these are correct other than the Currency, it should be GBP.

The guys at CyberSource think that the HOP is NOT being populated as they can't see any record of the transaction and think it is being 'stopped by CyberSources front end'...

Do you have any ideas?

Many thanks

Paul

realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
Ok, I setup a test form with

Ok,

I setup a test form with the values above and submitted the form to: https://orderpage.ic3.com/hop/CheckOrderData.do

The three fields below were highlighted as invalid:

billTo_email INVALID webmaster%40realworksmedia.com
card_cardType INVALID Visa
currency INVALID gbp

I can see that the email address has a '%' instead of a '@'. Any ideas why this is?

As for why 'Visa' and 'gbp' are invalid I have no idea, they seem correct to me.

I would appreciate any help.

Paul

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
It should just be
  1. It should just be converting to %40 for proper encoding... the field is not required, though, so you might just try commenting it out. The encoding issue may be related to curl settings.
  2. Apparently, it should be 001, not Visa. I don't know why I'm using card names. Change lines 122 to 137 to look like:
    <?php
       
    switch (strtolower($order->payment_details['cc_type'])) {
          case
    'amex':
          case
    'american express':
           
    $cc_type = '003';
            break;
          case
    'visa':
           
    $cc_type = '001';
            break;
          case
    'mastercard':
          case
    'master card':
           
    $cc_type = '002';
            break;
          case
    'discover':
           
    $cc_type = '004';
            break;
        }
    ?>
  3. I don't know what to put for currency... I can't find any listing of other valid currency codes in their docs, so you might ask their support to make sure there's not something else that needs to happen. Maybe simply fixing the two issues above will make it work.
realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
'visa' changed to '001' in uc_cybersource.module

Right...

I have hacked us_cybersource.module from line 120.

I was getting invalid fields as CyberSource expects cardType field to be '001' not 'Visa'.

$cc_type = NULL;
if (isset($order->payment_details['cc_type'])) {
switch (strtolower($order->payment_details['cc_type'])) {
case 'amex':
case '003':
$cc_type = 'Amex';
break;
case 'visa':
$cc_type = '001';
break;
case 'mastercard':
case 'master card':
$cc_type = '002';
break;
case 'discover':
$cc_type = '004';
break;
}
}

Also, the email address is being sent as name%domain.com instead of name@domain.com.

None the less transaction are now successful with my hack, but I don't want to leave it messy like this for long and am worried I will run into problems with the email address as it is.

Any thoughts,

Paul

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: 'visa' changed to '001' in uc_cybersource.module

Looks like we posted at the same time. Eye-wink See my above post for more info.

realworksmedia's picture
Offline
Joined: 10/23/2007
Juice: 107
Thanks for the info. With

Thanks for the info.

With regards to the currency, I have not changed anything other than the afore mentioned and it works fine.

It still shows invalid in tests, but the transaction is accepted. This is one of those inexplicable circumstances where I just tell the client 'The flux capacitor needed re-fluxing'. lol.

I will see how I get on with HOP, but would be cool to see what the Simple Order API can do.

Paul

squirrelist's picture
Offline
Joined: 05/26/2011
Juice: 8
Update

I have had some trouble with my credit card processing and wanted to update everyone in case others find this thread in the future. Ryan's code snippet should go on line 360 of the current uc_cybersource.module making it:

<?php
 
if (variable_get('uc_cybersource_server', 'test') == 'test') {
   
$url = 'https://orderpagetest.ic3.com/hop/ProcessOrder.do';
  }
  else {
   
$url = 'https://orderpage.ic3.com/hop/ProcessOrder.do';
  }
drupal_set_message('<pre>'. print_r($data, TRUE) .'</pre>'); // Here is the line to insert
 
$ch = curl_init();
 
curl_setopt($ch, CURLOPT_URL, $url);
 
curl_setopt($ch, CURLOPT_VERBOSE, 0);
 
curl_setopt($ch, CURLOPT_POST, 1);
?>