custom/plugins/SwagAmazonPay/src/Components/Button/Pay/Struct/AmazonPayButtonPayloadStruct.php line 78

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * (c) shopware AG <info@shopware.com>
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  */
  8. namespace Swag\AmazonPay\Components\Button\Pay\Struct;
  9. use Shopware\Core\Framework\Struct\JsonSerializableTrait;
  10. class AmazonPayButtonPayloadStruct implements \JsonSerializable
  11. {
  12.     use JsonSerializableTrait;
  13.     /**
  14.      * @var string
  15.      */
  16.     protected $checkoutReviewReturnUrl;
  17.     /**
  18.      * @var string|null
  19.      */
  20.     protected $checkoutResultReturnUrl;
  21.     /**
  22.      * @var string
  23.      */
  24.     protected $storeId;
  25.     /**
  26.      * @var array<string, array>
  27.      */
  28.     protected $addressRestrictions;
  29.     public function getCheckoutReviewReturnUrl(): string
  30.     {
  31.         return $this->checkoutReviewReturnUrl;
  32.     }
  33.     public function setCheckoutReviewReturnUrl(string $checkoutReviewReturnUrl): void
  34.     {
  35.         $this->checkoutReviewReturnUrl $checkoutReviewReturnUrl;
  36.     }
  37.     public function getCheckoutResultReturnUrl(): ?string
  38.     {
  39.         return $this->checkoutResultReturnUrl;
  40.     }
  41.     public function setCheckoutResultReturnUrl(?string $checkoutResultReturnUrl): void
  42.     {
  43.         $this->checkoutResultReturnUrl $checkoutResultReturnUrl;
  44.     }
  45.     public function getStoreId(): string
  46.     {
  47.         return $this->storeId;
  48.     }
  49.     public function setStoreId(string $storeId): void
  50.     {
  51.         $this->storeId $storeId;
  52.     }
  53.     public function getAddressRestrictions(): array
  54.     {
  55.         return $this->addressRestrictions;
  56.     }
  57.     public function setAddressRestrictions(array $addressRestrictions): void
  58.     {
  59.         $this->addressRestrictions $addressRestrictions;
  60.     }
  61.     public function jsonSerialize()
  62.     {
  63.         $serializedData = [
  64.             'storeId' => $this->storeId,
  65.             'webCheckoutDetails' => [
  66.                 'checkoutReviewReturnUrl' => $this->checkoutReviewReturnUrl,
  67.                 'checkoutResultReturnUrl' => $this->checkoutResultReturnUrl,
  68.             ],
  69.         ];
  70.         if (!empty($this->addressRestrictions)) {
  71.             $serializedData['deliverySpecifications'] = [
  72.                 'addressRestrictions' => [
  73.                     'type' => 'Allowed',
  74.                     'restrictions' => $this->addressRestrictions,
  75.                 ],
  76.             ];
  77.         }
  78.         return $serializedData;
  79.     }
  80. }