private function buildTransfer($xml) { $transfer = new Transfer(); $transfer->setRequestId((string) $xml->RequestId); $transfer->setTransactionReference((string) $xml->TransactionReference); $transactionHistory = new TransactionHistory(); $transactionArray = array(); foreach ($xml->TransactionHistory->Transaction as $transaction) { $tmpTransaction = new Transaction(); $tmpTransaction->setType((string) $transaction->Type); $tmpTransaction->setSystemTraceAuditNumber((string) $transaction->SystemTraceAuditNumber); $tmpTransaction->setNetworkReferenceNumber((string) $transaction->NetworkReferenceNumber); $tmpTransaction->setSettlementDate((string) $transaction->SettlementDate); $tmpResponse = new Response(); $response = $transaction->Response; $tmpResponse->setCode((string) $response->Code); $tmpResponse->setDescription((string) $response->Description); $tmpTransaction->setSubmitDateTime((string) $transaction->SubmitDateTime); $tmpTransaction->setResponse($tmpResponse); array_push($transactionArray, $tmpTransaction); } $transactionHistory->setTransaction($transactionArray); $transfer->setTransactionHistory($transactionHistory); return $transfer; }