Commit 1863bd36 authored by Ján Forgáč's avatar Ján Forgáč

OrderPriceResponse: parse PRICE and CURRENCY from the response

parent 49c74937
......@@ -7,12 +7,17 @@
namespace ToptransApiWrapper\Responses;
use ToptransApiWrapper\Constants\Currencies;
class OrderPriceResponse extends ToptransResponse
{
/** @var float|null */
private $price;
/** @var string|null */
private $currencyCode;
public function __construct(array $data)
{
parent::__construct($data);
......@@ -27,9 +32,18 @@ class OrderPriceResponse extends ToptransResponse
return $this->price;
}
/**
* @return string|null
*/
public function getCurrencyCode(): ?string
{
return $this->currencyCode;
}
private function parseRawData($data)
{
$this->price = $data['price'] ?? null;
$this->price = $data['PRICE'] ?? null;
$this->currencyCode = Currencies::ALLOWED_CURRENCIES[$data['CURRENCY_ID']] ?? null;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment