php file acts like this: When we load it in the browser, the script makes a preauthentication
request and a fulfillment request and then saves the preauthentication request, response, and fulfillment XML data
in the session:
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;
}
The test_datacash.php page will be loaded three times more, because we have three frames that we want to
fill with data:
CHAPTER 20 ?– PROCESSING CREDIT CARD TRANSACTIONS 637
Depending on the step value, we decide which of the previously saved-in-session XML data is displayed in the
current frame.
Pages:
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753