mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
Merge branch 'invoice-backend' into 'master'
invoice-backend See merge request CIEFWorldwideSdnBhd/izyim!38
This commit is contained in:
+2
-3
@@ -23,11 +23,10 @@ class UpdateCustomerRelationLogic
|
||||
$this->updatesCustomerRelation = $updatesCustomerRelation;
|
||||
}
|
||||
|
||||
public function execute(Request $request){
|
||||
public function execute(int $companyId, Request $request){
|
||||
|
||||
try{
|
||||
|
||||
$object = new CustomerRelationObject($request->input('forwarder_id'), $request->input('company_id'), $request->input('customer_rate'), $request->input('wave'));
|
||||
$object = new CustomerRelationObject(1, $companyId, $request->input('customer_rate'), $request->input('wave'));
|
||||
return $this->updatesCustomerRelation->execute($object);
|
||||
return new JsonResponse([], HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class UpdateFreightForwarderLogic
|
||||
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'));
|
||||
$object = new FreightForwarderObject($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);
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ class UpdateServiceFeesLogic
|
||||
}
|
||||
|
||||
|
||||
public function execute(Request $request){
|
||||
public function execute(int $forwarderId, 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);
|
||||
$object = new ServiceObject($request->input('type'), $forwarderId, $request->input('name'), $request->input('description'), $request->input('cost'));
|
||||
return $this->updatesServiceFees->execute($object, $request->input('id'));
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch (\Exception $exception){
|
||||
|
||||
+20
-17
@@ -5,26 +5,26 @@ namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
class CustomerRelationObject
|
||||
{
|
||||
/** @var int|null */
|
||||
/** @var int */
|
||||
private $forwarderId;
|
||||
|
||||
/** @var int|null */
|
||||
/** @var int */
|
||||
private $companyId;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var float */
|
||||
private $customer_rate;
|
||||
|
||||
/** @var boolean|null */
|
||||
/** @var bool */
|
||||
private $wave;
|
||||
|
||||
/**
|
||||
* CustomerRelationObject constructor.
|
||||
* @param int|null $forwarderId
|
||||
* @param int|null $companyId
|
||||
* @param float|null $customer_rate
|
||||
* @param bool|null $wave
|
||||
* @param int $forwarderId
|
||||
* @param int $companyId
|
||||
* @param float $customer_rate
|
||||
* @param bool $wave
|
||||
*/
|
||||
public function __construct(?int $forwarderId = null, ?int $companyId = null, ?float $customer_rate = null, ?bool $wave = null)
|
||||
public function __construct(int $forwarderId, int $companyId, float $customer_rate, bool $wave = false)
|
||||
{
|
||||
$this->forwarderId = $forwarderId;
|
||||
$this->companyId = $companyId;
|
||||
@@ -33,33 +33,33 @@ class CustomerRelationObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
* @return int
|
||||
*/
|
||||
public function getForwarderId(): ?int
|
||||
public function getForwarderId(): int
|
||||
{
|
||||
return $this->forwarderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
* @return int
|
||||
*/
|
||||
public function getCompanyId(): ?int
|
||||
public function getCompanyId(): int
|
||||
{
|
||||
return $this->companyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @return float
|
||||
*/
|
||||
public function getCustomerRate(): ?float
|
||||
public function getCustomerRate(): float
|
||||
{
|
||||
return $this->customer_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
* @return bool
|
||||
*/
|
||||
public function getWave(): ?bool
|
||||
public function isWave(): bool
|
||||
{
|
||||
return $this->wave;
|
||||
}
|
||||
@@ -67,4 +67,7 @@ class CustomerRelationObject
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+14
-117
@@ -4,67 +4,27 @@ namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
class FreightForwarderObject
|
||||
{
|
||||
/** @var string|null */
|
||||
private $name;
|
||||
|
||||
/** @var string|null */
|
||||
private $email;
|
||||
|
||||
/** @var string|null */
|
||||
private $street_one;
|
||||
|
||||
/** @var string|null */
|
||||
private $street_two;
|
||||
|
||||
/** @var string|null */
|
||||
private $city;
|
||||
|
||||
/** @var string|null */
|
||||
private $state;
|
||||
|
||||
/** @var string|null */
|
||||
private $post_code;
|
||||
|
||||
/** @var string|null */
|
||||
private $country;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var float */
|
||||
private $shipping_rate;
|
||||
|
||||
/** @var int|null */
|
||||
private $overdue_days;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var float */
|
||||
private $markup_percentage;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var float */
|
||||
private $minimum_cbm;
|
||||
|
||||
/**
|
||||
* FreightForwarderObject constructor.
|
||||
* @param null|string $name
|
||||
* @param null|string $email
|
||||
* @param null|string $street_one
|
||||
* @param null|string $street_two
|
||||
* @param null|string $city
|
||||
* @param null|string $state
|
||||
* @param null|string $post_code
|
||||
* @param null|string $country
|
||||
* @param float|null $shipping_rate
|
||||
* @param float $shipping_rate
|
||||
* @param int|null $overdue_days
|
||||
* @param float|null $markup_percentage
|
||||
* @param float|null $minimum_cbm
|
||||
* @param float $markup_percentage
|
||||
* @param float $minimum_cbm
|
||||
*/
|
||||
public function __construct(?string $name = null, ?string $email = null, ?string $street_one = null, ?string $street_two = null, ?string $city = null, ?string $state = null, ?string $post_code = null, ?string $country = null, ?float $shipping_rate = null, ?int $overdue_days = null, ?float $markup_percentage = null, ?float $minimum_cbm = null)
|
||||
public function __construct(float $shipping_rate, ?int $overdue_days, float $markup_percentage, float $minimum_cbm)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->email = $email;
|
||||
$this->street_one = $street_one;
|
||||
$this->street_two = $street_two;
|
||||
$this->city = $city;
|
||||
$this->state = $state;
|
||||
$this->post_code = $post_code;
|
||||
$this->country = $country;
|
||||
$this->shipping_rate = $shipping_rate;
|
||||
$this->overdue_days = $overdue_days;
|
||||
$this->markup_percentage = $markup_percentage;
|
||||
@@ -72,73 +32,9 @@ class FreightForwarderObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
* @return float
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getStreetOne(): ?string
|
||||
{
|
||||
return $this->street_one;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getStreetTwo(): ?string
|
||||
{
|
||||
return $this->street_two;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCity(): ?string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getState(): ?string
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getPostCode(): ?string
|
||||
{
|
||||
return $this->post_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getShippingRate(): ?float
|
||||
public function getShippingRate(): float
|
||||
{
|
||||
return $this->shipping_rate;
|
||||
}
|
||||
@@ -152,17 +48,17 @@ class FreightForwarderObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @return float
|
||||
*/
|
||||
public function getMarkupPercentage(): ?float
|
||||
public function getMarkupPercentage(): float
|
||||
{
|
||||
return $this->markup_percentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @return float
|
||||
*/
|
||||
public function getMinimumCbm(): ?float
|
||||
public function getMinimumCbm(): float
|
||||
{
|
||||
return $this->minimum_cbm;
|
||||
}
|
||||
@@ -171,4 +67,5 @@ class FreightForwarderObject
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -11,30 +11,30 @@ namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
class ServiceObject
|
||||
{
|
||||
/** @var int|null */
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/** @var int|null */
|
||||
/** @var int */
|
||||
private $forwarderId;
|
||||
|
||||
/** @var String|null */
|
||||
/** @var String */
|
||||
private $name;
|
||||
|
||||
/** @var String|null */
|
||||
private $description;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var float */
|
||||
private $cost;
|
||||
|
||||
/**
|
||||
* ServiceObject constructor.
|
||||
* @param null|int $type
|
||||
* @param int|null $forwarderId
|
||||
* @param int $type
|
||||
* @param int $forwarderId
|
||||
* @param null|String $name
|
||||
* @param null|String $description
|
||||
* @param float|null $cost
|
||||
*/
|
||||
public function __construct(?int $type = null, ?int $forwarderId = null, ?string $name = null, ?string $description = null, ?float $cost = null)
|
||||
public function __construct(int $type, int $forwarderId, string $name, ?string $description, float $cost)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->forwarderId = $forwarderId;
|
||||
@@ -44,25 +44,25 @@ class ServiceObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
* @return int
|
||||
*/
|
||||
public function getType(): ?int
|
||||
public function getType(): int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
* @return int
|
||||
*/
|
||||
public function getForwarderId(): ?int
|
||||
public function getForwarderId(): int
|
||||
{
|
||||
return $this->forwarderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|String
|
||||
* @return String
|
||||
*/
|
||||
public function getName(): ?string
|
||||
public function getName(): String
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
@@ -70,20 +70,17 @@ class ServiceObject
|
||||
/**
|
||||
* @return null|String
|
||||
*/
|
||||
public function getDescription(): ?string
|
||||
public function getDescription(): ?String
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
* @return float
|
||||
*/
|
||||
public function getCost(): ?float
|
||||
public function getCost(): float
|
||||
{
|
||||
return $this->cost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ class UpdatesCustomerRelation
|
||||
public function execute(CustomerRelationObject $customerRelationObject){
|
||||
|
||||
try{
|
||||
|
||||
$this->repository->updateOrCreate(
|
||||
[
|
||||
'forwarder_id' => $customerRelationObject->getForwarderId(),
|
||||
@@ -32,7 +33,7 @@ class UpdatesCustomerRelation
|
||||
],
|
||||
[
|
||||
'customer_rate' => $customerRelationObject->getCustomerRate(),
|
||||
'wave' => $customerRelationObject->getWave(),
|
||||
'wave' => $customerRelationObject->isWave(),
|
||||
]);
|
||||
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/07/2019
|
||||
* Time: 4:46 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
@@ -30,19 +24,18 @@ class UpdatesServiceFees
|
||||
}
|
||||
|
||||
|
||||
public function execute(?String $serviceId = null, ServiceObject $serviceObject){
|
||||
public function execute(ServiceObject $serviceObject, ?int $id = null){
|
||||
try{
|
||||
$this->repository->updateOrCreate(
|
||||
[
|
||||
'id' => $serviceId,
|
||||
],
|
||||
[
|
||||
'name' => $serviceObject->getName(),
|
||||
'type' => $serviceObject->getType(),
|
||||
'description' => $serviceObject->getDescription(),
|
||||
'cost' => $serviceObject->getCost(),
|
||||
'forwarder_id' => $serviceObject->getForwarderId(),
|
||||
]);
|
||||
$service = $id ? $this->repository->findOrFail($id) : new ServiceFees;
|
||||
|
||||
$service->forwarder_id = $serviceObject->getForwarderId();
|
||||
$service->name = $serviceObject->getName();
|
||||
$service->type = $serviceObject->getType();
|
||||
$service->description = $serviceObject->getDescription();
|
||||
$service->cost = $serviceObject->getCost();
|
||||
|
||||
$service->save();
|
||||
return $service;
|
||||
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCustomerRelationController
|
||||
{
|
||||
public function update(Request $request, UpdateCustomerRelationLogic $logic){
|
||||
return $logic->execute($request);
|
||||
public function update(int $companyId,Request $request, UpdateCustomerRelationLogic $logic){
|
||||
return $logic->execute($companyId, $request);
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ use Illuminate\Http\Request;
|
||||
|
||||
class UpdateServiceFeesController
|
||||
{
|
||||
public function update(Request $request, UpdateServiceFeesLogic $logic){
|
||||
return $logic->execute($request);
|
||||
public function update(int $forwarderId, Request $request, UpdateServiceFeesLogic $logic){
|
||||
return $logic->execute($forwarderId, $request);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -166,8 +166,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
// Update Freight Forwarder Settings
|
||||
Route::put('/{forwarderId}/update', 'UpdateFreightForwarderController@update')->name('update.freight.forwarder');
|
||||
Route::put('/update/customer-relation', 'UpdateCustomerRelationController@update')->name('update.customer.relation');
|
||||
Route::put('/update/services', 'UpdateServiceFeesController@update')->name('update.service.fees');
|
||||
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