From 5e98213c6a67501532e2e959a428859c6c325eaa Mon Sep 17 00:00:00 2001 From: Euheni Panasevich Date: Tue, 21 Apr 2020 12:56:52 +0300 Subject: [PATCH] Check voice rate Some countries haven't tollfree rate --- src/Plivo/Resources/Pricing/Pricing.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Plivo/Resources/Pricing/Pricing.php b/src/Plivo/Resources/Pricing/Pricing.php index e4e46ffc..a4fad6d0 100644 --- a/src/Plivo/Resources/Pricing/Pricing.php +++ b/src/Plivo/Resources/Pricing/Pricing.php @@ -46,9 +46,12 @@ function __construct(BaseClient $client, $response) $outboundNetworksList ); + $toll_free = isset($response['phone_numbers']['tollfree']['rate']) ? $response['phone_numbers']['tollfree']['rate']: null; + $local = isset($response['phone_numbers']['local']['rate']) ? $response['phone_numbers']['local']['rate']: null; + $this->properties['phoneNumbers'] = new PhoneNumbers( - new Local($response['phone_numbers']['local']['rate']), - new Tollfree($response['phone_numbers']['tollfree']['rate']) + new Local($local), + new Tollfree($toll_free) ); $this->properties['voice'] = new Voice(