Skip to content

Commit

Permalink
Normalize response params
Browse files Browse the repository at this point in the history
  • Loading branch information
panda-madness committed Apr 6, 2018
1 parent 28ac6ed commit e488b47
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A PHP client for the Qazkom Epay payment gateway",
"type": "library",
"license": "MIT",
"version": "0.0.8",
"version": "0.0.9",
"authors": [
{
"name": "Margulan Baimbet",
Expand Down
2 changes: 1 addition & 1 deletion src/Responses/PaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function parseAttributes(\SimpleXMLElement $xml) {
$props = [];

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

return $props;
Expand Down
15 changes: 10 additions & 5 deletions src/Responses/StatusResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ protected function parse(\SimpleXMLElement $xml)

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

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

return $props;
}

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

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

return $props;
Expand Down

0 comments on commit e488b47

Please sign in to comment.