mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
Order-Change-Address
This commit is contained in:
@@ -1,14 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 28/05/2019
|
||||
* Time: 10:51 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Orders\Services\UpdatesOrderAddress;
|
||||
@@ -32,10 +25,9 @@ class UpdateOrderAddressLogic
|
||||
|
||||
public function execute(string $orderId, Request $request){
|
||||
try{
|
||||
$addressObject = new AddressObject($request->address_id);
|
||||
return $this->UpdatesOrderAddress->execute($orderId,$addressObject);
|
||||
|
||||
return new JsonResponse([],HttpStatus::RESOURCE_CREATED);
|
||||
return $this->UpdatesOrderAddress->execute($orderId,$request->address_id);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
} catch (\Exception $exception) {
|
||||
throw new InternalServerErrorException("Failed to update address because{$exception->getMessage()}");
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 28/05/2019
|
||||
* Time: 11:11 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\Orders\DataTransferObjects;
|
||||
|
||||
|
||||
class AddressObject
|
||||
{
|
||||
/** @var string */
|
||||
private $addressId;
|
||||
|
||||
/**
|
||||
* AddressObject constructor.
|
||||
* @param string $addressId
|
||||
*/
|
||||
public function __construct(string $addressId)
|
||||
{
|
||||
$this->addressId = $addressId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAddressId(): string
|
||||
{
|
||||
return $this->addressId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 28/05/2019
|
||||
* Time: 11:00 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\AddressObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
@@ -30,11 +23,11 @@ class UpdatesOrderAddress
|
||||
}
|
||||
|
||||
|
||||
public function execute(string $orderId,AddressObject $addressObject){
|
||||
public function execute(string $orderId,string $addressId){
|
||||
try{
|
||||
|
||||
$repository = $this->repository->findOrFail($orderId);
|
||||
$repository->address_id = $addressObject->getAddressId();
|
||||
$repository->address_id = $addressId;
|
||||
$repository->save();
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 28/05/2019
|
||||
* Time: 10:51 AM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Orders\UpdateOrderAddressLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
Route::post('/bulk-receive-notes', 'BulkReceiveNotesController@create')->name('bulk.receive.update');
|
||||
|
||||
Route::post('/{orderId}/address','UpdateOrderAddressController@update')->name('address.update');
|
||||
Route::post('/{orderId}/address','UpdateOrderAddressController@update')->name('address.order.update');
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user