diff --git a/app/Import/Transformer/BaseTransformer.php b/app/Import/Transformer/BaseTransformer.php index 46775ac070..3aa0e1769c 100644 --- a/app/Import/Transformer/BaseTransformer.php +++ b/app/Import/Transformer/BaseTransformer.php @@ -68,6 +68,11 @@ class BaseTransformer } + public function getNumber($data, $field) + { + return (isset($data->$field) && $data->$field) ? (int)$data->$field : 0; + } + public function getString($data, $field) { return isset($data[$field]) && $data[$field] ? trim($data[$field]) : ''; diff --git a/app/Import/Transformers/Bank/BankTransformer.php b/app/Import/Transformers/Bank/BankTransformer.php index 071ac77110..4233a9be4d 100644 --- a/app/Import/Transformers/Bank/BankTransformer.php +++ b/app/Import/Transformers/Bank/BankTransformer.php @@ -12,7 +12,7 @@ namespace App\Import\Transformers\Bank; use App\Import\ImportException; -use App\Import\Transformers\BaseTransformer; +use App\Import\Transformer\BaseTransformer; use App\Models\BankTransaction; use App\Utils\Number; @@ -38,7 +38,7 @@ class BankTransformer extends BaseTransformer 'account_type' => strlen($this->getString($transaction, 'bank.account_type')) > 1 ? $this->getString($transaction, 'bank.account_type') : 'bank', 'category_id' => $this->getNumber($transaction, 'bank.category_id') > 0 ? $this->getNumber($transaction, 'bank.category_id') : null, 'category_type' => $this->getString($transaction, 'category_type'), - 'date' => array_key_exists('date', $transaction) ? date('Y-m-d', strtotime(str_replace("/","-",$transaction['date']))) + 'date' => array_key_exists('date', $transaction) ? $this->parseDate($transaction['date']) : now()->format('Y-m-d'), 'bank_account_id' => array_key_exists('bank_account_id', $transaction) ? $transaction['bank_account_id'] : 0, 'description' => array_key_exists('description', $transaction)? $transaction['description'] : '', diff --git a/app/Jobs/User/VerifyPhone.php b/app/Jobs/User/VerifyPhone.php index ca639b2d8c..a1fb8b1687 100644 --- a/app/Jobs/User/VerifyPhone.php +++ b/app/Jobs/User/VerifyPhone.php @@ -53,7 +53,7 @@ class VerifyPhone implements ShouldQueue if(!$sid) return; // no twilio api credentials provided, bail. - $twilio = new Twilio\Rest\Client($sid, $token); + $twilio = new \Twilio\Rest\Client($sid, $token); $country = $this->user->account?->companies()?->first()?->country();