-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
263 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\ShopApiPlugin\Request; | ||
|
||
use Sylius\ShopApiPlugin\Command\AddressOrder; | ||
use Sylius\ShopApiPlugin\Model\Address; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class AddressOrderRequest implements CommandRequestInterface | ||
{ | ||
/** @var string */ | ||
protected $token; | ||
|
||
/** @var Address */ | ||
protected $shippingAddress; | ||
|
||
/** @var Address */ | ||
protected $billingAddress; | ||
|
||
public function populateData(Request $request): void | ||
{ | ||
$this->token = $request->attributes->get('token'); | ||
$this->shippingAddress = Address::createFromArray($request->request->get('shippingAddress')); | ||
$this->billingAddress = Address::createFromArray($request->request->get('billingAddress') ?: $request->request->get('shippingAddress')); | ||
} | ||
|
||
public function getCommand(): object | ||
{ | ||
return new AddressOrder($this->token, $this->shippingAddress, $this->billingAddress); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\ShopApiPlugin\Request; | ||
|
||
use Sylius\ShopApiPlugin\Command\ChoosePaymentMethod; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class ChoosePaymentMethodRequest implements CommandRequestInterface | ||
{ | ||
/** @var string */ | ||
protected $token; | ||
|
||
/** @var int */ | ||
protected $paymentId; | ||
|
||
/** @var string */ | ||
protected $method; | ||
|
||
public function populateData(Request $request): void | ||
{ | ||
$this->token = $request->attributes->get('token'); | ||
$this->paymentId = $request->attributes->get('paymentId'); | ||
$this->method = $request->request->get('method'); | ||
} | ||
|
||
public function getCommand(): object | ||
{ | ||
return new ChoosePaymentMethod($this->token, $this->paymentId, $this->method); | ||
} | ||
} |
Oops, something went wrong.