1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Helpers/Bank/Yodlee/DTO/AccountSummary.php

111 lines
2.9 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Helpers\Bank\Yodlee\DTO;
use Illuminate\Support\Collection;
2023-10-26 04:57:44 +02:00
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Data;
/**
2023-08-10 03:16:27 +02:00
* [
"account": [
2023-08-10 03:16:27 +02:00
[
"CONTAINER": "bank",
2023-08-10 03:16:27 +02:00
"providerAccountId": 1005,
"accountName": "Business Acct",
"accountStatus": "ACTIVE",
2023-08-10 03:16:27 +02:00
"accountNumber": "1011",
"aggregationSource": "USER",
"isAsset": true,
2023-08-10 03:16:27 +02:00
"balance": [
"currency": "AUD",
2023-08-10 03:16:27 +02:00
"amount": 304.98,
],
"id": 10139315,
"includeInNetWorth": true,
"providerId": "3857",
2023-08-10 03:16:27 +02:00
"providerName": "Bank",
"isManual": false,
"availableBalance": {#2966
"currency": "AUD",
2023-08-10 03:16:27 +02:00
"amount": 304.98,
],
"currentBalance": [
"currency": "AUD",
2023-08-10 03:16:27 +02:00
"amount": 3044.98,
],
"accountType": "CHECKING",
"displayedName": "after David",
"createdDate": "2023-01-10T08:29:07Z",
"classification": "SMALL_BUSINESS",
"lastUpdated": "2023-08-01T23:50:13Z",
2023-08-10 03:16:27 +02:00
"nickname": "Business ",
"bankTransferCode": [
2023-08-10 03:16:27 +02:00
[
"id": "062",
"type": "BSB",
2023-08-10 03:16:27 +02:00
],
],
"dataset": [
2023-08-10 03:16:27 +02:00
[
"name": "BASIC_AGG_DATA",
"additionalStatus": "AVAILABLE_DATA_RETRIEVED",
"updateEligibility": "ALLOW_UPDATE",
"lastUpdated": "2023-08-01T23:49:53Z",
"lastUpdateAttempt": "2023-08-01T23:49:53Z",
"nextUpdateScheduled": "2023-08-03T14:45:14Z",
2023-08-10 03:16:27 +02:00
],
],
2023-08-10 03:16:27 +02:00
],
],
2023-08-10 03:16:27 +02:00
];
*/
class AccountSummary extends Data
{
2023-10-26 04:57:44 +02:00
public ?int $id;
2023-10-26 04:57:44 +02:00
#[MapInputName('CONTAINER')]
public ?string $account_type = '';
2023-10-26 04:57:44 +02:00
#[MapInputName('accountName')]
public ?string $account_name = '';
2023-10-26 04:57:44 +02:00
#[MapInputName('accountStatus')]
public ?string $account_status = '';
2023-10-26 04:57:44 +02:00
#[MapInputName('accountNumber')]
public ?string $account_number = '';
2023-10-26 04:57:44 +02:00
#[MapInputName('providerAccountId')]
public int $provider_account_id;
2023-10-26 04:57:44 +02:00
#[MapInputName('providerId')]
public ?string $provider_id = '';
2023-10-26 04:57:44 +02:00
#[MapInputName('providerName')]
public ?string $provider_name = '';
2023-10-26 04:57:44 +02:00
public ?string $nickname = '';
2023-10-26 04:57:44 +02:00
public ?float $current_balance = 0;
public ?string $account_currency = '';
2023-10-26 04:57:44 +02:00
public static function prepareForPipeline(Collection $properties) : Collection
{
2023-10-26 04:57:44 +02:00
$properties->put('current_balance', $properties['currentBalance']['amount'] ?? 0);
$properties->put('account_currency', $properties['currentBalance']['currency'] ?? 0);
2023-10-26 04:57:44 +02:00
return $properties;
}
}