Reputation: 4343
Im trying to create a payment system that integrates with eWay .. They have supplied some code for processing payments, except when i run it im getting the following error:
Message: Undefined index: value
Line Number: 106
The function that line 106 references is as follows:
function parseResponse($xmlResponse){
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $xmlResponse, $xmlData, $index);
$responseFields = array();
foreach($xmlData as $xData)
if($xData["level"] == 2)
$responseFields[$xData["tag"]] = $xData["value"];
return $responseFields;
}
Im really stuck on this, i cant seem to get it working.
Any help on diagnosing this would be fantastic.
Cheers,
The XML im trying to parse is as follows
<ewaygateway>
<ewayCustomerID>87654321</ewayCustomerID>
<ewayTotalAmount>44000</ewayTotalAmount>
<ewayCardHoldersName>Testing Test</ewayCardHoldersName>
<ewayCardNumber>4444333322221111</ewayCardNumber>
<ewayCardExpiryMonth>04</ewayCardExpiryMonth>
<ewayCardExpiryYear>15</ewayCardExpiryYear>
<ewayCustomerFirstName>Testing test</ewayCustomerFirstName>
<ewayCustomerLastName>Testing test</ewayCustomerLastName>
<ewayCustomerEmail>[email protected]</ewayCustomerEmail>
<ewayCustomerAddress>123 Testing St</ewayCustomerAddress>
<ewayCustomerPostcode>2000</ewayCustomerPostcode>
<ewayCustomerInvoiceDescription>Membership</ewayCustomerInvoiceDescription>
<ewayCustomerInvoiceRef>00001</ewayCustomerInvoiceRef>
<ewayTrxnNumber>000001</ewayTrxnNumber>
<ewayOption1>Nice</ewayOption1>
<ewayOption2>Big</ewayOption2>
<ewayOption3>Option</ewayOption3>
</ewaygateway>
Also, this is how the xml is being generated
$xmlRequest = "<ewaygateway><ewayCustomerID>" . $this->myCustomerID . "</ewayCustomerID>";
foreach($this->myTransactionData as $key=>$value)
$xmlRequest .= "<$key>$value</$key>";
$xmlRequest .= "</ewaygateway>";
Upvotes: 0
Views: 380
Reputation: 4421
The <ewaygateway>
tag has no value. Just check to make sure the value index exists with isset.
Upvotes: 1