mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Test every happy path for journal creation.
This commit is contained in:
parent
94a7b6b9bd
commit
77aced6734
@ -32,6 +32,7 @@ use Illuminate\Validation\Validator;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* todo cannot submit using currency not part of source / dest
|
||||||
* Class TransactionRequest
|
* Class TransactionRequest
|
||||||
*/
|
*/
|
||||||
class TransactionRequest extends Request
|
class TransactionRequest extends Request
|
||||||
@ -75,7 +76,7 @@ class TransactionRequest extends Request
|
|||||||
'transactions' => [],
|
'transactions' => [],
|
||||||
|
|
||||||
];
|
];
|
||||||
foreach ($this->get('transactions') as $transaction) {
|
foreach ($this->get('transactions') as $index => $transaction) {
|
||||||
$array = [
|
$array = [
|
||||||
'description' => $transaction['description'] ?? null,
|
'description' => $transaction['description'] ?? null,
|
||||||
'amount' => $transaction['amount'],
|
'amount' => $transaction['amount'],
|
||||||
@ -92,11 +93,12 @@ class TransactionRequest extends Request
|
|||||||
'source_name' => $transaction['source_name'] ?? null,
|
'source_name' => $transaction['source_name'] ?? null,
|
||||||
'destination_id' => isset($transaction['destination_id']) ? intval($transaction['destination_id']) : null,
|
'destination_id' => isset($transaction['destination_id']) ? intval($transaction['destination_id']) : null,
|
||||||
'destination_name' => $transaction['destination_name'] ?? null,
|
'destination_name' => $transaction['destination_name'] ?? null,
|
||||||
'reconciled' => intval($transaction['reconciled'] ?? 0) === 1 ? true : false,
|
'reconciled' => $transaction['reconciled'] ?? false,
|
||||||
'identifier' => isset($transaction['identifier']) ? intval($transaction['identifier']) : 0,
|
'identifier' => $index,
|
||||||
];
|
];
|
||||||
$data['transactions'][] = $array;
|
$data['transactions'][] = $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +141,6 @@ class TransactionRequest extends Request
|
|||||||
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser],
|
'transactions.*.category_id' => ['mustExist:categories,id', new BelongsUser],
|
||||||
'transactions.*.category_name' => 'between:1,255|nullable',
|
'transactions.*.category_name' => 'between:1,255|nullable',
|
||||||
'transactions.*.reconciled' => 'boolean|nullable',
|
'transactions.*.reconciled' => 'boolean|nullable',
|
||||||
'transactions.*.identifier' => 'numeric|nullable',
|
|
||||||
// basic rules will be expanded later.
|
// basic rules will be expanded later.
|
||||||
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
|
||||||
'transactions.*.source_name' => 'between:1,255|nullable',
|
'transactions.*.source_name' => 'between:1,255|nullable',
|
||||||
|
@ -25,12 +25,15 @@ namespace FireflyIII\Factory;
|
|||||||
|
|
||||||
use FireflyIII\Models\Tag;
|
use FireflyIII\Models\Tag;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TagFactory
|
* Class TagFactory
|
||||||
*/
|
*/
|
||||||
class TagFactory
|
class TagFactory
|
||||||
{
|
{
|
||||||
|
/** @var Collection */
|
||||||
|
private $tags;
|
||||||
/** @var User */
|
/** @var User */
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
@ -42,14 +45,6 @@ class TagFactory
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param User $user
|
|
||||||
*/
|
|
||||||
public function setUser(User $user): void
|
|
||||||
{
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
@ -59,14 +54,56 @@ class TagFactory
|
|||||||
{
|
{
|
||||||
return Tag::create(
|
return Tag::create(
|
||||||
[
|
[
|
||||||
'user_id' => $data['user']->id,
|
'user_id' => $this->user->id,
|
||||||
'tag' => $data['tag'],
|
'tag' => $data['tag'],
|
||||||
'tagMode' => 'nothing',
|
'tagMode' => 'nothing',
|
||||||
'date' => $data['date'],
|
'date' => $data['date'],
|
||||||
'description'=> $data['description'],
|
'description' => $data['description'],
|
||||||
|
'latitude' => $data['latitude'],
|
||||||
|
'longitude ' => $data['longitude'],
|
||||||
|
'zoomLevel' => $data['zoom_level'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tag
|
||||||
|
*
|
||||||
|
* @return Tag|null
|
||||||
|
*/
|
||||||
|
public function findOrCreate(string $tag): ?Tag
|
||||||
|
{
|
||||||
|
if (is_null($this->tags)) {
|
||||||
|
$this->tags = $this->user->tags()->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var Tag $object */
|
||||||
|
foreach ($this->tags as $object) {
|
||||||
|
if ($object->tag === $tag) {
|
||||||
|
return $object;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$newTag = $this->create(
|
||||||
|
[
|
||||||
|
'tag' => $tag,
|
||||||
|
'date' => null,
|
||||||
|
'description' => null,
|
||||||
|
'latitude' => null,
|
||||||
|
'longitude' => null,
|
||||||
|
'zoom_level' => null,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
$this->tags->push($newTag);
|
||||||
|
|
||||||
|
return $newTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public function setUser(User $user): void
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -78,7 +78,6 @@ class TransactionFactory
|
|||||||
*/
|
*/
|
||||||
public function create(array $data): Transaction
|
public function create(array $data): Transaction
|
||||||
{
|
{
|
||||||
$foreignCurrencyId = is_null($data['foreign_currency']) ? null : $data['foreign_currency']->id;
|
|
||||||
$values = [
|
$values = [
|
||||||
'reconciled' => $data['reconciled'],
|
'reconciled' => $data['reconciled'],
|
||||||
'account_id' => $data['account']->id,
|
'account_id' => $data['account']->id,
|
||||||
@ -87,14 +86,10 @@ class TransactionFactory
|
|||||||
'transaction_currency_id' => $data['currency']->id,
|
'transaction_currency_id' => $data['currency']->id,
|
||||||
'amount' => $data['amount'],
|
'amount' => $data['amount'],
|
||||||
'foreign_amount' => $data['foreign_amount'],
|
'foreign_amount' => $data['foreign_amount'],
|
||||||
'foreign_currency_id' => $foreignCurrencyId,
|
'foreign_currency_id' => null,
|
||||||
'identifier' => $data['identifier'],
|
'identifier' => $data['identifier'],
|
||||||
];
|
];
|
||||||
$transaction = $this->repository->storeBasicTransaction($values);
|
$transaction = $this->repository->storeBasicTransaction($values);
|
||||||
|
|
||||||
// todo: add budget, category, etc.
|
|
||||||
// todo link budget, category
|
|
||||||
|
|
||||||
return $transaction;
|
return $transaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,38 +115,52 @@ class TransactionFactory
|
|||||||
// same for destination account:
|
// same for destination account:
|
||||||
$destinationType = $this->accountType($journal, 'destination');
|
$destinationType = $this->accountType($journal, 'destination');
|
||||||
$destinationAccount = $this->findAccount($destinationType, $data['destination_id'], $data['destination_name']);
|
$destinationAccount = $this->findAccount($destinationType, $data['destination_id'], $data['destination_name']);
|
||||||
|
|
||||||
// first make a "negative" (source) transaction based on the data in the array.
|
// first make a "negative" (source) transaction based on the data in the array.
|
||||||
$sourceTransactionData = [
|
$source = $this->create(
|
||||||
|
[
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'amount' => app('steam')->negative(strval($data['amount'])),
|
'amount' => app('steam')->negative(strval($data['amount'])),
|
||||||
'foreign_amount' => null,
|
'foreign_amount' => null,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'foreign_currency' => null,
|
|
||||||
'budget' => null,
|
|
||||||
'category' => null,
|
|
||||||
'account' => $sourceAccount,
|
'account' => $sourceAccount,
|
||||||
'transaction_journal' => $journal,
|
'transaction_journal' => $journal,
|
||||||
'reconciled' => $data['reconciled'],
|
'reconciled' => $data['reconciled'],
|
||||||
'identifier' => $data['identifier'],
|
'identifier' => $data['identifier'],
|
||||||
];
|
]
|
||||||
$source = $this->create($sourceTransactionData);
|
);
|
||||||
|
|
||||||
// then make a "positive" transaction based on the data in the array.
|
// then make a "positive" transaction based on the data in the array.
|
||||||
$destTransactionData = [
|
$dest = $this->create(
|
||||||
'description' => $sourceTransactionData['description'],
|
[
|
||||||
|
'description' => $description,
|
||||||
'amount' => app('steam')->positive(strval($data['amount'])),
|
'amount' => app('steam')->positive(strval($data['amount'])),
|
||||||
'foreign_amount' => null,
|
'foreign_amount' => null,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
'foreign_currency' => null,
|
|
||||||
'budget' => null,
|
|
||||||
'category' => null,
|
|
||||||
'account' => $destinationAccount,
|
'account' => $destinationAccount,
|
||||||
'transaction_journal' => $journal,
|
'transaction_journal' => $journal,
|
||||||
'reconciled' => $data['reconciled'],
|
'reconciled' => $data['reconciled'],
|
||||||
'identifier' => $data['identifier'],
|
'identifier' => $data['identifier'],
|
||||||
];
|
]
|
||||||
$dest = $this->create($destTransactionData);
|
);
|
||||||
|
// set foreign currency
|
||||||
|
$foreign = $this->findCurrency($data['foreign_currency_id'], $data['foreign_currency_code']);
|
||||||
|
$this->setForeignCurrency($source, $foreign);
|
||||||
|
$this->setForeignCurrency($dest, $foreign);
|
||||||
|
|
||||||
|
// set foreign amount:
|
||||||
|
if (!is_null($data['foreign_amount'])) {
|
||||||
|
$this->setForeignAmount($source, app('steam')->negative(strval($data['foreign_amount'])));
|
||||||
|
$this->setForeignAmount($dest, app('steam')->positive(strval($data['foreign_amount'])));
|
||||||
|
}
|
||||||
|
|
||||||
|
// set budget:
|
||||||
|
$budget = $this->findBudget($data['budget_id'], $data['budget_name']);
|
||||||
|
$this->setBudget($source, $budget);
|
||||||
|
$this->setBudget($dest, $budget);
|
||||||
|
|
||||||
|
// set category
|
||||||
|
$category = $this->findCategory($data['category_id'], $data['category_name']);
|
||||||
|
$this->setCategory($source, $category);
|
||||||
|
$this->setCategory($dest, $category);
|
||||||
|
|
||||||
return new Collection([$source, $dest]);
|
return new Collection([$source, $dest]);
|
||||||
}
|
}
|
||||||
@ -356,4 +365,57 @@ class TransactionFactory
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Transaction $transaction
|
||||||
|
* @param Budget|null $budget
|
||||||
|
*/
|
||||||
|
protected function setBudget(Transaction $transaction, ?Budget $budget): void
|
||||||
|
{
|
||||||
|
if (is_null($budget)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$transaction->budgets()->save($budget);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Transaction $transaction
|
||||||
|
* @param Category|null $category
|
||||||
|
*/
|
||||||
|
protected function setCategory(Transaction $transaction, ?Category $category): void
|
||||||
|
{
|
||||||
|
if (is_null($category)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$transaction->categories()->save($category);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Transaction $transaction
|
||||||
|
* @param string $amount
|
||||||
|
*/
|
||||||
|
protected function setForeignAmount(Transaction $transaction, string $amount): void
|
||||||
|
{
|
||||||
|
$transaction->foreign_amount = $amount;
|
||||||
|
$transaction->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Transaction $transaction
|
||||||
|
* @param TransactionCurrency|null $currency
|
||||||
|
*/
|
||||||
|
protected function setForeignCurrency(Transaction $transaction, ?TransactionCurrency $currency): void
|
||||||
|
{
|
||||||
|
if (is_null($currency)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$transaction->foreign_currency_id = $currency->id;
|
||||||
|
$transaction->save();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
@ -25,6 +25,7 @@ namespace FireflyIII\Factory;
|
|||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
@ -95,11 +96,31 @@ class TransactionJournalFactory
|
|||||||
|
|
||||||
/** @var array $trData */
|
/** @var array $trData */
|
||||||
foreach ($data['transactions'] as $trData) {
|
foreach ($data['transactions'] as $trData) {
|
||||||
$trData['reconciled'] = $data['reconciled'] ?? false;
|
|
||||||
$factory->createPair($journal, $trData);
|
$factory->createPair($journal, $trData);
|
||||||
}
|
}
|
||||||
$this->repository->markCompleted($journal);
|
$this->repository->markCompleted($journal);
|
||||||
|
|
||||||
|
// link bill:
|
||||||
|
$this->connectBill($journal, $data);
|
||||||
|
|
||||||
|
// link piggy bank:
|
||||||
|
$this->connectPiggyBank($journal, $data);
|
||||||
|
|
||||||
|
// link tags:
|
||||||
|
$this->connectTags($journal, $data);
|
||||||
|
|
||||||
|
// store note:
|
||||||
|
$this->storeNote($journal, $data['notes']);
|
||||||
|
|
||||||
|
// store date meta fields (if present):
|
||||||
|
$this->storeMeta($journal, $data, 'interest_date');
|
||||||
|
$this->storeMeta($journal, $data, 'book_date');
|
||||||
|
$this->storeMeta($journal, $data, 'process_date');
|
||||||
|
$this->storeMeta($journal, $data, 'due_date');
|
||||||
|
$this->storeMeta($journal, $data, 'payment_date');
|
||||||
|
$this->storeMeta($journal, $data, 'invoice_date');
|
||||||
|
$this->storeMeta($journal, $data, 'internal_reference');
|
||||||
|
|
||||||
return $journal;
|
return $journal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +137,49 @@ class TransactionJournalFactory
|
|||||||
$this->piggyRepository->setUser($user);
|
$this->piggyRepository->setUser($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect bill if present.
|
||||||
|
*
|
||||||
|
* @param TransactionJournal $journal
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
protected function connectBill(TransactionJournal $journal, array $data): void
|
||||||
|
{
|
||||||
|
$bill = $this->findBill($data['bill_id'], $data['bill_name']);
|
||||||
|
if (!is_null($bill)) {
|
||||||
|
$journal->bill_id = $bill->id;
|
||||||
|
$journal->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TransactionJournal $journal
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
protected function connectPiggyBank(TransactionJournal $journal, array $data): void
|
||||||
|
{
|
||||||
|
$piggyBank = $this->findPiggyBank($data['piggy_bank_id'], $data['piggy_bank_name']);
|
||||||
|
if (!is_null($piggyBank)) {
|
||||||
|
/** @var PiggyBankEventFactory $factory */
|
||||||
|
$factory = app(PiggyBankEventFactory::class);
|
||||||
|
$factory->create($journal, $piggyBank);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TransactionJournal $journal
|
||||||
|
* @param array $data
|
||||||
|
*/
|
||||||
|
protected function connectTags(TransactionJournal $journal, array $data): void
|
||||||
|
{
|
||||||
|
$factory = app(TagFactory::class);
|
||||||
|
$factory->setUser($journal->user);
|
||||||
|
foreach ($data['tags'] as $string) {
|
||||||
|
$tag = $factory->findOrCreate($string);
|
||||||
|
$journal->tags()->save($tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the given bill based on the ID or the name. ID takes precedence over the name.
|
* Find the given bill based on the ID or the name. ID takes precedence over the name.
|
||||||
*
|
*
|
||||||
@ -203,4 +267,39 @@ class TransactionJournalFactory
|
|||||||
return $transactionType;
|
return $transactionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TransactionJournal $journal
|
||||||
|
* @param array $data
|
||||||
|
* @param string $field
|
||||||
|
*/
|
||||||
|
protected function storeMeta(TransactionJournal $journal, array $data, string $field): void
|
||||||
|
{
|
||||||
|
$value = $data[$field];
|
||||||
|
if (!is_null($value)) {
|
||||||
|
$set = [
|
||||||
|
'journal' => $journal,
|
||||||
|
'name' => $field,
|
||||||
|
'data' => $data[$field],
|
||||||
|
];
|
||||||
|
/** @var TransactionJournalMetaFactory $factory */
|
||||||
|
$factory = app(TransactionJournalMetaFactory::class);
|
||||||
|
$factory->updateOrCreate($set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param TransactionJournal $journal
|
||||||
|
* @param string $notes
|
||||||
|
*/
|
||||||
|
protected function storeNote(TransactionJournal $journal, string $notes): void
|
||||||
|
{
|
||||||
|
if (strlen($notes) > 0) {
|
||||||
|
$note = new Note;
|
||||||
|
$note->noteable()->associate($journal);
|
||||||
|
$note->text = $notes;
|
||||||
|
$note->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
58
app/Factory/TransactionJournalMetaFactory.php
Normal file
58
app/Factory/TransactionJournalMetaFactory.php
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TransactionJournalMetaFactory.php
|
||||||
|
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Factory;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use FireflyIII\Models\TransactionJournalMeta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TransactionJournalMetaFactory
|
||||||
|
*/
|
||||||
|
class TransactionJournalMetaFactory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @return TransactionJournalMeta
|
||||||
|
*/
|
||||||
|
public function updateOrCreate(array $data): TransactionJournalMeta
|
||||||
|
{
|
||||||
|
$value = $data['data'];
|
||||||
|
if ($data['data'] instanceof Carbon) {
|
||||||
|
$value = $data['data']->toW3cString();
|
||||||
|
}
|
||||||
|
|
||||||
|
$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();
|
||||||
|
if (null === $entry) {
|
||||||
|
$entry = new TransactionJournalMeta();
|
||||||
|
$entry->transactionJournal()->associate($data['journal']);
|
||||||
|
$entry->name = $data['name'];
|
||||||
|
}
|
||||||
|
$entry->data = $value;
|
||||||
|
$entry->save();
|
||||||
|
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -91,7 +91,7 @@ class Transaction extends Model
|
|||||||
*/
|
*/
|
||||||
protected $fillable
|
protected $fillable
|
||||||
= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
|
= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',
|
||||||
'foreign_amount',];
|
'foreign_amount','reconciled'];
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
@ -25,6 +25,7 @@ namespace FireflyIII\Transformers;
|
|||||||
|
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionType;
|
use FireflyIII\Models\TransactionType;
|
||||||
use League\Fractal\Resource\Collection as FractalCollection;
|
use League\Fractal\Resource\Collection as FractalCollection;
|
||||||
@ -167,6 +168,13 @@ class TransactionTransformer extends TransformerAbstract
|
|||||||
$budgetName = is_null($transaction->transaction_budget_name) ? $transaction->transaction_journal_budget_name
|
$budgetName = is_null($transaction->transaction_budget_name) ? $transaction->transaction_journal_budget_name
|
||||||
: $transaction->transaction_budget_name;
|
: $transaction->transaction_budget_name;
|
||||||
}
|
}
|
||||||
|
/** @var Note $dbNote */
|
||||||
|
$dbNote = $transaction->transactionJournal->notes()->first();
|
||||||
|
$notes = null;
|
||||||
|
if(!is_null($dbNote)) {
|
||||||
|
$notes = $dbNote->text;
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'id' => (int)$transaction->id,
|
'id' => (int)$transaction->id,
|
||||||
'updated_at' => $transaction->updated_at->toAtomString(),
|
'updated_at' => $transaction->updated_at->toAtomString(),
|
||||||
@ -191,6 +199,7 @@ class TransactionTransformer extends TransformerAbstract
|
|||||||
'category_name' => $categoryName,
|
'category_name' => $categoryName,
|
||||||
'budget_id' => $budgetId,
|
'budget_id' => $budgetId,
|
||||||
'budget_name' => $budgetName,
|
'budget_name' => $budgetName,
|
||||||
|
'notes' => $notes,
|
||||||
'links' => [
|
'links' => [
|
||||||
[
|
[
|
||||||
'rel' => 'self',
|
'rel' => 'self',
|
||||||
|
@ -212,9 +212,9 @@ class FireflyValidator extends Validator
|
|||||||
*/
|
*/
|
||||||
public function validateMore($attribute, $value, $parameters): bool
|
public function validateMore($attribute, $value, $parameters): bool
|
||||||
{
|
{
|
||||||
$compare = $parameters[0] ?? '0';
|
$compare = strval($parameters[0] ?? '0');
|
||||||
|
|
||||||
return bccomp($value, $compare) > 0;
|
return bccomp(strval($value), $compare) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,6 +26,7 @@ namespace Tests\Api\V1\Controllers;
|
|||||||
|
|
||||||
use FireflyIII\Helpers\Collector\JournalCollector;
|
use FireflyIII\Helpers\Collector\JournalCollector;
|
||||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
@ -33,6 +34,11 @@ use Laravel\Passport\Passport;
|
|||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* todo test bad budget, bad category
|
||||||
|
* todo test bad piggy, bad bill
|
||||||
|
* todo test fire of rules with parameter
|
||||||
|
* todo test bad currency, bad foreign currency
|
||||||
|
* todo test reconciled, identifier
|
||||||
* Class TransactionControllerTest
|
* Class TransactionControllerTest
|
||||||
*/
|
*/
|
||||||
class TransactionControllerTest extends TestCase
|
class TransactionControllerTest extends TestCase
|
||||||
@ -73,6 +79,7 @@ class TransactionControllerTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::index
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::index
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::mapTypes
|
||||||
*
|
*
|
||||||
* @throws \FireflyIII\Exceptions\FireflyException
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
@ -117,6 +124,7 @@ class TransactionControllerTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::__construct
|
||||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::index
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::index
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::mapTypes
|
||||||
* @throws \FireflyIII\Exceptions\FireflyException
|
* @throws \FireflyIII\Exceptions\FireflyException
|
||||||
*/
|
*/
|
||||||
public function testIndexWithRange()
|
public function testIndexWithRange()
|
||||||
@ -429,6 +437,383 @@ class TransactionControllerTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit with existing budget ID, see it reflected in output.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreBudgetId()
|
||||||
|
{
|
||||||
|
$budget = auth()->user()->budgets()->first();
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'budget_id' => $budget->id,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'budget_id' => $budget->id,
|
||||||
|
'budget_name' => $budget->name,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit with existing budget name, see it reflected in output.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreBudgetName()
|
||||||
|
{
|
||||||
|
$budget = auth()->user()->budgets()->first();
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'budget_name' => $budget->name,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'budget_id' => $budget->id,
|
||||||
|
'budget_name' => $budget->name,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit with existing category ID, see it reflected in output.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreCategoryID()
|
||||||
|
{
|
||||||
|
$category = auth()->user()->categories()->first();
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'category_id' => $category->id,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'category_id' => $category->id,
|
||||||
|
'category_name' => $category->name,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit with existing category ID, see it reflected in output.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreCategoryName()
|
||||||
|
{
|
||||||
|
$category = auth()->user()->categories()->first();
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'category_name' => $category->name,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'category_id' => $category->id,
|
||||||
|
'category_name' => $category->name,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add foreign amount information.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreForeignAmount()
|
||||||
|
{
|
||||||
|
$currency = TransactionCurrency::first();
|
||||||
|
$foreign = TransactionCurrency::where('id', '!=', $currency->id)->first();
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => $currency->id,
|
||||||
|
'foreign_currency_id' => $foreign->id,
|
||||||
|
'foreign_amount' => 23,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'currency_code' => $currency->code,
|
||||||
|
'foreign_currency_code' => $foreign->code,
|
||||||
|
'foreign_amount' => -23,
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all available meta data fields.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreMetaData()
|
||||||
|
{
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
// store date meta fields (if present):
|
||||||
|
'interest_date' => '2017-08-02',
|
||||||
|
'book_date' => '2017-08-03',
|
||||||
|
'process_date' => '2017-08-04',
|
||||||
|
'due_date' => '2017-08-05',
|
||||||
|
'payment_date' => '2017-08-06',
|
||||||
|
'invoice_date' => '2017-08-07',
|
||||||
|
'internal_reference' => 'I are internal ref!',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions?include=journal_meta', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertSee('interest_date');
|
||||||
|
$response->assertSee('book_date');
|
||||||
|
$response->assertSee('process_date');
|
||||||
|
$response->assertSee('due_date');
|
||||||
|
$response->assertSee('payment_date');
|
||||||
|
$response->assertSee('invoice_date');
|
||||||
|
$response->assertSee('internal_reference');
|
||||||
|
$response->assertSee('2017-08-02');
|
||||||
|
$response->assertSee('2017-08-03');
|
||||||
|
$response->assertSee('2017-08-04');
|
||||||
|
$response->assertSee('2017-08-05');
|
||||||
|
$response->assertSee('2017-08-06');
|
||||||
|
$response->assertSee('2017-08-07');
|
||||||
|
$response->assertSee('I are internal ref!');
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submit the minimum amount of data required to create a withdrawal.
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreNotes()
|
||||||
|
{
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'notes' => 'I am a note',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertSee('I am a note');
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'notes' => 'I am a note',
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the minimum amount of data required to create a withdrawal.
|
* Submit the minimum amount of data required to create a withdrawal.
|
||||||
* When sending a piggy bank by name, this must be reflected in the output.
|
* When sending a piggy bank by name, this must be reflected in the output.
|
||||||
@ -546,6 +931,55 @@ class TransactionControllerTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a different reconciled var
|
||||||
|
*
|
||||||
|
* @covers \FireflyIII\Api\V1\Controllers\TransactionController::store
|
||||||
|
*/
|
||||||
|
public function testSuccessStoreReconciled()
|
||||||
|
{
|
||||||
|
$account = auth()->user()->accounts()->where('account_type_id', 3)->first();
|
||||||
|
$data = [
|
||||||
|
'description' => 'Some transaction #' . rand(1, 1000),
|
||||||
|
'date' => '2018-01-01',
|
||||||
|
'type' => 'withdrawal',
|
||||||
|
'transactions' => [
|
||||||
|
[
|
||||||
|
'amount' => '10',
|
||||||
|
'currency_id' => 1,
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'reconciled' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
// test API
|
||||||
|
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||||
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(
|
||||||
|
[
|
||||||
|
'data' => [
|
||||||
|
'type' => 'transactions',
|
||||||
|
'attributes' => [
|
||||||
|
'description' => $data['description'],
|
||||||
|
'date' => $data['date'],
|
||||||
|
'source_id' => $account->id,
|
||||||
|
'source_name' => $account->name,
|
||||||
|
'type' => 'Withdrawal',
|
||||||
|
'source_type' => 'Asset account',
|
||||||
|
'destination_name' => 'Cash account',
|
||||||
|
'destination_type' => 'Cash account',
|
||||||
|
'amount' => -10,
|
||||||
|
'reconciled' => true,
|
||||||
|
],
|
||||||
|
'links' => true,
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the minimum amount of data required to create a withdrawal.
|
* Submit the minimum amount of data required to create a withdrawal.
|
||||||
* Add some tags as well. Expect to see them in the result.
|
* Add some tags as well. Expect to see them in the result.
|
||||||
@ -597,9 +1031,10 @@ class TransactionControllerTest extends TestCase
|
|||||||
'destination_type' => 'Cash account',
|
'destination_type' => 'Cash account',
|
||||||
'amount' => -10,
|
'amount' => -10,
|
||||||
],
|
],
|
||||||
'links' => true,
|
'links' => [],
|
||||||
'includes' => [],
|
'relationships' => [],
|
||||||
],
|
],
|
||||||
|
'included' => [],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user