Currency exchange rate will not be saved when rate is 0.

This commit is contained in:
James Cole 2018-03-30 06:33:04 +02:00
parent 7e51d57d21
commit 55b6d711f3
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
10 changed files with 13 additions and 10 deletions

View File

@ -64,4 +64,4 @@ class CountAttachmentsFilter implements FilterInterface
return $set;
}
}
}

View File

@ -64,4 +64,4 @@ class SplitIndicatorFilter implements FilterInterface
return $set;
}
}
}

View File

@ -59,4 +59,4 @@ class Image extends BunqObject
die(sprintf('Cannot convert %s to array.', get_class($this)));
}
}
}

View File

@ -87,4 +87,4 @@ class LabelUser extends BunqObject
{
die(sprintf('Cannot convert %s to array.', get_class($this)));
}
}
}

View File

@ -92,11 +92,13 @@ class FixerIOv2 implements ExchangeRateInterface
}
if (null !== $content) {
$code = $toCurrency->code;
$rate = isset($content['rates'][$code]) ? $content['rates'][$code] : '0';
$rate = $content['rates'][$code] ?? 0;
}
Log::debug('Got the following rates from Fixer: ', $content['rates'] ?? []);
$exchangeRate->rate = $rate;
$exchangeRate->save();
if ($rate !== 0) {
$exchangeRate->save();
}
return $exchangeRate;
}

View File

@ -43,4 +43,4 @@ class CategoryDestroyService
Log::error(sprintf('Could not delete category: %s', $e->getMessage())); // @codeCoverageIgnore
}
}
}
}

View File

@ -45,4 +45,4 @@ class CurrencyDestroyService
}
}
}
}

View File

@ -45,4 +45,4 @@ class CategoryUpdateService
return $category;
}
}
}

View File

@ -47,4 +47,4 @@ class CurrencyUpdateService
return $currency;
}
}
}

View File

@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;