/** * sample_VerifyAddItem::dispatchCall() * * Dispatch the call * * @param array $params array of parameters for the eBay API call * * @return boolean success */ public function dispatchCall($params) { $req = new VerifyAddItemRequestType(); $item = new ItemType(); $item->setTitle($params['Title']); $item->setQuantity($params['Quantity']); $item->setCurrency($params['Currency']); $item->setCountry($params['Country']); $item->setStartPrice($params['StartPrice']); $item->setListingDuration($params['ListingDuration']); $item->setLocation($params['Location']); $item->setPaymentMethods($params['PaymentMethods']); $item->setListingType($params['ListingType']); $item->setDescription($params['Description']); $primaryCategory = new CategoryType(); $primaryCategory->setCategoryID($params['CategoryID']); $item->setPrimaryCategory($primaryCategory); $req->setItem($item); $res = $this->proxy->VerifyAddItem($req); if ($this->testValid($res)) { $this->dumpObject($res); return true; } else { return false; } }
function verifyAddItem($id, $session) { // skip this item if item status not allowed $allowed_statuses = array('prepared', 'verified'); if (!$this->itemHasAllowedStatus($id, $allowed_statuses)) { return $this->result; } // build item $ibm = new ItemBuilderModel(); $item = $ibm->buildItem($id, $session); if (!$ibm->checkItem($item)) { return $ibm->result; } // eBay Motors (beta) if ($item->Site == 'eBayMotors') { $session->setSiteId(100); } // preparation - set up new ServiceProxy with given session $this->initServiceProxy($session); // switch to FixedPriceItem if product has variations $listing_item = self::getItem($id); // $useFixedPriceItem = ( ProductWrapper::hasVariations( $listing_item['post_id'] ) ) ? true : false; // $useFixedPriceItem = ( 'FixedPriceItem' == $listing_item['auction_type'] ) ? true : false; WPLE()->logger->info("Verifying #{$id}: " . $item->Title); if (self::listingUsesFixedPriceItem($listing_item)) { $req = new VerifyAddFixedPriceItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->VerifyAddFixedPriceItem($req); } else { $req = new VerifyAddItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->VerifyAddItem($req); } // handle response and check if successful if ($this->handleResponse($res)) { // save listing fees to db $listingFee = self::getListingFeeFromResponse($res); // $data['ebay_id'] = $res->ItemID; $data['fees'] = $listingFee; $data['status'] = 'verified'; self::updateListing($id, $data); WPLE()->logger->info("Item #{$id} verified with ebay, getAck(): " . $res->getAck()); } // call successful self::processErrorsAndWarnings($id, $this->result); return $this->result; }