2024-06-19 13:23:51 +05:30
|
|
|
<?php
|
|
|
|
|
|
2024-06-30 21:11:10 +05:30
|
|
|
namespace App\Http\Controllers\APIs\Customer_API;
|
2024-06-19 13:23:51 +05:30
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Services\APIs\CustomerAPIs\RulesApiServices;
|
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class RulesControllerAPI extends Controller
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
protected $RulesApiServices;
|
|
|
|
|
|
|
|
|
|
public function __construct(RulesApiServices $RulesApiServices)
|
|
|
|
|
{
|
|
|
|
|
$this->RulesApiServices = $RulesApiServices;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created By : sayli Raut
|
|
|
|
|
* Created at : 19 June 2024
|
|
|
|
|
* Use : To get voucher rules and regulation.
|
|
|
|
|
*/
|
|
|
|
|
public function getVoucherRules()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$token = readHeaderToken();
|
|
|
|
|
if ($token) {
|
|
|
|
|
$customerIamId = $token['sub'];
|
|
|
|
|
$response = $this->RulesApiServices->getVoucherRules();
|
|
|
|
|
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200);
|
|
|
|
|
} else {
|
|
|
|
|
return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409);
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
2024-06-19 16:20:52 +05:30
|
|
|
Log::error('Voucher rules get data controller function failed: ' . $e->getMessage());
|
2024-06-19 13:23:51 +05:30
|
|
|
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|