Added invoice dashboard module get api

This commit is contained in:
dhanabalan
2025-07-12 14:03:12 +05:30
parent ea5af41f7f
commit 33acf73b5e
6 changed files with 774 additions and 4 deletions

View File

@@ -0,0 +1,91 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ModuleInvoiceDataController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
public function get_invoiceData(Request $request)
{
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
], 403);
}
$moduleName = $request->header('invoice-type-list');
if (empty($moduleName))
{
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invoice type can't be empty!"
], 404);
}
$headerValue = $request->header('invoice-type-list');
if ($headerValue != 'Invoice Type List') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid value for 'invoice-type-list' header!"
], 404);
}
$invoiceTypes = ['All Invoice', 'Serial Invoice', 'Individual Invoice', 'Bundle Invoice'];
return response()->json([
'status_code' => 'SUCCESS',
'status_description' => $invoiceTypes
], 200);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}