', 20103);
throw new Exception('Credit card check funds failed for order ' .
$processor->mOrderInfo['order_id'] . ".\n\n" .
'Data exchanged:' . "\n" .
var_export($transaction, true) . "\n" .
var_export($response, true));
}
// Audit
$processor->CreateAudit('PsCheckFunds finished.', 20101);
}
}
?>
2. Modify business/ps_take_payment.php as follows:
class PsTakePayment implements IPipelineSection
{
public function Process($processor)
{
// Audit
$processor->CreateAudit('PsTakePayment started.', 20400);
$transaction =
array ('x_ref_trans_id' => $processor->mOrderInfo['reference'],
'x_method' => 'CC',
'x_type' => 'PRIOR_AUTH_CAPTURE');
// Process Transaction
$request = new AuthorizeNetRequest(AUTHORIZE_NET_URL);
$request->SetRequest($transaction);
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 651
$response = $request->GetResponse();
$response = explode('|', $response);
if ($response[0] == 1)
{
// Audit
$processor->CreateAudit(
'Funds deducted from customer credit card account.', 20402);
// Update order status
$processor->UpdateOrderStatus(5);
// Continue processing
$processor->mContinueNow = true;
// Audit
$processor->CreateAudit('PsTakePayment finished.', 20401);
}
else
{
// Audit
$processor->CreateAudit(
'Error taking funds from customer credit card.', 20403);
throw new Exception('Credit card take payment failed for order ' .
Pages:
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768