class PsCheckFunds implements IPipelineSection
{
public function Process($processor)
{
// Audit
$processor->CreateAudit('PsCheckFunds started.', 20100);
$order_total_cost = $processor->mOrderInfo['total_amount'];
$order_total_cost += $processor->mOrderInfo['shipping_cost'];
$order_total_cost +=
round((float)$order_total_cost *
(float)$this->mOrderInfo['tax_percentage'], 2) / 100.00;
$exp_date = str_replace('/', '',
$processor->mCustomerInfo['credit_card']->ExpiryDate);
$transaction =
array (
'x_invoice_num' => $processor->mOrderInfo['order_id'],
'x_amount' => $order_total_cost, // Amount to charge
'x_card_num' => $processor->mCustomerInfo['credit_card']->CardNumber,
'x_exp_date' => $exp_date, // Expiry (MMYY)
'x_method' => 'CC',
'x_type' => 'AUTH_ONLY');
// Process Transaction
$request = new AuthorizeNetRequest(AUTHORIZE_NET_URL);
$request->SetRequest($transaction);
$response = $request->GetResponse();
$response = explode('|', $response);
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 650
if ($response[0] == 1)
{
$processor->SetAuthCodeAndReference($response[4], $response[6]);
// Audit
$processor->CreateAudit('Funds available for purchase.', 20102);
// Update order status
$processor->UpdateOrderStatus(2);
// Continue processing
$processor->mContinueNow = true;
}
else
{
// Audit
$processor->CreateAudit('Funds not available for purchase.
Pages:
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767