diff --git a/src/Model/Offer/AbstractOffer.php b/src/Model/Offer/AbstractOffer.php index 0b91c70..9661e7a 100644 --- a/src/Model/Offer/AbstractOffer.php +++ b/src/Model/Offer/AbstractOffer.php @@ -148,6 +148,11 @@ abstract class AbstractOffer implements OfferInterface */ private $store; + /** + * @var bool + */ + private $autoDiscount; + /** * Array of custom elements (element types are keys) of arrays of element values * There may be multiple elements of the same type @@ -718,7 +723,7 @@ public function setBarcodes(array $barcodes = []) * * @param string $barcode * - * @return AbstractOffer + * @return $this */ public function addBarcode($barcode) { @@ -809,6 +814,26 @@ public function addCondition(OfferCondition $condition) return $this; } + /** + * @return bool + */ + public function getAutoDiscount() + { + return $this->autoDiscount; + } + + /** + * @param bool $autoDiscount + * + * @return $this + */ + public function setAutoDiscount($autoDiscount) + { + $this->autoDiscount = $autoDiscount; + + return $this; + } + /** * @return array */ @@ -836,6 +861,7 @@ private function getHeaderOptions() 'local_delivery_cost' => $this->getLocalDeliveryCost(), 'weight' => $this->getWeight(), 'name' => $this->getName(), + 'enable_auto_discounts' => $this->getAutoDiscount(), ] + $this->getCustomElements(); } diff --git a/src/Model/ShopInfo.php b/src/Model/ShopInfo.php index 7700074..7f73a96 100644 --- a/src/Model/ShopInfo.php +++ b/src/Model/ShopInfo.php @@ -51,6 +51,11 @@ class ShopInfo */ private $email; + /** + * @var bool + */ + private $autoDiscount; + /** * @return array */ @@ -64,6 +69,7 @@ public function toArray() 'version' => $this->getVersion(), 'agency' => $this->getAgency(), 'email' => $this->getEmail(), + 'enable_auto_discounts' => $this->getAutoDiscount(), ]; } @@ -206,4 +212,24 @@ public function setEmail($email) return $this; } + + /** + * @return bool + */ + public function getAutoDiscount() + { + return $this->autoDiscount; + } + + /** + * @param bool $autoDiscount + * + * @return ShopInfo + */ + public function setAutoDiscount($autoDiscount) + { + $this->autoDiscount = $autoDiscount; + + return $this; + } } diff --git a/tests/AbstractGeneratorTest.php b/tests/AbstractGeneratorTest.php index 0aba3e8..606763e 100644 --- a/tests/AbstractGeneratorTest.php +++ b/tests/AbstractGeneratorTest.php @@ -129,6 +129,7 @@ protected function createOffers() ->setMarketCategory($this->faker->word) ->setCpa($this->faker->numberBetween(0, 1)) ->setBarcodes([$this->faker->ean13, $this->faker->ean13]) + ->setAutoDiscount($this->faker->boolean) ; } @@ -187,6 +188,7 @@ private function createShopInfo() ->setVersion($this->faker->numberBetween(1, 999)) ->setAgency($this->faker->name) ->setEmail($this->faker->email) + ->setAutoDiscount($this->faker->boolean) ; } diff --git a/tests/dtd/ArtistTitle.dtd b/tests/dtd/ArtistTitle.dtd index 3075d03..aaf32e2 100644 --- a/tests/dtd/ArtistTitle.dtd +++ b/tests/dtd/ArtistTitle.dtd @@ -2,7 +2,7 @@ - + @@ -43,6 +43,7 @@ delivery?, local_delivery_cost?, weight?, + enable_auto_discounts?, artist?, title, year?, @@ -168,6 +169,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + diff --git a/tests/dtd/Audiobook.dtd b/tests/dtd/Audiobook.dtd index 4057ee8..551c888 100644 --- a/tests/dtd/Audiobook.dtd +++ b/tests/dtd/Audiobook.dtd @@ -2,7 +2,7 @@ - + @@ -44,6 +44,7 @@ local_delivery_cost?, weight?, name, + enable_auto_discounts?, author?, publisher?, series?, @@ -176,6 +177,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + diff --git a/tests/dtd/Book.dtd b/tests/dtd/Book.dtd index b66d03c..802daee 100644 --- a/tests/dtd/Book.dtd +++ b/tests/dtd/Book.dtd @@ -2,7 +2,7 @@ - + @@ -29,6 +29,7 @@ days CDATA #REQUIRED order-before CDATA #IMPLIED> + + diff --git a/tests/dtd/Custom.dtd b/tests/dtd/Custom.dtd index 5dd47ab..4f2eb0c 100644 --- a/tests/dtd/Custom.dtd +++ b/tests/dtd/Custom.dtd @@ -2,7 +2,7 @@ - + @@ -47,6 +47,7 @@ deliveryIncluded?, local_delivery_cost?, weight?, + enable_auto_discounts?, orderingTime?, typePrefix?, vendor, @@ -165,6 +166,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + @@ -178,5 +180,5 @@ - - + + diff --git a/tests/dtd/EventTicket.dtd b/tests/dtd/EventTicket.dtd index c2a6aac..1cbb880 100644 --- a/tests/dtd/EventTicket.dtd +++ b/tests/dtd/EventTicket.dtd @@ -2,7 +2,7 @@ - + @@ -44,6 +44,7 @@ local_delivery_cost?, weight?, name, + enable_auto_discounts?, place, date, is_premiere?, @@ -167,6 +168,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + diff --git a/tests/dtd/OfferDeliveryOptions.dtd b/tests/dtd/OfferDeliveryOptions.dtd index d90be5d..cdc5913 100644 --- a/tests/dtd/OfferDeliveryOptions.dtd +++ b/tests/dtd/OfferDeliveryOptions.dtd @@ -2,7 +2,7 @@ - + @@ -46,6 +46,7 @@ local_delivery_cost?, weight?, name, + enable_auto_discounts?, vendor?, description?, sales_notes?, @@ -163,6 +164,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + diff --git a/tests/dtd/Simple.dtd b/tests/dtd/Simple.dtd index d00c81f..5043fa1 100644 --- a/tests/dtd/Simple.dtd +++ b/tests/dtd/Simple.dtd @@ -2,7 +2,7 @@ - + @@ -46,6 +46,7 @@ local_delivery_cost?, weight?, name, + enable_auto_discounts?, vendor?, description?, sales_notes?, @@ -162,6 +163,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> + diff --git a/tests/dtd/Tour.dtd b/tests/dtd/Tour.dtd index 4bb4252..1ad15d8 100644 --- a/tests/dtd/Tour.dtd +++ b/tests/dtd/Tour.dtd @@ -2,7 +2,7 @@ - + @@ -44,6 +44,7 @@ local_delivery_cost?, weight?, name, + enable_auto_discounts?, worldRegion?, country?, region?, @@ -173,6 +174,7 @@ name CDATA #REQUIRED unit CDATA #IMPLIED> +