00;
$request = new DataCashRequest(DATACASH_URL);
$request->MakeXmlPre(DATACASH_CLIENT, DATACASH_PASSWORD,
$processor->mOrderInfo['order_id'] + 1000006,
$order_total_cost, 'GBP',
$processor->mCustomerInfo['credit_card']->CardNumber,
$processor->mCustomerInfo['credit_card']->ExpiryDate,
$processor->mCustomerInfo['credit_card']->IssueDate,
$processor->mCustomerInfo['credit_card']->IssueNumber);
$responseXml = $request->GetResponse();
$xml = simplexml_load_string($responseXml);
if ($xml->status == 1)
{
$processor->SetAuthCodeAndReference(
$xml->merchantreference, $xml->datacash_reference);
// 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.', 20103);
throw new Exception('Credit card check funds failed for order ' .
$processor->mOrderInfo['order_id'] . "\n\n" .
'Data exchanged:' . "\n" .
$request->GetResponse() . "\n" . $responseXml);
}
// Audit
$processor->CreateAudit('PsCheckFunds finished.', 20101);
}
}
?>
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 639
2. Replace the code in business/ps_take_payment.php with the following code:
class PsTakePayment implements IPipelineSection
{
public function Process($processor)
{
// Audit
$processor->CreateAudit('PsTakePayment started.
Pages:
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755