mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
🤖 Auto commit for release 'develop' on 2025-08-03
This commit is contained in:
@@ -66,24 +66,24 @@ class AccountTransformer extends AbstractTransformer
|
||||
}
|
||||
|
||||
// get account type:
|
||||
$accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $account->full_account_type));
|
||||
$liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $account->full_account_type));
|
||||
$liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
|
||||
$liabilityDirection = $account->meta['liability_direction'] ?? null;
|
||||
$accountRole = $this->getAccountRole($account, $accountType);
|
||||
$hasCurrencySettings = null !== $account->meta['currency'];
|
||||
$includeNetWorth = 1 === (int) ($account->meta['include_net_worth'] ?? 0);
|
||||
$longitude = $account->meta['location']['longitude'] ?? null;
|
||||
$latitude = $account->meta['location']['latitude'] ?? null;
|
||||
$zoomLevel = $account->meta['location']['zoom_level'] ?? null;
|
||||
$order = $account->order;
|
||||
$accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $account->full_account_type));
|
||||
$liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $account->full_account_type));
|
||||
$liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
|
||||
$liabilityDirection = $account->meta['liability_direction'] ?? null;
|
||||
$accountRole = $this->getAccountRole($account, $accountType);
|
||||
$hasCurrencySettings = null !== $account->meta['currency'];
|
||||
$includeNetWorth = 1 === (int) ($account->meta['include_net_worth'] ?? 0);
|
||||
$longitude = $account->meta['location']['longitude'] ?? null;
|
||||
$latitude = $account->meta['location']['latitude'] ?? null;
|
||||
$zoomLevel = $account->meta['location']['zoom_level'] ?? null;
|
||||
$order = $account->order;
|
||||
|
||||
// date (for balance etc.)
|
||||
$date = $this->getDate();
|
||||
$date = $this->getDate();
|
||||
$date->endOfDay();
|
||||
|
||||
// get primary currency as fallback:
|
||||
$currency = $this->primary; // assume primary currency
|
||||
$currency = $this->primary; // assume primary currency
|
||||
if ($hasCurrencySettings) {
|
||||
$currency = $account->meta['currency'];
|
||||
}
|
||||
@@ -95,8 +95,8 @@ class AccountTransformer extends AbstractTransformer
|
||||
|
||||
// get some listed information from the account meta-data:
|
||||
[$creditCardType, $monthlyPaymentDate] = $this->getCCInfo($account, $accountRole, $accountType);
|
||||
$openingBalanceDate = $this->getOpeningBalance($account, $accountType);
|
||||
[$interest, $interestPeriod] = $this->getInterest($account, $accountType);
|
||||
$openingBalanceDate = $this->getOpeningBalance($account, $accountType);
|
||||
[$interest, $interestPeriod] = $this->getInterest($account, $accountType);
|
||||
|
||||
return [
|
||||
'id' => (string) $account->id,
|
||||
@@ -125,33 +125,33 @@ class AccountTransformer extends AbstractTransformer
|
||||
'current_balance' => $account->meta['balances']['current_balance'],
|
||||
'pc_current_balance' => $account->meta['balances']['pc_current_balance'],
|
||||
|
||||
'opening_balance' => $account->meta['balances']['opening_balance'],
|
||||
'pc_opening_balance' => $account->meta['balances']['pc_opening_balance'],
|
||||
'opening_balance' => $account->meta['balances']['opening_balance'],
|
||||
'pc_opening_balance' => $account->meta['balances']['pc_opening_balance'],
|
||||
|
||||
'virtual_balance' => $account->meta['balances']['virtual_balance'],
|
||||
'pc_virtual_balance' => $account->meta['balances']['pc_virtual_balance'],
|
||||
'virtual_balance' => $account->meta['balances']['virtual_balance'],
|
||||
'pc_virtual_balance' => $account->meta['balances']['pc_virtual_balance'],
|
||||
|
||||
'debt_amount' => $account->meta['balances']['debt_amount'],
|
||||
'pc_debt_amount' => $account->meta['balances']['pc_debt_amount'],
|
||||
'debt_amount' => $account->meta['balances']['debt_amount'],
|
||||
'pc_debt_amount' => $account->meta['balances']['pc_debt_amount'],
|
||||
|
||||
'current_balance_date' => $date->toAtomString(),
|
||||
'notes' => $account->meta['notes'] ?? null,
|
||||
'monthly_payment_date' => $monthlyPaymentDate,
|
||||
'credit_card_type' => $creditCardType,
|
||||
'account_number' => $account->meta['account_number'] ?? null,
|
||||
'iban' => '' === $account->iban ? null : $account->iban,
|
||||
'bic' => $account->meta['BIC'] ?? null,
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type' => $liabilityType,
|
||||
'liability_direction' => $liabilityDirection,
|
||||
'interest' => $interest,
|
||||
'interest_period' => $interestPeriod,
|
||||
'include_net_worth' => $includeNetWorth,
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
'last_activity' => array_key_exists('last_activity', $account->meta) ? $account->meta['last_activity']->toAtomString() : null,
|
||||
'links' => [
|
||||
'current_balance_date' => $date->toAtomString(),
|
||||
'notes' => $account->meta['notes'] ?? null,
|
||||
'monthly_payment_date' => $monthlyPaymentDate,
|
||||
'credit_card_type' => $creditCardType,
|
||||
'account_number' => $account->meta['account_number'] ?? null,
|
||||
'iban' => '' === $account->iban ? null : $account->iban,
|
||||
'bic' => $account->meta['BIC'] ?? null,
|
||||
'opening_balance_date' => $openingBalanceDate,
|
||||
'liability_type' => $liabilityType,
|
||||
'liability_direction' => $liabilityDirection,
|
||||
'interest' => $interest,
|
||||
'interest_period' => $interestPeriod,
|
||||
'include_net_worth' => $includeNetWorth,
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
'last_activity' => array_key_exists('last_activity', $account->meta) ? $account->meta['last_activity']->toAtomString() : null,
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => sprintf('/accounts/%d', $account->id),
|
||||
@@ -193,7 +193,7 @@ class AccountTransformer extends AbstractTransformer
|
||||
if (null !== $monthlyPaymentDate) {
|
||||
// try classic date:
|
||||
if (10 === strlen($monthlyPaymentDate)) {
|
||||
$object = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'));
|
||||
$object = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'));
|
||||
if (!$object instanceof Carbon) {
|
||||
$object = today(config('app.timezone'));
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class AccountTransformer extends AbstractTransformer
|
||||
$openingBalanceDate = $account->meta['opening_balance_date'] ?? null;
|
||||
}
|
||||
if (null !== $openingBalanceDate) {
|
||||
$object = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'));
|
||||
$object = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'));
|
||||
if (!$object instanceof Carbon) {
|
||||
$object = today(config('app.timezone'));
|
||||
}
|
||||
|
@@ -58,17 +58,17 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
$pcAmount = app('steam')->bcround($availableBudget->native_amount, $this->primary->decimal_places);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => (string) $availableBudget->id,
|
||||
'created_at' => $availableBudget->created_at->toAtomString(),
|
||||
'updated_at' => $availableBudget->updated_at->toAtomString(),
|
||||
return [
|
||||
'id' => (string) $availableBudget->id,
|
||||
'created_at' => $availableBudget->created_at->toAtomString(),
|
||||
'updated_at' => $availableBudget->updated_at->toAtomString(),
|
||||
|
||||
// currencies according to 6.3.0
|
||||
'object_has_currency_setting' => true,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
|
||||
'primary_currency_id' => (string) $this->primary->id,
|
||||
'primary_currency_code' => $this->primary->code,
|
||||
@@ -76,23 +76,20 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
'primary_currency_decimal_places' => $this->primary->decimal_places,
|
||||
|
||||
|
||||
'amount' => $amount,
|
||||
'pc_amount' => $pcAmount,
|
||||
'start' => $availableBudget->start_date->toAtomString(),
|
||||
'end' => $availableBudget->end_date->endOfDay()->toAtomString(),
|
||||
'spent_in_budgets' => $availableBudget->meta['spent_in_budgets'],
|
||||
'pc_spent_in_budgets' => $availableBudget->meta['pc_spent_in_budgets'],
|
||||
'spent_outside_budgets' => $availableBudget->meta['spent_outside_budgets'],
|
||||
'pc_spent_outside_budgets' => $availableBudget->meta['pc_spent_outside_budgets'],
|
||||
'links' => [
|
||||
'amount' => $amount,
|
||||
'pc_amount' => $pcAmount,
|
||||
'start' => $availableBudget->start_date->toAtomString(),
|
||||
'end' => $availableBudget->end_date->endOfDay()->toAtomString(),
|
||||
'spent_in_budgets' => $availableBudget->meta['spent_in_budgets'],
|
||||
'pc_spent_in_budgets' => $availableBudget->meta['pc_spent_in_budgets'],
|
||||
'spent_outside_budgets' => $availableBudget->meta['spent_outside_budgets'],
|
||||
'pc_spent_outside_budgets' => $availableBudget->meta['pc_spent_outside_budgets'],
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/available_budgets/' . $availableBudget->id,
|
||||
'uri' => '/available_budgets/'.$availableBudget->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -52,17 +52,17 @@ class BillTransformer extends AbstractTransformer
|
||||
|
||||
|
||||
return [
|
||||
'id' => $bill->id,
|
||||
'created_at' => $bill->created_at->toAtomString(),
|
||||
'updated_at' => $bill->updated_at->toAtomString(),
|
||||
'name' => $bill->name,
|
||||
'id' => $bill->id,
|
||||
'created_at' => $bill->created_at->toAtomString(),
|
||||
'updated_at' => $bill->updated_at->toAtomString(),
|
||||
'name' => $bill->name,
|
||||
|
||||
// currencies according to 6.3.0
|
||||
'object_has_currency_setting' => true,
|
||||
'currency_id' => (string) $bill->transaction_currency_id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $bill->transaction_currency_id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
|
||||
'primary_currency_id' => (string) $this->primary->id,
|
||||
'primary_currency_code' => $this->primary->code,
|
||||
@@ -73,34 +73,34 @@ class BillTransformer extends AbstractTransformer
|
||||
'amount_min' => $bill->amounts['amount_min'],
|
||||
'pc_amount_min' => $bill->amounts['pc_amount_min'],
|
||||
|
||||
'amount_max' => $bill->amounts['amount_max'],
|
||||
'pc_amount_max' => $bill->amounts['pc_amount_max'],
|
||||
'amount_max' => $bill->amounts['amount_max'],
|
||||
'pc_amount_max' => $bill->amounts['pc_amount_max'],
|
||||
|
||||
'amount_avg' => $bill->amounts['average'],
|
||||
'pc_amount_avg' => $bill->amounts['pc_average'],
|
||||
'amount_avg' => $bill->amounts['average'],
|
||||
'pc_amount_avg' => $bill->amounts['pc_average'],
|
||||
|
||||
'date' => $bill->date->toAtomString(),
|
||||
'end_date' => $bill->end_date?->toAtomString(),
|
||||
'extension_date' => $bill->extension_date?->toAtomString(),
|
||||
'repeat_freq' => $bill->repeat_freq,
|
||||
'skip' => $bill->skip,
|
||||
'active' => $bill->active,
|
||||
'order' => $bill->order,
|
||||
'notes' => $bill->meta['notes'],
|
||||
'object_group_id' => $bill->meta['object_group_id'],
|
||||
'object_group_order' => $bill->meta['object_group_order'],
|
||||
'object_group_title' => $bill->meta['object_group_title'],
|
||||
'date' => $bill->date->toAtomString(),
|
||||
'end_date' => $bill->end_date?->toAtomString(),
|
||||
'extension_date' => $bill->extension_date?->toAtomString(),
|
||||
'repeat_freq' => $bill->repeat_freq,
|
||||
'skip' => $bill->skip,
|
||||
'active' => $bill->active,
|
||||
'order' => $bill->order,
|
||||
'notes' => $bill->meta['notes'],
|
||||
'object_group_id' => $bill->meta['object_group_id'],
|
||||
'object_group_order' => $bill->meta['object_group_order'],
|
||||
'object_group_title' => $bill->meta['object_group_title'],
|
||||
|
||||
|
||||
'paid_dates' => $bill->meta['paid_dates'],
|
||||
'pay_dates' => $bill->meta['pay_dates'],
|
||||
'next_expected_match' => $bill->meta['nem']?->toAtomString(),
|
||||
'next_expected_match_diff' => $bill->meta['nem_diff'],
|
||||
'paid_dates' => $bill->meta['paid_dates'],
|
||||
'pay_dates' => $bill->meta['pay_dates'],
|
||||
'next_expected_match' => $bill->meta['nem']?->toAtomString(),
|
||||
'next_expected_match_diff' => $bill->meta['nem_diff'],
|
||||
|
||||
'links' => [
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/bills/' . $bill->id,
|
||||
'uri' => '/bills/'.$bill->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@@ -94,7 +94,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/transactions/' . $first['transaction_group_id'],
|
||||
'uri' => '/transactions/'.$first['transaction_group_id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -117,8 +117,8 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
private function transformTransaction(array $transaction): array
|
||||
{
|
||||
// amount:
|
||||
$amount = Steam::positive((string) ($transaction['amount'] ?? '0'));
|
||||
$foreignAmount = null;
|
||||
$amount = Steam::positive((string) ($transaction['amount'] ?? '0'));
|
||||
$foreignAmount = null;
|
||||
if (null !== $transaction['foreign_amount'] && '' !== $transaction['foreign_amount'] && 0 !== bccomp('0', (string) $transaction['foreign_amount'])) {
|
||||
$foreignAmount = Steam::positive($transaction['foreign_amount']);
|
||||
}
|
||||
@@ -131,7 +131,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
if (array_key_exists('pc_amount', $transaction) && null !== $transaction['pc_amount']) {
|
||||
$transaction['pc_amount'] = Steam::positive($transaction['pc_amount']);
|
||||
}
|
||||
$type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionTypeEnum::WITHDRAWAL->value);
|
||||
$type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionTypeEnum::WITHDRAWAL->value);
|
||||
|
||||
// must be 0 (int) or NULL
|
||||
$recurrenceTotal = $transaction['meta']['recurrence_total'] ?? null;
|
||||
@@ -140,20 +140,20 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
$recurrenceCount = null !== $recurrenceCount ? (int) $recurrenceCount : null;
|
||||
|
||||
return [
|
||||
'user' => (string) $transaction['user_id'],
|
||||
'transaction_journal_id' => (string) $transaction['transaction_journal_id'],
|
||||
'type' => strtolower((string) $type),
|
||||
'date' => $transaction['date']->toAtomString(),
|
||||
'order' => $transaction['order'],
|
||||
'user' => (string) $transaction['user_id'],
|
||||
'transaction_journal_id' => (string) $transaction['transaction_journal_id'],
|
||||
'type' => strtolower((string) $type),
|
||||
'date' => $transaction['date']->toAtomString(),
|
||||
'order' => $transaction['order'],
|
||||
|
||||
// currency information, structured for 6.3.0.
|
||||
'object_has_currency_setting' => true,
|
||||
'object_has_currency_setting' => true,
|
||||
|
||||
'currency_id' => (string) $transaction['currency_id'],
|
||||
'currency_code' => $transaction['currency_code'],
|
||||
'currency_name' => $transaction['currency_name'],
|
||||
'currency_symbol' => $transaction['currency_symbol'],
|
||||
'currency_decimal_places' => (int) $transaction['currency_decimal_places'],
|
||||
'currency_id' => (string) $transaction['currency_id'],
|
||||
'currency_code' => $transaction['currency_code'],
|
||||
'currency_name' => $transaction['currency_name'],
|
||||
'currency_symbol' => $transaction['currency_symbol'],
|
||||
'currency_decimal_places' => (int) $transaction['currency_decimal_places'],
|
||||
|
||||
'foreign_currency_id' => $this->stringFromArray($transaction, 'foreign_currency_id', null),
|
||||
'foreign_currency_code' => $transaction['foreign_currency_code'],
|
||||
@@ -171,76 +171,76 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'amount' => $amount,
|
||||
'pc_amount' => $transaction['pc_amount'] ?? null,
|
||||
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'pc_foreign_amount' => null,
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'pc_foreign_amount' => null,
|
||||
|
||||
'source_balance_after' => $transaction['source_balance_after'] ?? null,
|
||||
'pc_source_balance_after' => null,
|
||||
'source_balance_after' => $transaction['source_balance_after'] ?? null,
|
||||
'pc_source_balance_after' => null,
|
||||
|
||||
// destination balance after
|
||||
'destination_balance_after' => $transaction['destination_balance_after'] ?? null,
|
||||
'pc_destination_balance_after' => null,
|
||||
'destination_balance_after' => $transaction['destination_balance_after'] ?? null,
|
||||
'pc_destination_balance_after' => null,
|
||||
|
||||
'source_balance_dirty' => $transaction['source_balance_dirty'],
|
||||
'destination_balance_dirty' => $transaction['destination_balance_dirty'],
|
||||
'source_balance_dirty' => $transaction['source_balance_dirty'],
|
||||
'destination_balance_dirty' => $transaction['destination_balance_dirty'],
|
||||
|
||||
'description' => $transaction['description'],
|
||||
'description' => $transaction['description'],
|
||||
|
||||
'source_id' => (string) $transaction['source_account_id'],
|
||||
'source_name' => $transaction['source_account_name'],
|
||||
'source_iban' => $transaction['source_account_iban'],
|
||||
'source_type' => $transaction['source_account_type'],
|
||||
'source_id' => (string) $transaction['source_account_id'],
|
||||
'source_name' => $transaction['source_account_name'],
|
||||
'source_iban' => $transaction['source_account_iban'],
|
||||
'source_type' => $transaction['source_account_type'],
|
||||
|
||||
'destination_id' => (string) $transaction['destination_account_id'],
|
||||
'destination_name' => $transaction['destination_account_name'],
|
||||
'destination_iban' => $transaction['destination_account_iban'],
|
||||
'destination_type' => $transaction['destination_account_type'],
|
||||
'destination_id' => (string) $transaction['destination_account_id'],
|
||||
'destination_name' => $transaction['destination_account_name'],
|
||||
'destination_iban' => $transaction['destination_account_iban'],
|
||||
'destination_type' => $transaction['destination_account_type'],
|
||||
|
||||
'budget_id' => $this->stringFromArray($transaction, 'budget_id', null),
|
||||
'budget_name' => $transaction['budget_name'],
|
||||
'budget_id' => $this->stringFromArray($transaction, 'budget_id', null),
|
||||
'budget_name' => $transaction['budget_name'],
|
||||
|
||||
'category_id' => $this->stringFromArray($transaction, 'category_id', null),
|
||||
'category_name' => $transaction['category_name'],
|
||||
'category_id' => $this->stringFromArray($transaction, 'category_id', null),
|
||||
'category_name' => $transaction['category_name'],
|
||||
|
||||
'bill_id' => $this->stringFromArray($transaction, 'bill_id', null),
|
||||
'bill_name' => $transaction['bill_name'],
|
||||
'subscription_id' => $this->stringFromArray($transaction, 'bill_id', null),
|
||||
'subscription_name' => $transaction['bill_name'],
|
||||
'bill_id' => $this->stringFromArray($transaction, 'bill_id', null),
|
||||
'bill_name' => $transaction['bill_name'],
|
||||
'subscription_id' => $this->stringFromArray($transaction, 'bill_id', null),
|
||||
'subscription_name' => $transaction['bill_name'],
|
||||
|
||||
'reconciled' => $transaction['reconciled'],
|
||||
'notes' => $transaction['notes'],
|
||||
'tags' => $transaction['tags'],
|
||||
'reconciled' => $transaction['reconciled'],
|
||||
'notes' => $transaction['notes'],
|
||||
'tags' => $transaction['tags'],
|
||||
|
||||
'internal_reference' => $transaction['meta']['internal_reference'] ?? null,
|
||||
'external_id' => $transaction['meta']['external_id'] ?? null,
|
||||
'original_source' => $transaction['meta']['original_source'] ?? null,
|
||||
'recurrence_id' => $transaction['meta']['recurrence_id'] ?? null,
|
||||
'recurrence_total' => $recurrenceTotal,
|
||||
'recurrence_count' => $recurrenceCount,
|
||||
'external_url' => $transaction['meta']['external_url'] ?? null,
|
||||
'import_hash_v2' => $transaction['meta']['import_hash_v2'] ?? null,
|
||||
'internal_reference' => $transaction['meta']['internal_reference'] ?? null,
|
||||
'external_id' => $transaction['meta']['external_id'] ?? null,
|
||||
'original_source' => $transaction['meta']['original_source'] ?? null,
|
||||
'recurrence_id' => $transaction['meta']['recurrence_id'] ?? null,
|
||||
'recurrence_total' => $recurrenceTotal,
|
||||
'recurrence_count' => $recurrenceCount,
|
||||
'external_url' => $transaction['meta']['external_url'] ?? null,
|
||||
'import_hash_v2' => $transaction['meta']['import_hash_v2'] ?? null,
|
||||
|
||||
'sepa_cc' => $transaction['meta']['sepa_cc'] ?? null,
|
||||
'sepa_ct_op' => $transaction['meta']['sepa_ct_op'] ?? null,
|
||||
'sepa_ct_id' => $transaction['meta']['sepa_ct_id'] ?? null,
|
||||
'sepa_db' => $transaction['meta']['sepa_db'] ?? null,
|
||||
'sepa_country' => $transaction['meta']['sepa_country'] ?? null,
|
||||
'sepa_ep' => $transaction['meta']['sepa_ep'] ?? null,
|
||||
'sepa_ci' => $transaction['meta']['sepa_ci'] ?? null,
|
||||
'sepa_batch_id' => $transaction['meta']['sepa_batch_id'] ?? null,
|
||||
'sepa_cc' => $transaction['meta']['sepa_cc'] ?? null,
|
||||
'sepa_ct_op' => $transaction['meta']['sepa_ct_op'] ?? null,
|
||||
'sepa_ct_id' => $transaction['meta']['sepa_ct_id'] ?? null,
|
||||
'sepa_db' => $transaction['meta']['sepa_db'] ?? null,
|
||||
'sepa_country' => $transaction['meta']['sepa_country'] ?? null,
|
||||
'sepa_ep' => $transaction['meta']['sepa_ep'] ?? null,
|
||||
'sepa_ci' => $transaction['meta']['sepa_ci'] ?? null,
|
||||
'sepa_batch_id' => $transaction['meta']['sepa_batch_id'] ?? null,
|
||||
|
||||
'interest_date' => array_key_exists('interest_date', $transaction['meta_date']) ? $transaction['meta_date']['interest_date']->toW3CString() : null,
|
||||
'book_date' => array_key_exists('book_date', $transaction['meta_date']) ? $transaction['meta_date']['book_date']->toW3CString() : null,
|
||||
'process_date' => array_key_exists('process_date', $transaction['meta_date']) ? $transaction['meta_date']['process_date']->toW3CString() : null,
|
||||
'due_date' => array_key_exists('due_date', $transaction['meta_date']) ? $transaction['meta_date']['due_date']->toW3CString() : null,
|
||||
'payment_date' => array_key_exists('payment_date', $transaction['meta_date']) ? $transaction['meta_date']['payment_date']->toW3CString() : null,
|
||||
'invoice_date' => array_key_exists('invoice_date', $transaction['meta_date']) ? $transaction['meta_date']['invoice_date']->toW3CString() : null,
|
||||
'interest_date' => array_key_exists('interest_date', $transaction['meta_date']) ? $transaction['meta_date']['interest_date']->toW3CString() : null,
|
||||
'book_date' => array_key_exists('book_date', $transaction['meta_date']) ? $transaction['meta_date']['book_date']->toW3CString() : null,
|
||||
'process_date' => array_key_exists('process_date', $transaction['meta_date']) ? $transaction['meta_date']['process_date']->toW3CString() : null,
|
||||
'due_date' => array_key_exists('due_date', $transaction['meta_date']) ? $transaction['meta_date']['due_date']->toW3CString() : null,
|
||||
'payment_date' => array_key_exists('payment_date', $transaction['meta_date']) ? $transaction['meta_date']['payment_date']->toW3CString() : null,
|
||||
'invoice_date' => array_key_exists('invoice_date', $transaction['meta_date']) ? $transaction['meta_date']['invoice_date']->toW3CString() : null,
|
||||
|
||||
// location data
|
||||
'longitude' => $transaction['location']['longitude'],
|
||||
'latitude' => $transaction['location']['latitude'],
|
||||
'zoom_level' => $transaction['location']['zoom_level'],
|
||||
'has_attachments' => $transaction['attachment_count'] > 0,
|
||||
'longitude' => $transaction['location']['longitude'],
|
||||
'latitude' => $transaction['location']['latitude'],
|
||||
'zoom_level' => $transaction['location']['zoom_level'],
|
||||
'has_attachments' => $transaction['attachment_count'] > 0,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/transactions/' . $group->id,
|
||||
'uri' => '/transactions/'.$group->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -338,10 +338,10 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
$foreignAmount = Steam::bcround($foreignAmount, $foreignCurrency['decimal_places'] ?? 0);
|
||||
}
|
||||
|
||||
$longitude = null;
|
||||
$latitude = null;
|
||||
$zoomLevel = null;
|
||||
$location = $this->getLocation($journal);
|
||||
$longitude = null;
|
||||
$latitude = null;
|
||||
$zoomLevel = null;
|
||||
$location = $this->getLocation($journal);
|
||||
if ($location instanceof Location) {
|
||||
$longitude = $location->longitude;
|
||||
$latitude = $location->latitude;
|
||||
@@ -349,77 +349,77 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
}
|
||||
|
||||
return [
|
||||
'user' => $journal->user_id,
|
||||
'transaction_journal_id' => (string) $journal->id,
|
||||
'type' => strtolower((string) $type),
|
||||
'date' => $journal->date->toAtomString(),
|
||||
'order' => $journal->order,
|
||||
'user' => $journal->user_id,
|
||||
'transaction_journal_id' => (string) $journal->id,
|
||||
'type' => strtolower((string) $type),
|
||||
'date' => $journal->date->toAtomString(),
|
||||
'order' => $journal->order,
|
||||
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
'currency_id' => (string) $currency->id,
|
||||
'currency_code' => $currency->code,
|
||||
'currency_symbol' => $currency->symbol,
|
||||
'currency_decimal_places' => $currency->decimal_places,
|
||||
|
||||
'foreign_currency_id' => (string) $foreignCurrency['id'],
|
||||
'foreign_currency_code' => $foreignCurrency['code'],
|
||||
'foreign_currency_symbol' => $foreignCurrency['symbol'],
|
||||
'foreign_currency_decimal_places' => $foreignCurrency['decimal_places'],
|
||||
|
||||
'amount' => Steam::bcround($amount, $currency->decimal_places),
|
||||
'foreign_amount' => $foreignAmount,
|
||||
'amount' => Steam::bcround($amount, $currency->decimal_places),
|
||||
'foreign_amount' => $foreignAmount,
|
||||
|
||||
'description' => $journal->description,
|
||||
'description' => $journal->description,
|
||||
|
||||
'source_id' => (string) $source->account_id,
|
||||
'source_name' => $source->account->name,
|
||||
'source_iban' => $source->account->iban,
|
||||
'source_type' => $source->account->accountType->type,
|
||||
'source_id' => (string) $source->account_id,
|
||||
'source_name' => $source->account->name,
|
||||
'source_iban' => $source->account->iban,
|
||||
'source_type' => $source->account->accountType->type,
|
||||
|
||||
'destination_id' => (string) $destination->account_id,
|
||||
'destination_name' => $destination->account->name,
|
||||
'destination_iban' => $destination->account->iban,
|
||||
'destination_type' => $destination->account->accountType->type,
|
||||
'destination_id' => (string) $destination->account_id,
|
||||
'destination_name' => $destination->account->name,
|
||||
'destination_iban' => $destination->account->iban,
|
||||
'destination_type' => $destination->account->accountType->type,
|
||||
|
||||
'budget_id' => (string) $budget['id'],
|
||||
'budget_name' => $budget['name'],
|
||||
'budget_id' => (string) $budget['id'],
|
||||
'budget_name' => $budget['name'],
|
||||
|
||||
'category_id' => (string) $category['id'],
|
||||
'category_name' => $category['name'],
|
||||
'category_id' => (string) $category['id'],
|
||||
'category_name' => $category['name'],
|
||||
|
||||
'bill_id' => (string) $bill['id'],
|
||||
'bill_name' => $bill['name'],
|
||||
'bill_id' => (string) $bill['id'],
|
||||
'bill_name' => $bill['name'],
|
||||
|
||||
'reconciled' => $source->reconciled,
|
||||
'notes' => $this->groupRepos->getNoteText($journal->id),
|
||||
'tags' => $this->groupRepos->getTags($journal->id),
|
||||
'reconciled' => $source->reconciled,
|
||||
'notes' => $this->groupRepos->getNoteText($journal->id),
|
||||
'tags' => $this->groupRepos->getTags($journal->id),
|
||||
|
||||
'internal_reference' => $metaFieldData['internal_reference'],
|
||||
'external_id' => $metaFieldData['external_id'],
|
||||
'original_source' => $metaFieldData['original_source'],
|
||||
'recurrence_id' => $metaFieldData['recurrence_id'],
|
||||
'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
|
||||
'import_hash_v2' => $metaFieldData['import_hash_v2'],
|
||||
'internal_reference' => $metaFieldData['internal_reference'],
|
||||
'external_id' => $metaFieldData['external_id'],
|
||||
'original_source' => $metaFieldData['original_source'],
|
||||
'recurrence_id' => $metaFieldData['recurrence_id'],
|
||||
'bunq_payment_id' => $metaFieldData['bunq_payment_id'],
|
||||
'import_hash_v2' => $metaFieldData['import_hash_v2'],
|
||||
|
||||
'sepa_cc' => $metaFieldData['sepa_cc'],
|
||||
'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
|
||||
'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
|
||||
'sepa_db' => $metaFieldData['sepa_db'],
|
||||
'sepa_country' => $metaFieldData['sepa_country'],
|
||||
'sepa_ep' => $metaFieldData['sepa_ep'],
|
||||
'sepa_ci' => $metaFieldData['sepa_ci'],
|
||||
'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
|
||||
'sepa_cc' => $metaFieldData['sepa_cc'],
|
||||
'sepa_ct_op' => $metaFieldData['sepa_ct_op'],
|
||||
'sepa_ct_id' => $metaFieldData['sepa_ct_id'],
|
||||
'sepa_db' => $metaFieldData['sepa_db'],
|
||||
'sepa_country' => $metaFieldData['sepa_country'],
|
||||
'sepa_ep' => $metaFieldData['sepa_ep'],
|
||||
'sepa_ci' => $metaFieldData['sepa_ci'],
|
||||
'sepa_batch_id' => $metaFieldData['sepa_batch_id'],
|
||||
|
||||
'interest_date' => $metaDates['interest_date'],
|
||||
'book_date' => $metaDates['book_date'],
|
||||
'process_date' => $metaDates['process_date'],
|
||||
'due_date' => $metaDates['due_date'],
|
||||
'payment_date' => $metaDates['payment_date'],
|
||||
'invoice_date' => $metaDates['invoice_date'],
|
||||
'interest_date' => $metaDates['interest_date'],
|
||||
'book_date' => $metaDates['book_date'],
|
||||
'process_date' => $metaDates['process_date'],
|
||||
'due_date' => $metaDates['due_date'],
|
||||
'payment_date' => $metaDates['payment_date'],
|
||||
'invoice_date' => $metaDates['invoice_date'],
|
||||
|
||||
// location data
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
'longitude' => $longitude,
|
||||
'latitude' => $latitude,
|
||||
'zoom_level' => $zoomLevel,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
|
||||
private function getForeignCurrency(?TransactionCurrency $currency): array
|
||||
{
|
||||
$array = [
|
||||
$array = [
|
||||
'id' => null,
|
||||
'code' => null,
|
||||
'symbol' => null,
|
||||
@@ -513,7 +513,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
|
||||
private function getBudget(?Budget $budget): array
|
||||
{
|
||||
$array = [
|
||||
$array = [
|
||||
'id' => null,
|
||||
'name' => null,
|
||||
];
|
||||
@@ -528,7 +528,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
|
||||
private function getCategory(?Category $category): array
|
||||
{
|
||||
$array = [
|
||||
$array = [
|
||||
'id' => null,
|
||||
'name' => null,
|
||||
];
|
||||
@@ -543,7 +543,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
|
||||
private function getBill(?Bill $bill): array
|
||||
{
|
||||
$array = [
|
||||
$array = [
|
||||
'id' => null,
|
||||
'name' => null,
|
||||
];
|
||||
|
Reference in New Issue
Block a user