public function testDeleteError() { $creds = Credentials::get(); // Create a client for our merchant and log in $client = new GSC_Client($creds["merchantId"]); $client->login($creds["email"], $creds["password"]); $product = new GSC_Product(); $type = "application/atom+xml"; $bogusId = "BOGUS_ID_123456789"; $link = $client->getProductUri($bogusId, "US", "en"); $product->setEditLink($link, $type); try { $client->deleteProduct($product); } catch (Exception $e) { $this->assertEquals('Delete request failed.', $e->getMessage()); } }
public function update($editLink = false, $sku = false, $title = false, $description = false, $link = false, $image = false, $price = false, $adult = 'false', $stock = 'in stock') { $product = new GSC_Product(); $type = "application/atom+xml"; try { $product->setContentLanguage('PT-BR'); $product->setTargetCountry('BR'); $product->setSKU($sku); $product->setProductLink($link); $product->setTitle($title); if ($description) { $product->setDescription($description); } $product->setImageLink($image); $product->setBrand(0); $product->setMpn($sku); $product->setPrice($price, "BRL"); $product->setAdult($adult); $product->setAvailability($stock); $product->setCondition("new"); $product->setEditLink($editLink, $type); $this->_client->updateProduct($product); } catch (Exception $e) { $teste = array($sku, $title, $description, $link, $image, $price, $adult, $stock); var_dump($teste); exit; } }