Jump to content
Sign in to follow this  
perfectpassion

[Contribution] Protx Direct v5 Support Thread

Recommended Posts

Hi Tom,

 

I'm still having some funnys with orders and protx and this could be related to the issues we discussed earlier. In VSP admin i'm having orders recorded with the same order number. I've included a screen shot below.

 

protx.jpg

 

Now some of these are recorded in OSC under different order numbers e.g from the top down Miss CI Tatterton has the order number 51059 in OSC but 51058 in OSC. Andrea Brown has 51058 as she should have. On this occasion both orders have been picked up in OSC

 

Eric Callaghan has the order number 50569 as he should and Kelly Street has the same order number but her order hasn't been picked up in OSC. Its only through manual checking in VSP admin that I found her order.

 

The last one Rebecca whats has the order number 50999 in both OSC and VSP and Heath Thompson has the order number 51000 in OSC and 50999 in VSP but again on this occasion both orders have been picked up in OSC.

 

I don't know if this gives you any ideas, but its all I have at the moment :)

 

All the best

 

Dave

Share this post


Link to post
Share on other sites

Nope, but I see now that I have one. The old board used to pop up with a message when logged in so to be honest I never looked.

 

I'll take a look now

Share this post


Link to post
Share on other sites

Hi Guys,

 

I have set this up for a client and all works fine - in typical fashion the client has requested some last minute changes to how the cart is going to work. Can anyone explain where exactly in the code the total Amount is passed into the Protx script?

 

Thanks

Share this post


Link to post
Share on other sites

In includes/modules/payment/protx_direct.php, look for the following line:

 

	'Amount' => $this->format_raw($order->info['total']),

(amount sent to SagePay)

 

and also

	'value' => $this->format_raw($order->info['total']),

(amount stored in db to appear in store admin)

Share this post


Link to post
Share on other sites

I have installed the v5.1 for a month now. Everything is fine except sometimes it duplicate transactions for the same order in the sagepay VSP admin. This cause the customer to pay a few more times . This happens often and I have to refund the duplicated payment to the customers and apologise. I browsed the thread but no one experience this.

 

Here is an order from yesterday. (transactions details in the Sagepay Transaction list):

 

72167-59622654290671326542817393313904 29/12/2009 14:04:43 23.49 (GBP) 222368446 [Matched] [Matched] [Matched] Gemma P Bufton

72167-85572198562141337732051131564618 29/12/2009 14:04:41 23.49 (GBP) 222368423 [Matched] [Matched] [Matched] Gemma P Bufton

72167-01264375188094007069989086828553 29/12/2009 14:04:28 23.49 (GBP) 222368317 [Matched] [Matched] [Matched] Gemma P Bufton

 

Below are the detail(same order) from the Osc Admin order page:

 

2009-12-29 14:04:28 PAYMENT 23.4900 OK 0000 : The Authorisation was Successful. ALL MATCH MATCHED MATCHED MATCHED NOTCHECKED

2009-12-29 14:04:42 PAYMENT 23.4900 OK 0000 : The Authorisation was Successful. ALL MATCH MATCHED MATCHED MATCHED NOTCHECKED

2009-12-29 14:04:45 PAYMENT 23.4900 OK 0000 : The Authorisation was Successful. ALL MATCH MATCHED MATCHED MATCHED NOTCHECKED

 

I've also checked the module source code:

It's from protx_direct function start_transaction()

//line around #160

$response = $GLOBALS['protx_direct']->start_transaction();

 

It seems that practically this line of code execute 3 times before the order is saved. It's so weird... it doesnt happen during testing.

 

Hope someone with the experience can help me out.

Share this post


Link to post
Share on other sites

Just out of interest are the customers all using Visa cards when this occurs?

 

 

I've checked a few more (not all of them though) Surprised to found out that so far yes they are. Also, I found that 2 orders last week happened to have the same pre-fix order no. in their Vendor TX Code in the sagepay VSP:

 

72985-10332689424896887095433381431379 08/01/2010 12:47:30 74.07 (GBP) 225070629 [Matched] [Matched] [Matched] Marzena Cebula

72985-30438277310395806245313500835701 08/01/2010 12:47:24 33.47 (GBP) 225070606 [Matched] [Matched] [Matched] danielle ford

 

But they have the different order no. in Osc Admin (which is normal)

#72895 33.47 (GBP) danielle ford

#72896 74.07 (GBP) Marzena Cebula

 

The card detail in sagepay vsp of these orders:

Card Details: Visa Debit / Delta

 

Have you got the same experience/tips? Looks like they have something common at least But still I havent got a clue yet...

Share this post


Link to post
Share on other sites

Hi there,

 

No solution unfortunately.

 

I have the same problem, occurs with visa transactions using 3d secure (but not all are affected). Been speaking to Tom about it for a while but thought I was the only one with the issue until now.

 

Recently its become so frustrating that I'm testing the certified contribution this week (despite its shortcomings) to see what happens.

 

Will let you know how that goes

 

Dave

Share this post


Link to post
Share on other sites

Hi there,

 

No solution unfortunately.

 

I have the same problem, occurs with visa transactions using 3d secure (but not all are affected). Been speaking to Tom about it for a while but thought I was the only one with the issue until now.

 

Recently its become so frustrating that I'm testing the certified contribution this week (despite its shortcomings) to see what happens.

 

Will let you know how that goes

 

Dave

 

Mine are not with the 3D secure. Do you think the customers have any chance to hit the continue button twice?(which cause the duplicate payment) I am trying to test this with button disable function and see how it goes,except this no other clue...Thanks for your reply and looking forward to your testing result.

Share this post


Link to post
Share on other sites

Hi there,

 

My customers were getting blank screens after putting in their 3d secure info and then going back and resubmitting the info again. Their money had been taken the first time but they didn't get to checkout success so their products were still in their carts, an order hadn't been logged on the site so they proceeded to try again and again.

Share this post


Link to post
Share on other sites

Hi there,

 

My customers were getting blank screens after putting in their 3d secure info and then going back and resubmitting the info again. Their money had been taken the first time but they didn't get to checkout success so their products were still in their carts, an order hadn't been logged on the site so they proceeded to try again and again.

 

Hi Dave,

 

So did the customers told you they are getting blank page or you actually discovered/tested it yourself? What frustrating me is that I never get this kind of duplicate payment in testing... do you? So I havent got a chance to see what happen (even blank page) during the process myself and facilitate solution.

 

So is it exactly after the 3D password is input, only when 3D secure on? It might be helpful if it did happen somewhere so I can think of a solution.

Share this post


Link to post
Share on other sites

Hi there

 

until yesterday it had only happened to customers and I had been replying on their feedback but yesterday it happened to me during testing.

 

It happened once I had hit the submit button on the 3d secure page. Instead of being directed to checkout_success as I should have been it returned me back to the checkout_confirmation page to resubmit my card info. My basket was still full. No order had been recorded on OSC but the transaction as far as sage pay was concerned was successful and recorded in VSP admin as a transaction.

 

Dave

Share this post


Link to post
Share on other sites

Hi there

 

until yesterday it had only happened to customers and I had been replying on their feedback but yesterday it happened to me during testing.

 

It happened once I had hit the submit button on the 3d secure page. Instead of being directed to checkout_success as I should have been it returned me back to the checkout_confirmation page to resubmit my card info. My basket was still full. No order had been recorded on OSC but the transaction as far as sage pay was concerned was successful and recorded in VSP admin as a transaction.

 

Dave

 

 

The protx_prcess.php file is to process the payment response from sagepay and redirect to the checkout_process.php. there is a line of code that returns the response:

$response = $GLOBALS['protx_direct']->start_transaction();

 

it then inspects whether the response is successful ($response['authorised']). I suspect that in those cases the transactions are successful and for some reason the response indicates false(or something else). That could explain why it returns you back to the checkout_confirmation page.

 

It didnt happen in the last few days but I've put a debug email in the start_transaction() function to track the response for every transaction. I might find out the responses details when the 'double charge situation' happen again. Cheers.

Share this post


Link to post
Share on other sites

It hadn't happened to me all week and then a customer on Friday had his money taken 5 times before he phoned up! This time though it wasn't 3d secure but it was still a visa transaction.

 

The frequency of it may have slowed down a bit this end as the number of orders we're getting is around 50% down on December.

 

Hopefully your debug will throw something up. Do you want to post the code you added and I'll stick it on at this end too?

Share this post


Link to post
Share on other sites

It hadn't happened to me all week and then a customer on Friday had his money taken 5 times before he phoned up! This time though it wasn't 3d secure but it was still a visa transaction.

 

The frequency of it may have slowed down a bit this end as the number of orders we're getting is around 50% down on December.

 

Hopefully your debug will throw something up. Do you want to post the code you added and I'll stick it on at this end too?

 

 

The function do_curl() in protx_direct.php send the order details to sagepay and get returned responses. After the original code

$response = curl_exec($ch);

$curl_error = curl_error($ch);

curl_close($ch);

 

you could put the following code to track the $responses, So you would track the response from sagepay for every transaction (every hit of the confirm button):

 

//

$trackresponse = "\n\n" . print_r($responses,true);

mail('yourmail@hotmail.com', '', $trackresponse);

//

 

It happened to a few orders this morning, where a customer failed several times in putting a transaction through (by getting following responses):

$responses['Status']=NOTAUTHED

$responses['StatusDetail'] => 2000 : The Authorisation was Declined by the bank.

 

which is fine actually. But after that one of these failed transaction got empty response from sagepay. (where the $responses array is empty) and it's not recorded in the sagepay admin either.

That's what I've got so far & still waiting to see the debug response details for a duplicate transaction.

Share this post


Link to post
Share on other sites

The function do_curl() in protx_direct.php send the order details to sagepay and get returned responses. After the original code

$response = curl_exec($ch);

$curl_error = curl_error($ch);

curl_close($ch);

 

you could put the following code to track the $responses, So you would track the response from sagepay for every transaction (every hit of the confirm button):

 

//

$trackresponse = "\n\n" . print_r($responses,true);

mail('yourmail@hotmail.com', '', $trackresponse);

//

 

It happened to a few orders this morning, where a customer failed several times in putting a transaction through (by getting following responses):

$responses['Status']=NOTAUTHED

$responses['StatusDetail'] => 2000 : The Authorisation was Declined by the bank.

 

which is fine actually. But after that one of these failed transaction got empty response from sagepay. (where the $responses array is empty) and it's not recorded in the sagepay admin either.

That's what I've got so far & still waiting to see the debug response details for a duplicate transaction.

 

Thanks I'll take a look at that.

 

Strangely I've had 2 people phone today who have had the problem and these 2 were Mastercard!

 

Dave

Share this post


Link to post
Share on other sites

The thread is quiet... Is there any other thread for protx direct too. Have this happened to anyone else as well?

 

Hi dave, I've got a double charged yesterday and the first transaction(attempt) got an empty response from sagepay. I haven't got a clue why it's getting the empty response (or even whether sagepay had the request)

 

For some reason this happened once a week rather than once a day previously. Are you getting empty response, similar result?

Share this post


Link to post
Share on other sites

Hi,

 

sorry I've been busy for a while.

 

I've just added the code to be sent the emails, I'm getting quite a few at the moment so it won't be long before I get some data together.

 

Recently it happened on maestro and mastercard so not sure what has changed.

 

I'll keep you posted.

 

Cheers

 

Dave

Share this post


Link to post
Share on other sites

The first 2 emails I've had through have been completely blank. Am I missing something?

Share this post


Link to post
Share on other sites

Are those 2 payment request successful or is there any record accordingly in the Sagepay VSP?

 

The first 2 emails I've had through have been completely blank. Am I missing something?

Share this post


Link to post
Share on other sites

Are those 2 payment request successful or is there any record accordingly in the Sagepay VSP?

 

I've had 40 or so orders and 40 or so emails but they're all blank.

 

I don't know yet if any of them were unsuccessful.

Share this post


Link to post
Share on other sites

For the double charge(start_transaction() executed twice) I am still not sure why that happens but Temporarily I come up with a solution:

 

in protx_prcess.php look for '$response = $GLOBALS['protx_direct']->start_transaction();' added just before:

 

$last_order_id_query = tep_db_query("SHOW TABLE STATUS from `" . DB_DATABASE . "` like '" . TABLE_ORDERS . "'");

$last_order_id = tep_db_fetch_array($last_order_id_query);

$new_order_id = $last_order_id['Auto_increment'];

 

$sagepay_local_query = tep_db_query("select * from " . TABLE_PROTX_DIRECT . " where customer_id='". (int)$customer_id . "' order by txtime desc");

if (tep_db_num_rows($sagepay_local_query)>0) {

$sagepay_local = tep_db_fetch_array($sagepay_local_query);

if ($sagepay_local['customer_id']==$customer_id && $sagepay_local['order_id']==$new_order_id_1 && $sagepay_local['status']=='OK') {

echo '<script type="text/javascript">window.location.href="'.tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL').'";</script>';

tep_exit();

}

}

 

 

Also, during testing I think the following change of code works better in protx_direct.php. look for code for sending payment request (from SagePay addon Direct http://addons.oscommerce.com/info/6985)

function do_curl($data, $url) {

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_TIMEOUT, 90);

 

if (MODULE_PAYMENT_PROTX_DIRECT_CURL_SSL == 'True')

{

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

}

 

$response = curl_exec($ch);

$curl_error = curl_error($ch);

curl_close ($ch);

 

change to :

 

function do_curl($data, $url){

$server = parse_url($url);

 

if (isset($server['port']) === false) {

$server['port'] = ($server['scheme'] == 'https') ? 443 : 80;

}

 

if (isset($server['path']) === false) {

$server['path'] = '/';

}

 

if (isset($server['user']) && isset($server['pass'])) {

$header[] = 'Authorization: Basic ' . base64_encode($server['user'] . ':' . $server['pass']);

}

 

if (function_exists('curl_init')) {

$ch = curl_init($server['scheme'] . '://' . $server['host'] . $server['path'] . (isset($server['query']) ? '?' . $server['query'] : ''));

curl_setopt($ch, CURLOPT_PORT, $server['port']);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);

curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

 

if (MODULE_PAYMENT_PROTX_DIRECT_CURL_SSL == 'True')

{

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

}

$response = curl_exec($ch);

$curl_error = curl_error($ch);

 

curl_close($ch);

} else {

exec(escapeshellarg(MODULE_PAYMENT_PROTX_DIRECT_CURL_SSL) . ' -d ' . escapeshellarg($data) . ' "' . $server['scheme'] . '://' . $server['host'] . $server['path'] . (isset($server['query']) ? '?' . $server['query'] : '') . '" -P ' . $server['port'] . ' -k', $result);

$response = implode("\n", $result);

}

 

 

So far I am still not sure what cause the empty responses for request (returned MODULE_PAYMENT_PROTX_DIRECT_TEXT_PROTX_ERROR from protx_direct.php interpreteResponse()) where customer need to re hit the confirm button.

 

Really appreciated if someone can spot any pitfalls of the changes above or any other suggestion.

Share this post


Link to post
Share on other sites

Hi Gang,

 

i've added the code this morning so we'll see what happens.

 

Btw I've never got the email results to work. every email I receive is blank??

Share this post


Link to post
Share on other sites

Hi Gang,

 

i've added the code this morning so we'll see what happens.

 

Btw I've never got the email results to work. every email I receive is blank??

 

In your debug email did you put in the correct response array? check that, and Normally there is no way the customer can proceed the transaction by getting a blank response, in which case the customer will see something like: 'Unfortunately there has been a technical problem. Please try again and if the problem persists please contact us.' and stuck on the confirmation page.

 

By the way so far I manage to avoid the double charged problem(frequency once a week), and got a debug email every time that happen. see the code I mentioned above. Still not knowing the cause though...And recently I am too busy to investigate more.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×