mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
invoice-backend
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 23/07/2019
|
||||
* Time: 10:40 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\CustomerRelationObject;
|
||||
use App\Models\CustomerRelation;
|
||||
|
||||
class ListsCustomerRelation
|
||||
{
|
||||
/** @var CustomerRelation */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsCustomerRelation constructor.
|
||||
* @param CustomerRelation $repository
|
||||
*/
|
||||
public function __construct(CustomerRelation $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $forwarderId
|
||||
* @param int $companyId
|
||||
* @return CustomerRelationObject
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(int $forwarderId, int $companyId): CustomerRelationObject {
|
||||
|
||||
try{
|
||||
|
||||
$repository = $this->repository->where('forwarder_id', $forwarderId)->where('company_id',$companyId)->first();
|
||||
|
||||
/** @var CustomerRelationObject $customerRelationObject */
|
||||
$customerRelationObject = new CustomerRelationObject($forwarderId, $companyId, $repository->customer_rate, $repository->wave);
|
||||
|
||||
return $customerRelationObject;
|
||||
|
||||
}catch (\Exception $exception){
|
||||
|
||||
throw new InternalServerErrorException("Failed to retrieve Customer Relation because{$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 22/07/2019
|
||||
* Time: 10:23 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\FreightForwarderObject;
|
||||
use App\Models\Forwarder;
|
||||
|
||||
class ListsFreightForwarderSetting
|
||||
{
|
||||
/** @var Forwarder */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsFreightForwarderSetting constructor.
|
||||
* @param Forwarder $repository
|
||||
*/
|
||||
public function __construct(Forwarder $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $forwarderId
|
||||
* @return FreightForwarderObject
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
|
||||
public function execute(int $forwarderId): FreightForwarderObject{
|
||||
|
||||
try{
|
||||
$repository = $this->repository->findOrFail($forwarderId);
|
||||
|
||||
/** @var FreightForwarderObject $forwarderObject */
|
||||
$forwarderObject = new FreightForwarderObject($repository->shipping_rate, $repository->overdue_days, $repository->markup_percentage, $repository->minimum_cbm);
|
||||
return $forwarderObject;
|
||||
|
||||
}catch (\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to retrieve Freight Forwarder Settings because{$exception->getMessage()}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -163,12 +163,11 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
// Freight Forwarder Routes
|
||||
Route::group(['prefix' => 'forwarder', 'as' => 'forwarder.', 'namespace' => 'FreightForwarder'], function () {
|
||||
|
||||
// Update Freight Forwarder Settings
|
||||
// Update & Delete
|
||||
Route::put('/{forwarderId}/update', 'UpdateFreightForwarderController@update')->name('update.freight.forwarder');
|
||||
Route::put('{companyId}/update/customer-relation', 'UpdateCustomerRelationController@update')->name('update.customer.relation');
|
||||
Route::put('{forwarderId}/update/services', 'UpdateServiceFeesController@update')->name('update.service.fees');
|
||||
Route::delete('/{serviceId}/delete/services', 'DeleteServiceFeesController@delete')->name('delete.service.fees');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user