Skip to content

Commit

Permalink
Update AuthorizeRequest.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Dumkaaa authored Oct 16, 2018
1 parent 37c6bec commit 19c51e9
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,19 @@ public function sendData($data)
$this->validate('userName', 'password');
$data['currency'] = $this->getCurrencyNumeric();
$data['amount'] = $this->getAmountInteger();
$data = array_merge(
[
'userName' => $this->getUserName(),
'password' => $this->getPassword(),
],
$data
);

$httpResponse = $this->httpClient->request(
$this->getHttpMethod(),
$url,
$this->getHeaders(),
json_encode(array_merge([
'userName' => $this->getUserName(),
'password' => $this->getPassword()
], $data))
http_build_query($data, '', '&')
);

$responseClassName = str_replace('Request', 'Response', \get_class($this));
Expand All @@ -259,6 +264,8 @@ public function sendData($data)
);
}

return $reflection->newInstance($this, json_decode($httpResponse->getBody(true), true));
$content = json_decode($httpResponse->getBody()->getContents(), true);

return $reflection->newInstance($this, $content);
}
}

0 comments on commit 19c51e9

Please sign in to comment.