예제 #1
0
 /**
  * Add a offer to the response.
  *
  * @param string $type
  * @param string $condition
  * @param Offer $offer
  *
  * @throws InvalidArgumentException
  */
 public function addOffer($type, $condition, Offer $offer)
 {
     Arguments::contain(Boa::in(OfferType::getValues()), Boa::in(OfferCondition::getValues()), Boa::instance(Offer::class))->check($type, $condition, $offer);
     if ($type === OfferType::TYPE_FBA) {
         if ($condition === OfferCondition::CONDITION_NEW) {
             $this->fbaNewOffers[] = $offer;
         } elseif ($condition === OfferCondition::CONDITION_USED) {
             $this->fbaUsedOffers[] = $offer;
         }
     } elseif ($type === OfferType::TYPE_MERCHANT_FULFILLED) {
         if ($condition === OfferCondition::CONDITION_NEW) {
             $this->merchantNewOffers[] = $offer;
         } elseif ($condition === OfferCondition::CONDITION_USED) {
             $this->merchantUsedOffers[] = $offer;
         }
     }
 }
예제 #2
0
 /**
  * Get a category by ID
  *
  * @param string $categoryId
  *
  * @return GetCategoryByIdResponse
  */
 public function getCategoryById($categoryId)
 {
     Arguments::contain(Boa::string())->check($categoryId);
     return (new CategoryResponseFactory())->makeFromResponse($this->client->get(vsprintf('/v1/getCategoryById/%s', [$categoryId])));
 }