Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

TrustCommerce Integration Problem


fredh

Recommended Posts

Hey all,

 

This is a long one, I hope you guys make it through -- I am using TrustCommerce as my payment module and everything is working great. :D

 

However, I need to change how the payment process currently works.

 

The default TrustCommerce payment action is "Sale" which means "authorize and collect the money" from the customers card.

 

Unfortunately, due to legal reasons, you can't actually take customers money until you have shipped the product.

 

So, to handle this, you have to do a "Preauth" with TrustCommerce instead of "Sale", and then after the product is shipped you have to do a "Postauth" which actually collects the money.

 

My problem is the following:

 

When I do a successful preauth, I am returned a TransactionID. I need to remember this TransactionID to do the "Postauth" at a later date. (this way you don't need to remember cc info etc)

 

Therefore I need to store this TransactionID in the database and associate it with the order number.

 

The problem is that in the current TrustCommerce payment module, the actual interfacing with TrustCommerce is done in the "before_process()" function, which happens before an actual order number is created.

 

I'm stuck in a chicken before the egg syndrome.

 

I have a few hacks in mind to get this working, but I am wondering what you guys think would be the best way to solve this problem.

 

Any suggestions that anyone can give would be of great value, THANKS!!

Link to comment
Share on other sites

I am using TrustCommerce as my payment module and everything is working great. :D

 

So, everything works great with TrustCommerce? But you don't have it installed and working yet with osc? I'm even more confused than I just was on my last post! Are you sure you don't work for TrustCommerce?

 

Can't you return the value and then pass it to the function that creates the order# and then save it in a new field under orders table?

Link to comment
Share on other sites

No I don't work for TrustCommerce :)

 

What I mean is that I have a test account setup and with the "out of the box" installation of their contribution with OSC, everything works.

 

Meaning, I can make an order, and then I can login to their system and see that the order was successfully received.

 

Unfortunately the "Out fo the box" contribution uses the "Sale" method and not "Preauth"/"Postauth" methods :(

Link to comment
Share on other sites

Any suggestions that anyone can give would be of great value, THANKS!!

 

You could try adding the following to the after_process() function

 

    function after_process() {

     global $insert_id, $result;

       tep_db_query("update " . TABLE_ORDERS . " set trans_id = '" . $result['trans_code'] . "' where order_id = '" . $insert_id . "'");

   }

 

You would obviously need to create a new field in the orders table and check what the return field is called as the code above is just off the top of my head :)

 

That should get you on the right road!

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

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

Software is like sex: It's better when it's free. (Linus Torvalds)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...