mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 06:14:35 -04:00
Clear up bank transactions
This commit is contained in:
parent
48c2d36830
commit
b21344693c
@ -44,50 +44,6 @@ class BankTransactionController extends BaseController
|
|||||||
$this->bank_transaction_repo = $bank_transaction_repo;
|
$this->bank_transaction_repo = $bank_transaction_repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @OA\Get(
|
|
||||||
* path="/api/v1/bank_transactions",
|
|
||||||
* operationId="getBankTransactions",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Gets a list of bank_transactions",
|
|
||||||
* description="Lists all bank integrations",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/index"),
|
|
||||||
* @OA\Parameter(
|
|
||||||
* name="rows",
|
|
||||||
* in="query",
|
|
||||||
* description="The number of bank integrations to return",
|
|
||||||
* example="50",
|
|
||||||
* required=false,
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="number",
|
|
||||||
* format="integer",
|
|
||||||
* ),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="A list of bank integrations",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
* @param BankTransactionFilters $filter
|
|
||||||
* @return Response|mixed
|
|
||||||
*/
|
|
||||||
public function index(BankTransactionFilters $filters)
|
public function index(BankTransactionFilters $filters)
|
||||||
{
|
{
|
||||||
$bank_transactions = BankTransaction::filter($filters);
|
$bank_transactions = BankTransaction::filter($filters);
|
||||||
@ -95,165 +51,16 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->listResponse($bank_transactions);
|
return $this->listResponse($bank_transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param ShowBankTransactionRequest $request
|
|
||||||
* @param BankTransaction $bank_transaction
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @OA\Get(
|
|
||||||
* path="/api/v1/bank_transactions/{id}",
|
|
||||||
* operationId="showBankTransaction",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Shows a bank_transaction",
|
|
||||||
* description="Displays a bank_transaction by id",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Parameter(
|
|
||||||
* name="id",
|
|
||||||
* in="path",
|
|
||||||
* description="The BankTransaction Hashed ID",
|
|
||||||
* example="D2J234DFA",
|
|
||||||
* required=true,
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="string",
|
|
||||||
* format="string",
|
|
||||||
* ),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="Returns the bank_transaction object",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function show(ShowBankTransactionRequest $request, BankTransaction $bank_transaction)
|
public function show(ShowBankTransactionRequest $request, BankTransaction $bank_transaction)
|
||||||
{
|
{
|
||||||
return $this->itemResponse($bank_transaction);
|
return $this->itemResponse($bank_transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param EditBankTransactionRequest $request
|
|
||||||
* @param BankTransaction $bank_transaction
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @OA\Get(
|
|
||||||
* path="/api/v1/bank_transactions/{id}/edit",
|
|
||||||
* operationId="editBankTransaction",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Shows a bank_transaction for editing",
|
|
||||||
* description="Displays a bank_transaction by id",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Parameter(
|
|
||||||
* name="id",
|
|
||||||
* in="path",
|
|
||||||
* description="The BankTransaction Hashed ID",
|
|
||||||
* example="D2J234DFA",
|
|
||||||
* required=true,
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="string",
|
|
||||||
* format="string",
|
|
||||||
* ),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="Returns the bank_transaction object",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function edit(EditBankTransactionRequest $request, BankTransaction $bank_transaction)
|
public function edit(EditBankTransactionRequest $request, BankTransaction $bank_transaction)
|
||||||
{
|
{
|
||||||
return $this->itemResponse($bank_transaction);
|
return $this->itemResponse($bank_transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param UpdateBankTransactionRequest $request
|
|
||||||
* @param BankTransaction $bank_transaction
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @OA\Put(
|
|
||||||
* path="/api/v1/bank_transactions/{id}",
|
|
||||||
* operationId="updateBankTransaction",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Updates a bank_transaction",
|
|
||||||
* description="Handles the updating of a bank_transaction by id",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Parameter(
|
|
||||||
* name="id",
|
|
||||||
* in="path",
|
|
||||||
* description="The BankTransaction Hashed ID",
|
|
||||||
* example="D2J234DFA",
|
|
||||||
* required=true,
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="string",
|
|
||||||
* format="string",
|
|
||||||
* ),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="Returns the bank_transaction object",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function update(UpdateBankTransactionRequest $request, BankTransaction $bank_transaction)
|
public function update(UpdateBankTransactionRequest $request, BankTransaction $bank_transaction)
|
||||||
{
|
{
|
||||||
//stubs for updating the model
|
//stubs for updating the model
|
||||||
@ -262,44 +69,6 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->itemResponse($bank_transaction->fresh());
|
return $this->itemResponse($bank_transaction->fresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @param CreateBankTransactionRequest $request
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @OA\Get(
|
|
||||||
* path="/api/v1/bank_transactions/create",
|
|
||||||
* operationId="getBankTransactionsCreate",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Gets a new blank bank_transaction object",
|
|
||||||
* description="Returns a blank object with default values",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="A blank bank_transaction object",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function create(CreateBankTransactionRequest $request)
|
public function create(CreateBankTransactionRequest $request)
|
||||||
{
|
{
|
||||||
$bank_transaction = BankTransactionFactory::create(auth()->user()->company()->id, auth()->user()->id, auth()->user()->account_id);
|
$bank_transaction = BankTransactionFactory::create(auth()->user()->company()->id, auth()->user()->id, auth()->user()->account_id);
|
||||||
@ -307,44 +76,6 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->itemResponse($bank_transaction);
|
return $this->itemResponse($bank_transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param StoreBankTransactionRequest $request
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @OA\Post(
|
|
||||||
* path="/api/v1/bank_transactions",
|
|
||||||
* operationId="storeBankTransaction",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Adds a bank_transaction",
|
|
||||||
* description="Adds an bank_transaction to a company",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="Returns the saved bank_transaction object",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BankTransaction"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function store(StoreBankTransactionRequest $request)
|
public function store(StoreBankTransactionRequest $request)
|
||||||
{
|
{
|
||||||
//stub to store the model
|
//stub to store the model
|
||||||
@ -353,55 +84,6 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->itemResponse($bank_transaction);
|
return $this->itemResponse($bank_transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param DestroyBankTransactionRequest $request
|
|
||||||
* @param BankTransaction $bank_transaction
|
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
* @OA\Delete(
|
|
||||||
* path="/api/v1/bank_transactions/{id}",
|
|
||||||
* operationId="deleteBankTransaction",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Deletes a bank_transaction",
|
|
||||||
* description="Handles the deletion of a bank_transaction by id",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
||||||
* @OA\Parameter(
|
|
||||||
* name="id",
|
|
||||||
* in="path",
|
|
||||||
* description="The BankTransaction Hashed ID",
|
|
||||||
* example="D2J234DFA",
|
|
||||||
* required=true,
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="string",
|
|
||||||
* format="string",
|
|
||||||
* ),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="Returns a HTTP status",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
*
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function destroy(DestroyBankTransactionRequest $request, BankTransaction $bank_transaction)
|
public function destroy(DestroyBankTransactionRequest $request, BankTransaction $bank_transaction)
|
||||||
{
|
{
|
||||||
$this->bank_transaction_repo->delete($bank_transaction);
|
$this->bank_transaction_repo->delete($bank_transaction);
|
||||||
@ -409,56 +91,6 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->itemResponse($bank_transaction->fresh());
|
return $this->itemResponse($bank_transaction->fresh());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform bulk actions on the list view.
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
* @OA\Post(
|
|
||||||
* path="/api/v1/bank_transations/bulk",
|
|
||||||
* operationId="bulkBankTransactions",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Performs bulk actions on an array of bank_transations",
|
|
||||||
* description="",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/index"),
|
|
||||||
* @OA\RequestBody(
|
|
||||||
* description="Action paramters",
|
|
||||||
* required=true,
|
|
||||||
* @OA\MediaType(
|
|
||||||
* mediaType="application/json",
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="array",
|
|
||||||
* @OA\Items(
|
|
||||||
* type="integer",
|
|
||||||
* description="Array of hashed IDs to be bulk 'actioned",
|
|
||||||
* example="[0,1,2,3]",
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="The Bulk Action response",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function bulk(BulkBankTransactionRequest $request)
|
public function bulk(BulkBankTransactionRequest $request)
|
||||||
{
|
{
|
||||||
$action = $request->input('action');
|
$action = $request->input('action');
|
||||||
@ -480,55 +112,6 @@ class BankTransactionController extends BaseController
|
|||||||
return $this->listResponse(BankTransaction::withTrashed()->whereIn('id', $this->transformKeys($ids))->company());
|
return $this->listResponse(BankTransaction::withTrashed()->whereIn('id', $this->transformKeys($ids))->company());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Perform bulk actions on the list view.
|
|
||||||
*
|
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
* @OA\Post(
|
|
||||||
* path="/api/v1/bank_transations/match",
|
|
||||||
* operationId="matchBankTransactions",
|
|
||||||
* tags={"bank_transactions"},
|
|
||||||
* summary="Performs match actions on an array of bank_transactions",
|
|
||||||
* description="",
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
||||||
* @OA\Parameter(ref="#/components/parameters/index"),
|
|
||||||
* @OA\RequestBody(
|
|
||||||
* description="Action paramters",
|
|
||||||
* required=true,
|
|
||||||
* @OA\MediaType(
|
|
||||||
* mediaType="application/json",
|
|
||||||
* @OA\Schema(
|
|
||||||
* type="array",
|
|
||||||
* @OA\Items(
|
|
||||||
* type="integer",
|
|
||||||
* description="Array of hashed IDs to be bulk 'actioned",
|
|
||||||
* example="[0,1,2,3]",
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
* )
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=200,
|
|
||||||
* description="The Bulk Action response",
|
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response=422,
|
|
||||||
* description="Validation error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
||||||
|
|
||||||
* ),
|
|
||||||
* @OA\Response(
|
|
||||||
* response="default",
|
|
||||||
* description="Unexpected Error",
|
|
||||||
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
||||||
* ),
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
public function match(MatchBankTransactionRequest $request)
|
public function match(MatchBankTransactionRequest $request)
|
||||||
{
|
{
|
||||||
$bts = (new MatchBankTransactions(auth()->user()->company()->id, auth()->user()->company()->db, $request->all()))->handle();
|
$bts = (new MatchBankTransactions(auth()->user()->company()->id, auth()->user()->company()->db, $request->all()))->handle();
|
||||||
|
@ -13,7 +13,6 @@ namespace App\Http\Requests\BankTransaction;
|
|||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\BankTransaction;
|
use App\Models\BankTransaction;
|
||||||
use App\Models\Expense;
|
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
|
||||||
class MatchBankTransactionRequest extends Request
|
class MatchBankTransactionRequest extends Request
|
||||||
@ -39,7 +38,6 @@ class MatchBankTransactionRequest extends Request
|
|||||||
$rules['transactions.*.vendor_id'] = 'bail|nullable|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
$rules['transactions.*.vendor_id'] = 'bail|nullable|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
||||||
$rules['transactions.*.id'] = 'bail|required|exists:bank_transactions,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
$rules['transactions.*.id'] = 'bail|required|exists:bank_transactions,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
||||||
$rules['transactions.*.payment_id'] = 'bail|sometimes|nullable|exists:payments,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
$rules['transactions.*.payment_id'] = 'bail|sometimes|nullable|exists:payments,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
||||||
// $rules['transactions.*.expense_id'] = 'bail|sometimes|nullable|exists:expenses,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
@ -47,7 +45,7 @@ class MatchBankTransactionRequest extends Request
|
|||||||
public function prepareForValidation()
|
public function prepareForValidation()
|
||||||
{
|
{
|
||||||
$inputs = $this->all();
|
$inputs = $this->all();
|
||||||
nlog($inputs);
|
|
||||||
foreach ($inputs['transactions'] as $key => $input) {
|
foreach ($inputs['transactions'] as $key => $input) {
|
||||||
if (array_key_exists('id', $inputs['transactions'][$key])) {
|
if (array_key_exists('id', $inputs['transactions'][$key])) {
|
||||||
$inputs['transactions'][$key]['id'] = $this->decodePrimaryKey($input['id']);
|
$inputs['transactions'][$key]['id'] = $this->decodePrimaryKey($input['id']);
|
||||||
@ -71,20 +69,8 @@ class MatchBankTransactionRequest extends Request
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('expense_id', $inputs['transactions'][$key]) && strlen($inputs['transactions'][$key]['expense_id']) >= 1) {
|
|
||||||
// $inputs['transactions'][$key]['expense_id'] = $this->decodePrimaryKey($inputs['transactions'][$key]['expense_id']);
|
|
||||||
|
|
||||||
// $e = Expense::withTrashed()->where('company_id', auth()->user()->company()->id)->where('id', $inputs['transactions'][$key]['expense_id'])->first();
|
|
||||||
|
|
||||||
/*Ensure we don't relink an existing expense*/
|
|
||||||
// if (!$e || is_numeric($e->transaction_id)) {
|
|
||||||
// unset($inputs['transactions'][$key]['expense_id']);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog($inputs);
|
|
||||||
|
|
||||||
$this->replace($inputs);
|
$this->replace($inputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,8 +226,6 @@ class MatchBankTransactions implements ShouldQueue
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog($this->getInvoices($input['invoice_ids']));
|
|
||||||
|
|
||||||
$_invoices = Invoice::query()
|
$_invoices = Invoice::query()
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->where('company_id', $this->bt->company_id)
|
->where('company_id', $this->bt->company_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user