Skip to content

Commit

Permalink
Add order node to OrderResponse parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
panda-madness committed Apr 6, 2018
1 parent b1d384d commit b88cb8a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Responses/PaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@ class PaymentResponse extends AbstractResponse
protected function parse(\SimpleXMLElement $sxi) : array
{
$props = [];

$order = $this->xml->xpath('/document/bank/customer/merchant/order')[0];

$result = $this->xml->xpath('/document/bank/results')[0];

$payment = $result->payment;

foreach ($result->attributes() as $name => $value) {
$props['result'][$name] = $value;
}
$props['result'] = $this->parseAttributes($result);
$props['payment'] = $this->parseAttributes($payment);
$props['order'] = $this->parseAttributes($order);

return $props;
}

private function parseAttributes(\SimpleXMLElement $xml) {
$props = [];

foreach ($payment->attributes() as $name => $value) {
$props['payment'][$name] = $value;
foreach ($xml->attributes() as $name => $value) {
$props[strtolower($name)] = $value;
}

return $props;
Expand Down

0 comments on commit b88cb8a

Please sign in to comment.