From 7f459df9e9edc4ee1be5ab109c244ffa94cb3b99 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 28 Apr 2018 16:24:24 +0200 Subject: [PATCH] Last minute sanity check. --- app/Import/Object/ImportBill.php | 26 ++++++++++++------- .../Bunq/Object/MonetaryAccountBank.php | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/Import/Object/ImportBill.php b/app/Import/Object/ImportBill.php index aacc6e33b5..19364f9df6 100644 --- a/app/Import/Object/ImportBill.php +++ b/app/Import/Object/ImportBill.php @@ -255,18 +255,24 @@ class ImportBill } $data = [ - 'name' => $name, - 'match' => $name, - 'amount_min' => bcmul($this->amount, '0.9'), - 'amount_max' => bcmul($this->amount, '1.1'), - 'user_id' => $this->user->id, - 'date' => date('Y-m-d'), - 'repeat_freq' => 'monthly', - 'skip' => '0', - 'automatch' => '0', - 'active' => '1', + 'name' => $name, + 'match' => $name, + 'amount_min' => bcmul($this->amount, '0.9'), + 'amount_max' => bcmul($this->amount, '1.1'), + 'user_id' => $this->user->id, + 'date' => date('Y-m-d'), + 'repeat_freq' => 'monthly', + 'skip' => '0', + 'transaction_currency_id' => 1, + 'automatch' => '0', + 'active' => '1', ]; + $currency = app('amount')->getDefaultCurrencyByUser($this->user); + if (null !== $currency) { + $data['transaction_currency_id'] = $currency->id; + } + Log::debug('Found no bill so must create one ourselves. Assume default values.', $data); $result = $this->repository->store($data); if (null !== $result) { diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.php index 86a0d738a7..6360cb289f 100644 --- a/app/Services/Bunq/Object/MonetaryAccountBank.php +++ b/app/Services/Bunq/Object/MonetaryAccountBank.php @@ -176,7 +176,7 @@ class MonetaryAccountBank extends BunqObject 'monetary_account_profile' => $this->monetaryAccountProfile->toArray(), 'setting' => $this->setting->toArray(), 'overdraft_limit' => $this->overdraftLimit->toArray(), - 'avatar' => null === $this->avatar ? null : $this->avatar->toArray()->toArray(), + 'avatar' => null === $this->avatar ? null : $this->avatar->toArray(), 'reason' => $this->reason, 'reason_description' => $this->reasonDescription, 'alias' => [],