Bug zapped

Posts: 4
Joined: 02/22/2008

Hi, I just worked with Vnd, a php whiz friend of mine this morning and we found the bug. It was quite simple. The data response is alpha numeric according the Skipjacks api and you were using is_numeric against $data_response so even though the order was valid and process correctly, we were getting back AUTHCODE's that included letters and thus this function below was returning false:

function _evaluate_response($data_response)
{
	if($data_response['szIsApproved']==1 && $data_response['szReturnCode']==1 && is_numeric($data_response['AUTHCODE']))
	{
		return TRUE;
	}else 
	{
		return FALSE;
	}
}

According the skipjack, if AUTHCODE is 0 or empty then the order is not valid/rejected. Here is our mod:

function _evaluate_response($data_response)
{
	if($data_response['szIsApproved']==1 && $data_response['szReturnCode']==1 && !empty($data_response['AUTHCODE']))
	{
		return TRUE;
	}else 
	{
		return FALSE;
	}
}

I hope this helps.

Also, we cleaned up line 143 a bit and I'll paste that here for what it's worth:

	   	$message = t('Your credit card was successfully charged: !amount Transaction ID: !code Order ID: !oder_num Authorization/Approval Code: !a_code !text', array('!amount' => uc_currency_format($data_response['szTransactionAmount']/100),'!code'=>$data_response['szTransactionFileName'],'!oder_num'=>$data_response['szOrderNumber'],'!a_code'=>$data_response['AUTHCODE'],'!text' => _get_szReturnCodeInfo($data_response['szReturnCode'])));

Again, thanks a million for this contribution.

Skipjack Payment Gateway By: mac_perlinski (3 replies) Thu, 03/06/2008 - 12:43