VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Payment Modules => Topic started by: Shelly Haffly on September 09, 2005, 20:53:57 PM

Title: Changing Auth.net to work for Cybersource
Post by: Shelly Haffly on September 09, 2005, 20:53:57 PM
The systems work virtually the same, but how/where do you begin to start changing the files to work? Cybersource has several options available to work. Some send the user to their system, one permits you to do it all on your site.

Which is easiest and what built in module to you modify to make it work?

I'm sorry, I know these are very broad questions, but I just don't understand the documentation provided by Cybersource.

My customer is willing to use 2checkout, however I would like to test that system first before I commit and I don't see a way to do that without putting down the $49 set up fee.
Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 25, 2006, 23:50:18 PM
For anyone who has read my post back in August of 2006, sorry its taken me this long to get this done, but I've finally completed a CyberSource Payment module for VirtueMart!

I've attached a zip file containing the module and a README.txt file with installation instructions.  I hope there are still people out there that can use it!

If anyone has any problems using this module, I will do my best to fix any bugs and improve on the existing module, but please understand that I'm only working on this project in my spare time, so please have patience.

[attachment cleanup by admin]
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 06:59:41 AM
Hi,

This is exactly what I need.  It's amazing that I looked at this post today and you finished the module yesterday.  Cool!

However, I'm having problems with it.

When I try to add the payment method to the VM, I get "CyberSource config file does not exist! Your configuration was not saved."

I installed the library and configured the ini file.
I installed the 2 gateway files in the right place in the administration directory

Here is the contents of my ps_cybersource.cfg.php file:

<?php
defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');

define ('CS_MERCHANT_ID', 'my-merchant-id');
define ('CS_CONFIG_FILE', '/var/www/vhosts/mydomain.com/httpdocs/cybersource/simapi-php-5.0.1/samples/cybs.ini');
define ('CS_CHECK_CARD_CODE', 'YES');
define ('CS_VERIFIED_STATUS', 'P');
define ('CS_INVALID_STATUS', 'P');
?>

Here is the contents of cybs.ini file:

merchantID=[my.merchant.id]
keysDirectory=/var/www/vhosts/mydomain.com/httpdocs/cybersource/simapi-php-5.0.1/keys
targetAPIVersion=1.21
sendToProduction=false

# logging should normally be disabled in production as it would slow down the
# processing.  Enable it only when troubleshooting an issue.
enableLog=false
logDirectory=/var/www/vhosts/mydomain.com/httpdocs/cybersource/simapi-php-5.0.1/logs

I'm glad to see that the samples included in the SDK are working.  So I guess I installed the library properly.  :)

What am I missing?

- rg
Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 27, 2006, 15:46:49 PM
digical,
     Let me make sure that I understand you're problem correctly.  You get an error message when creating a new payment module and specifing 'ps_cybersource' as the module.  Does 'ps_cybersource' even show up in the list of payment modules?  You should only see the error "CyberSource config file does not exist! Your configuration was not saved." when saving the ps_cybersource config AFTER the module was added to VirtueMart.
     It could be a permissions issue?  The cybs.ini file (and the path leading up to it) should be readable by the same user that is running your webserver.  In most cases, when using the Apache web server, this user is either 'apache' or 'nobody' or something similar.  Perhaps when you ran the samples from the CyberSource SDK you were running them as a 'root' user?
     Let me know what you find out!  I really want to make this payment module a big success, and thanks for downloading it!  :-D
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 16:26:46 PM
Yes, when I install the payment module the first time, I get this message.  However, it still saves but when I run a test order, it still says that config file can't be found.  Anyway, I had some techs work on it all night and they seem to get past this error.  I will ask them what they did to fix it.

Now I have a new error -> Error: The request is missing one or more required fields.

I can't find any log files to determine which fields are missing.

Do you have any ideas on how to troubleshoot this?

- rg


Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 27, 2006, 16:30:36 PM
Rg,
     Best thing to do to troubleshoot this problem is change the value in cybs.ini that says "enableLog=false" to "enableLog=true".   Also change logDirectory if you want the log to be saved someplace else.

- Mike
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 16:40:32 PM
OH - GREAT!  It's now logging.  THANKS!

Here is the tail of the log:

missingField_=bixxxxxxxxte
decision=REJECT
missingField_0=billTo_state
requestID=1619594470680169609486
2006-10-27 09:30:48 3086280384 TRANSTATUS > CYBS_S_OK

Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 16:59:22 PM
OK - I got it working!   I turned on "Customers can select a state/region?" and it's now working! 

There were 3 other hacks that you say are required.  I only added the "english.php" hack.  I got it working without adding the other 2.  I will add them anyway per your recommendations.

- rg

Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 27, 2006, 17:07:41 PM
rg,
     One of the other hacks was to facilitate the processing of a VISA test account number, which really isn't necessary if you're gone live with CyberSource.

     The other hack is partially implemented.  All transactions done with this CyberSource module will ONLY be authorized and not captured.  The second hack is recommended so that when you change your order status from "Pending" to "Confirmed", the funds will then be captured.  I have yet to make this feature a 'choice' for the store admin as to capture the payment at the same time as the authorization or to capture the funds later.  Capturing the funds later is the recommend solution for products that are being shipped.

     Thanks for taking the time to test the module as well as providing feedback!  I will be sure to include your findings in my next revision and README file.

- Mike
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 19:04:26 PM
I will definitely add the "pending/confirm" hack.  My client is providing a service and therefore we want "confirmed".  We are not shipping anything. 

On the readme, I recommend removing the line numbers.  On your readme, I can't just merely copy/paste the hack.  I have to remove the line numbers.  If you didn't have the line numbers there, I could just copy & paste at the line number you suggest within the php file. 

- rg



Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 19:07:07 PM
I also recommend mentioning something about "Customers can select a state/region?".  On my installation, it was required for the orders to go through.
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 19:45:05 PM
Two more things:

THANK YOU - THANK YOU for the module!  KUDOS TO YOU!

second, on one of your hacks, you mention "(usually starts with a v)".  my merchant account starts with a "c".

- rg

Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 27, 2006, 19:52:23 PM
rg,
     Yeah I kinda realized the thing about the line numbers... they also may not be entirely accurate depending on any other hacks or modifications that somebody else could have added to their VirtueMart.
     I will definitely mention that the "state/region" option needs to be enabled in my next revision, which should be out sometime soon.
     I currently am working with two seperate CyberSource accounts and both of my account numbers started with a 'v', so I just assumed most of them did.  I'm glad you pointed out that your merchant number starts with a 'c'!

And THANK YOU for providing so much excellant feedback!

- Mike
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 20:05:28 PM
you are welcome.  I'm looking forward to your next version.

you mention in your readme (Best to be absolute and outside of your document root).  I suggest:

(IMPORTANT: MAKE SURE YOUR PATH IS OUTSIDE YOUR WEB DOCUMENT ROOT).
Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on October 27, 2006, 20:06:41 PM
:-)  Will do!
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on October 27, 2006, 20:29:01 PM
On the two pull-down menus where I select "Pending", "Confirmed", there is no tag lines like the others.  Did I mess up my english.php hack?

- rg

Title: Re: Changing Auth.net to work for Cybersource
Post by: mrosile on November 07, 2006, 21:07:38 PM
Update on the CyberSource payment module!
v1.1 Released 11/7/2006

WHATS NEW:
   * Added additional CyberSource methods
      - Void Captures
      - Refund Payment
   * More detailed debug messages returned from the
     "handleError" function
   * AUTH_ONLY and AUTH_CAPTURE are both valid responses to CS_TYPE
      - AUTH_ONLY will only authorize the transaction
      - AUTH_CAPTURE will attempt to capture payment after performing
        authorization
   * REVIEW status for authorizations
      - If an authorization is marked as 'review', the order *should*
        still be recorded in VirtueMart along with the reason which
        will be displayed under the "Payment Log"
   * More detailed Payment log for each CyberSource service
   * No more error messages will be displayed when adding this payment
     module.

[attachment cleanup by admin]
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on December 01, 2006, 20:40:57 PM
Hi, 

I just downloaded your update.  There are several problems with it on my installation:

1. There's no place to put my cybersource login id on the config screen
2. The field labels for verified status & invalid status are missing on the config page
3. This version says that the cybs.ini file path is invalid on this new version.  If I restore it to the prior version, it doesn't show a path error.

- rg

Title: Re: Changing Auth.net to work for Cybersource
Post by: Justin on January 10, 2007, 04:33:30 AM
Hello,

I'm also finding an error with the index used for $this->reply it is using ccAuthReply_reasonCode and it seems to need reasonCode.

If this is the case let me know so i can go ahead and edit the code I have accordingly. btw I'm using cybersource api 5.0.1
Title: Re: Changing Auth.net to work for Cybersource
Post by: digical on January 14, 2007, 06:13:01 AM
did you get a chance to fix these bugs?  are you seeing the bugs that I see?