Prev | Current Page 742 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

If the step value is 1, the prerequest XML code is displayed. If the value is 2, the preresponse XML
code is displayed. If the step value is 3, the fulfill response XML is displayed.
else
{
header('Content-type: text/xml');
switch ($_GET['step'])
{
case 1:
print $_SESSION['pre_request'];
break;
case 2:
print $_SESSION['pre_response'];
break;
case 3:
print $_SESSION['fulfill_response'];
break;
}
exit();
}
Integrating DataCash with TShirtShop
Now that we have a new class that performs credit card transactions, all we need to do is integrate
its functionality into the order pipeline we built in the previous chapters. To fully integrate
DataCash with TShirtShop, we??™ll need to update the existing PsCheckFunds and PsTakePayments
classes.
We need to modify the pipeline section classes that deal with credit card transactions.
We??™ve already included the infrastructure for storing and retrieving authentication codes and
reference information, via the OrderProcessor::SetOrderAuthCodeAndReference() method.
Exercise: Implementing the Order Pipeline Classes
1. First, replace the code in business/ps_check_funds.php with the following code that works with DataCash:
class PsCheckFunds implements IPipelineSection
{
public function Process($processor)
{
// Audit
$processor->CreateAudit('PsCheckFunds started.', 20100);
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 638
$order_total_cost = $processor->mOrderInfo['total_amount'];
$order_total_cost += $processor->mOrderInfo['shipping_cost'];
$order_total_cost +=
round((float)$order_total_cost *
(float)$processor->mOrderInfo['tax_percentage'], 2) / 100.


Pages:
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
Wczasy nad morzem kasyno kino azjatyckie bwin out of home advertising