| 
									
										
										
										
											2017-08-19 09:22:44 +02:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * MonetaryAccountBank.php | 
					
						
							|  |  |  |  * Copyright (c) 2017 thegrumpydictator@gmail.com | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * This file is part of Firefly III. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Firefly III is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Firefly III is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with Firefly III.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2017-08-19 09:22:44 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | declare(strict_types=1); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace FireflyIII\Services\Bunq\Object; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  | use Carbon\Carbon; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-19 09:22:44 +02:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |  * Class MonetaryAccountBank. | 
					
						
							| 
									
										
										
										
											2017-08-19 09:22:44 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | class MonetaryAccountBank extends BunqObject | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     /** @var array */ | 
					
						
							|  |  |  |     private $aliases = []; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var Avatar */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $avatar; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var Amount */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $balance; | 
					
						
							|  |  |  |     /** @var Carbon */ | 
					
						
							|  |  |  |     private $created; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $currency = ''; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var Amount */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $dailyLimit; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var Amount */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $dailySpent; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $description = ''; | 
					
						
							|  |  |  |     /** @var int */ | 
					
						
							|  |  |  |     private $id = 0; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var MonetaryAccountProfile */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $monetaryAccountProfile; | 
					
						
							|  |  |  |     /** @var array */ | 
					
						
							|  |  |  |     private $notificationFilters = []; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var Amount */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $overdraftLimit; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $publicUuid = ''; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $reason = ''; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $reasonDescription = ''; | 
					
						
							| 
									
										
										
										
											2017-11-15 12:25:49 +01:00
										 |  |  |     /** @var MonetaryAccountSetting */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     private $setting; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $status = ''; | 
					
						
							|  |  |  |     /** @var string */ | 
					
						
							|  |  |  |     private $subStatus = ''; | 
					
						
							|  |  |  |     /** @var Carbon */ | 
					
						
							|  |  |  |     private $updated; | 
					
						
							|  |  |  |     /** @var int */ | 
					
						
							|  |  |  |     private $userId = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-19 16:46:06 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * MonetaryAccountBank constructor. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param array $data | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |     public function __construct(array $data) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $this->id                     = $data['id']; | 
					
						
							|  |  |  |         $this->created                = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']); | 
					
						
							|  |  |  |         $this->updated                = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']); | 
					
						
							|  |  |  |         $this->balance                = new Amount($data['balance']); | 
					
						
							|  |  |  |         $this->currency               = $data['currency']; | 
					
						
							|  |  |  |         $this->dailyLimit             = new Amount($data['daily_limit']); | 
					
						
							|  |  |  |         $this->dailySpent             = new Amount($data['daily_spent']); | 
					
						
							|  |  |  |         $this->description            = $data['description']; | 
					
						
							|  |  |  |         $this->publicUuid             = $data['public_uuid']; | 
					
						
							|  |  |  |         $this->status                 = $data['status']; | 
					
						
							|  |  |  |         $this->subStatus              = $data['sub_status']; | 
					
						
							|  |  |  |         $this->userId                 = $data['user_id']; | 
					
						
							|  |  |  |         $this->status                 = $data['status']; | 
					
						
							|  |  |  |         $this->subStatus              = $data['sub_status']; | 
					
						
							|  |  |  |         $this->monetaryAccountProfile = new MonetaryAccountProfile($data['monetary_account_profile']); | 
					
						
							|  |  |  |         $this->setting                = new MonetaryAccountSetting($data['setting']); | 
					
						
							|  |  |  |         $this->overdraftLimit         = new Amount($data['overdraft_limit']); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->publicUuid = $data['public_uuid']; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         // create aliases:
 | 
					
						
							|  |  |  |         foreach ($data['alias'] as $alias) { | 
					
						
							|  |  |  |             $this->aliases[] = new Alias($alias); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-09-16 07:17:58 +02:00
										 |  |  |         /** @var array $filter */ | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |         foreach ($data['notification_filters'] as $filter) { | 
					
						
							| 
									
										
										
										
											2017-09-16 07:17:58 +02:00
										 |  |  |             $this->notificationFilters[] = new NotificationFilter($filter); | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2017-08-19 16:46:06 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-26 06:21:22 +02:00
										 |  |  |         return; | 
					
						
							| 
									
										
										
										
											2017-08-19 16:46:06 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-08-19 09:22:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-27 08:54:58 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * @return array | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getAliases(): array | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->aliases; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @return Amount | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getBalance(): Amount | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->balance; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getCurrency(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->currency; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @return string | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getDescription(): string | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->description; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @return int | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getId(): int | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->id; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * @return MonetaryAccountSetting | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     public function getSetting(): MonetaryAccountSetting | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return $this->setting; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2017-08-31 06:47:18 +02:00
										 |  |  | } |