1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Helpers/Bank/Yodlee/DTO/AccountSummary.php

111 lines
3.0 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 Spatie\LaravelData\Data;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Illuminate\Support\Collection;
/**
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
{
public ?int $id;
#[MapInputName('CONTAINER')]
2023-08-10 03:16:27 +02:00
public ?string $account_type = '';
#[MapInputName('accountName')]
2023-08-10 03:16:27 +02:00
public ?string $account_name = '';
#[MapInputName('accountStatus')]
2023-08-10 03:16:27 +02:00
public ?string $account_status = '';
#[MapInputName('accountNumber')]
2023-08-10 03:16:27 +02:00
public ?string $account_number = '';
#[MapInputName('providerAccountId')]
public int $provider_account_id;
#[MapInputName('providerId')]
2023-08-10 03:16:27 +02:00
public ?string $provider_id = '';
#[MapInputName('providerName')]
2023-08-10 03:16:27 +02:00
public ?string $provider_name = '';
2023-08-10 03:16:27 +02:00
public ?string $nickname = '';
2023-08-10 03:16:27 +02:00
public ?float $current_balance = 0;
public ?string $account_currency = '';
public static function prepareForPipeline(Collection $properties) : Collection
{
2023-08-10 03:16:27 +02:00
$properties->put('current_balance', $properties['currentBalance']['amount'] ?? 0);
$properties->put('account_currency', $properties['currentBalance']['currency'] ?? 0);
return $properties;
}
}