/**
  * @param Product $product
  * @return \DTS\eBaySDK\Trading\Types\AddFixedPriceItemResponseType
  */
 public function post(Product $product)
 {
     $request = new AddFixedPriceItemRequestType();
     $request = $this->addAuthToRequest($request);
     $item = new ItemType();
     $item->ListingType = ListingTypeCodeType::C_FIXED_PRICE_ITEM;
     // Renew the item every 30 days until the user cancels it
     $item->ListingDuration = ListingDurationCodeType::C_GTC;
     $item->InventoryTrackingMethod = 'SKU';
     $item->Title = $product->getTitle();
     $item->Description = $product->getDescription();
     // Mandatory when InvntoryTrackingMethod is set to SKU
     $item->SKU = $product->getSku();
     $item->HitCounter = HitCounterCodeType::C_HIDDEN_STYLE;
     if ($product->hasVariations()) {
         $this->addVariationsData($item, $product);
     } else {
         $item->StartPrice = new AmountType(['value' => $product->getPrice()]);
         $item->Quantity = $product->getQuantity();
     }
     $item->Country = $this->store->getStoreData('country');
     $item->Location = $this->store->getStoreData('location');
     if ($this->store->hasStoreData('postCode')) {
         $item->PostalCode = $this->store->getStoreData('postCode');
     }
     $item->Currency = $product->getCurrency();
     $item->PrimaryCategory = new CategoryType();
     $item->PrimaryCategory->CategoryID = $product->getCategory();
     $item->CategoryMappingAllowed = true;
     // Condition (should be brand new)
     $item->ConditionID = 1000;
     // Add brand information as item specific information
     $item->ItemSpecifics = new NameValueListArrayType();
     if ($product->getBrand()) {
         $brand = new NameValueListType();
         $brand->Name = 'Brand';
         $brand->Value[] = $product->getBrand();
         $item->ItemSpecifics->NameValueList[] = $brand;
     }
     if ($product->getWeight()) {
         // Add details for the shipping
         // NOTE: doesn't seem to work
         $item->ShippingPackageDetails = new ShipPackageDetailsType();
         $item->ShippingPackageDetails->MeasurementUnit = MeasurementSystemCodeType::C_ENGLISH;
         $totalOz = $product->getWeight() * 0.035274;
         $weightMajor = intval(floor($totalOz / 16));
         $weightMinor = intval(floor($totalOz - $weightMajor * 16));
         $item->ShippingPackageDetails->WeightMajor = new MeasureType(['unit' => 'lbs', 'value' => $weightMajor]);
         $item->ShippingPackageDetails->WeightMinor = new MeasureType(['unit' => 'oz', 'value' => $weightMinor]);
     }
     // Add pictures
     $this->addPictures($item, $product);
     // Add payement
     $item->PaymentMethods = $this->store->getPaymentOptions();
     $item->PayPalEmailAddress = $this->store->getPaypalEmail();
     $item->DispatchTimeMax = $this->store->getStoreData('dispatchTime');
     // Add shipping options and return policy
     $this->addShippingOptions($item, $product->getShippingOptions());
     $this->addReturnPolicy($item, $product->getReturnPolicy());
     $request->Item = $item;
     $response = $this->service->addFixedPriceItem($request);
     if ($response->Ack == 'Failure') {
         $this->handleError($response);
     }
     return $response;
 }
 /**
  * @param $eBayProduct
  * @param Product $product
  * @return bool
  */
 private function hasChanged($eBayProduct, Product $product)
 {
     $ebayTitle = $eBayProduct->Title;
     $currentTitle = $product->getTitle();
     if ($ebayTitle != $currentTitle) {
         return true;
     }
     $ebayDescription = htmlentities($eBayProduct->Description);
     $currentDescription = $product->getDescription();
     if ($ebayDescription != $currentDescription) {
         return true;
     }
     $currentBrand = $product->getBrand();
     $ebayBrand = '';
     foreach ($eBayProduct->ItemSpecifics->NameValueList as $specific) {
         if ($specific->Name == 'Brand') {
             $ebayBrand = $specific->Value[0];
         }
     }
     if ($ebayBrand != $currentBrand) {
         return true;
     }
     $currentPictures = $product->getPictures();
     $ebayPictures = $eBayProduct->PictureDetails->ExternalPictureURL;
     foreach ($ebayPictures as $ebayPicture) {
         if (!in_array($ebayPicture, $currentPictures)) {
             return true;
         }
     }
     if ($product->hasVariations()) {
         $separated = $this->separateVariations($eBayProduct, $product);
         $foundVariations = $separated['found'];
         $newVariations = $separated['new'];
         if (count($newVariations) > 0) {
             return true;
         }
         foreach ($eBayProduct->Variations->Variation as $ebayVariation) {
             if (!in_array($ebayVariation, $foundVariations)) {
                 return true;
             }
         }
     }
     return false;
 }