Prev | Current Page 738 | Next

Emilian Balanescu and Cristian Darie

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

Define the DataCash URL and login data at the end of your include/config.php file:
// Constant definitions for datacash
define('DATACASH_URL', 'https://testserver.datacash.com/Transaction');
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 632
define('DATACASH_CLIENT', 'your account client number');
define('DATACASH_PASSWORD', 'your account password');
?– Note Don??™t forget to use the data from your DataCash account!
3. Create the test_datacash.php file in your project??™s home (the tshirtshop folder), and add the following
in it:
session_start();
if (empty ($_GET['step']))
{
require_once 'include/config.php';
require_once BUSINESS_DIR . 'datacash_request.php';
$request = new DataCashRequest(DATACASH_URL);
$request->MakeXmlPre(DATACASH_CLIENT, DATACASH_PASSWORD,
8880000 + rand(0, 10000), 49.99, 'GBP',
'3528000000000007', '11/09');
$request_xml = $request->GetRequest();
$_SESSION['pre_request'] = $request_xml;
$response_xml = $request->GetResponse();
$_SESSION['pre_response'] = $response_xml;
$xml = simplexml_load_string($response_xml);
$request->MakeXmlFulfill(DATACASH_CLIENT, DATACASH_PASSWORD,
$xml->merchantreference,
$xml->datacash_reference);
$response_xml = $request->GetResponse();
$_SESSION['fulfill_response'] = $response_xml;
}
else
{
header('Content-type: text/xml');
switch ($_GET['step'])
{
case 1:
print $_SESSION['pre_request'];
CHAPTER 20 ?–  PROCESSING CREDIT CARD TRANSACTIONS 633
break;
case 2:
print $_SESSION['pre_response'];
break;
case 3:
print $_SESSION['fulfill_response'];
break;
}
exit();
}
?>

726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750
poker online Wisła noclegi ciekawe zdania imprezy integracyjne dla firm teksty piosenek