Merge branch 'invoice-backend' into 'master'

Invoice backend

See merge request CIEFWorldwideSdnBhd/izyim!36
This commit is contained in:
omair saleh
2019-07-20 03:00:15 +00:00
24 changed files with 986 additions and 0 deletions
@@ -0,0 +1,36 @@
<?php
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\FreightForwarder\Services\DeletesServiceFees;
use App\Classes\ValueObjects\Constants\HttpStatus;
use Illuminate\Http\JsonResponse;
class DeleteServiceFeesLogic
{
/** @var DeletesServiceFees */
private $deletesServiceFees;
/**
* DeleteServiceFeesLogic constructor.
* @param DeletesServiceFees $deletesServiceFees
*/
public function __construct(DeletesServiceFees $deletesServiceFees)
{
$this->deletesServiceFees = $deletesServiceFees;
}
public function execute(String $serviceId){
try{
return $this->deletesServiceFees->execute($serviceId);
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
}catch(\Exception $exception){
throw new InternalServerErrorException("Failed to delete Customer Relation because{$exception->getMessage()}");
}
}
}
@@ -0,0 +1,38 @@
<?php
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\FreightForwarder\DataTransferObjects\CustomerRelationObject;
use App\Classes\Modules\FreightForwarder\Services\UpdatesCustomerRelation;
use App\Classes\ValueObjects\Constants\HttpStatus;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateCustomerRelationLogic
{
/** @var UpdatesCustomerRelation */
private $updatesCustomerRelation;
/**
* UpdateCustomerRelationLogic constructor.
* @param UpdatesCustomerRelation $updatesCustomerRelation
*/
public function __construct(UpdatesCustomerRelation $updatesCustomerRelation)
{
$this->updatesCustomerRelation = $updatesCustomerRelation;
}
public function execute(Request $request){
try{
$object = new CustomerRelationObject($request->input('forwarder_id'), $request->input('company_id'), $request->input('customer_rate'), $request->input('wave'));
return $this->updatesCustomerRelation->execute($object);
return new JsonResponse([], HttpStatus::REQUEST_ACCEPTED);
}catch(\Exception $exception){
throw new InternalServerErrorException("Failed to update Customer Relation because{$exception->getMessage()}");
}
}
}
@@ -0,0 +1,39 @@
<?php
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\FreightForwarder\DataTransferObjects\FreightForwarderObject;
use App\Classes\Modules\FreightForwarder\Services\UpdatesFreightForwarder;
use App\Classes\ValueObjects\Constants\HttpStatus;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateFreightForwarderLogic
{
/** @var UpdatesFreightForwarder */
private $updatesFreightForwarder;
/**
* UpdateFreightForwarderLogic constructor.
* @param UpdatesFreightForwarder $updatesFreightForwarder
*/
public function __construct(UpdatesFreightForwarder $updatesFreightForwarder)
{
$this->updatesFreightForwarder = $updatesFreightForwarder;
}
public function execute(String $forwarderId, Request $request){
try{
$object = new FreightForwarderObject(null, null, null, null, null, null,null, null, $request->input('shipping_rate'), $request->input('overdue_days'), $request->input('markup_percentage'), $request->input('minimum_cbm'));
return $this->updatesFreightForwarder->execute($forwarderId, $object);
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
}catch(\Exception $exception){
throw new InternalServerErrorException("Failed to update Freight Forwarder because{$exception->getMessage()}");
}
}
}
@@ -0,0 +1,45 @@
<?php
/**
* Created by PhpStorm.
* User: mhmj
* Date: 18/07/2019
* Time: 4:45 PM
*/
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
use App\Classes\Modules\FreightForwarder\DataTransferObjects\ServiceObject;
use App\Classes\Modules\FreightForwarder\Services\UpdatesServiceFees;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class UpdateServiceFeesLogic
{
/** @var UpdatesServiceFees */
private $updatesServiceFees;
/**
* UpdateServiceFeesLogic constructor.
* @param UpdatesServiceFees $updatesServiceFees
*/
public function __construct(UpdatesServiceFees $updatesServiceFees)
{
$this->updatesServiceFees = $updatesServiceFees;
}
public function execute(Request $request){
try{
$object = new ServiceObject($request->input('type'), $request->input('forwarder_id'), $request->input('name'), $request->input('description'), $request->input('cost'));
return $this->updatesServiceFees->execute($request->input('id'), $object);
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
}catch (\Exception $exception){
throw new InternalServerErrorException("Failed to update Service Fees because{$exception->getMessage()}");
}
}
}