Source of file Sell.php
Size: 19,553 Bytes - Last Modified: 2015-04-17T00:11:29+02:00
/www-data/git/ricardo/src/Diglin/Ricardo/Services/Sell.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723 | <?php /** * Diglin GmbH - Switzerland * * This file is part of a Diglin GmbH module. * * This Diglin GmbH module is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This script is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * @author Sylvain Rayé <support at diglin.com> * @category Diglin * @package Diglin_Ricardo * @copyright Copyright (c) 2011-2015 Diglin (http://www.diglin.com) * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) */ namespace Diglin\Ricardo\Services; use Diglin\Ricardo\Managers\Sell\Parameter\AddArticlePicturesParameter; use Diglin\Ricardo\Managers\Sell\Parameter\AppendArticleDescriptionParameter; use Diglin\Ricardo\Managers\Sell\Parameter\CloseArticleParameter; use Diglin\Ricardo\Managers\Sell\Parameter\CloseArticlesParameter; use Diglin\Ricardo\Managers\Sell\Parameter\DeletePlannedArticleParameter; use Diglin\Ricardo\Managers\Sell\Parameter\DeletePlannedArticlesParameter; use Diglin\Ricardo\Managers\Sell\Parameter\GetArticlesFeeParameter; use Diglin\Ricardo\Managers\Sell\Parameter\InsertArticleParameter; use Diglin\Ricardo\Managers\Sell\Parameter\InsertArticlesParameter; use Diglin\Ricardo\Managers\Sell\Parameter\UpdateArticleParameter; use Diglin\Ricardo\Managers\Sell\Parameter\UpdateArticlePicturesParameter; /** * Class Sell * * This service is to be used to manage your articles as a seller: you can list, relist, modify, close an article ... * * @package Diglin\Ricardo\Services * @link https://ws.ricardo.ch/RicardoApi/documentation/html/T_Ricardo_Contracts_ISellService.htm */ class Sell extends ServiceAbstract { /** * @var string */ protected $_service = 'SellService'; /** * @var string */ protected $_typeOfToken = self::TOKEN_TYPE_IDENTIFIED; /** * Adds the article pictures. * * @param AddArticlePicturesParameter $addArticlePicturesParameter * @return array */ public function addArticlePictures(AddArticlePicturesParameter $addArticlePicturesParameter) { return array( 'method' => 'AddArticlePictures', 'params' => array('addArticlePicturesParameter' => $addArticlePicturesParameter->getDataProperties()) ); } /** * Get the article fee * * The Ricardo API returns: * <pre> * { * "AddArticlePicturesResult": { * "ArticleFee": "float" * } * } * </pre> * * @param array $data * @return bool */ public function addArticlePicturesResult($data) { if (isset($data['AddArticlePicturesResult'])) { return $data['AddArticlePicturesResult']; } return false; } /** * Appends the article description. * * @param AppendArticleDescriptionParameter $appendArticleDescriptionParameter * @return array */ public function appendArticleDescription(AppendArticleDescriptionParameter $appendArticleDescriptionParameter) { return array( 'method' => 'AppendArticleDescription', 'params' => array('appendArticleDescriptionParameter' => $appendArticleDescriptionParameter->getDataProperties()) ); } /** * Nothing to return normally, we keep for errors or to have consistent API * * @param array $data * @return array */ public function appendArticleDescriptionResult(array $data) { return $data; } /** * Closes the article. * * @param CloseArticleParameter $closeArticleParameter * @return array */ public function closeArticle(CloseArticleParameter $closeArticleParameter) { return array( 'method' => 'CloseArticle', 'params' => array('closeArticleParameter' => $closeArticleParameter->getDataProperties()) ); } /** * Get the result of the closed article * * The Ricardo API returns: * <pre> * { * "CloseArticleResult": { * "ArticleNr": "int" * "IsClosed": "bool" * } * } * </pre> * * @param array $data * @return array|bool */ public function closeArticleResult(array $data) { if (isset($data['CloseArticleResult'])) { return $data['CloseArticleResult']; } return false; } /** * Closes a list of articles. * * @param CloseArticlesParameter $closeArticlesParameter * @return array */ public function closeArticles(CloseArticlesParameter $closeArticlesParameter) { return array( 'method' => 'CloseArticles', 'params' => array('closeArticlesParameter' => $closeArticlesParameter->getDataProperties()) ); } /** * Get the result of the closed articles * * The Ricardo API returns: * <pre> * { * "CloseArticlesResult": * "CloseArticleResults": * [{ * "ArticleNr": "int" * "IsClosed": "bool" * }, * { * "ArticleNr": "int" * "IsClosed": "bool" * }] * } * </pre> * * @param array $data * @return array|bool */ public function closeArticlesResult(array $data) { if (isset($data['CloseArticlesResult']) && isset($data['CloseArticlesResult']['CloseArticleResults'])) { return $data['CloseArticlesResult']['CloseArticleResults']; } return false; } /** * Closes the classified. * * @param $closeClassifiedParameter */ public function closeClassified($closeClassifiedParameter) { } /** * Closes list of classified. * * @param $closeClassifiedsParameter */ public function closeClassifieds($closeClassifiedsParameter) { } /** * Deletes the planned article. * * @param DeletePlannedArticleParameter $deletePlannedArticleParameter * @return array */ public function deletePlannedArticle(DeletePlannedArticleParameter $deletePlannedArticleParameter) { return array( 'method' => 'DeletePlannedArticle', 'params' => array('deletePlannedArticleParameter' => $deletePlannedArticleParameter->getDataProperties()) ); } /** * Get the result of the deleted article * * The Ricardo API returns: * <pre> * { * "DeletePlannedArticleResult": { * "PlannedArticleId": "int" * "PlannedIndex": "int" * "IsClosed": "bool" * } * } * </pre> * * @param array $data * @return array|bool */ public function deletePlannedArticleResult(array $data) { if (isset($data['DeletePlannedArticleResult'])) { return $data['DeletePlannedArticleResult']; } return false; } /** * Deletes the planned articles. * * @param DeletePlannedArticlesParameter $deletePlannedArticleParameter * @return array */ public function deletePlannedArticles(DeletePlannedArticlesParameter $deletePlannedArticleParameter) { return array( 'method' => 'DeletePlannedArticles', 'params' => array('deletePlannedArticlesParameter' => $deletePlannedArticleParameter->getDataProperties()) ); } /** * Get the result of the deleted articles * * The Ricardo API returns: * <pre> * { * "DeletePlannedArticlesResult": * "DeleteResults": [{ * "PlannedArticleId": "int" * "PlannedIndex": "int" * "IsClosed": "bool" * }] * } * </pre> * * @param array $data * @return array|bool */ public function deletePlannedArticlesResult(array $data) { if (isset($data['DeletePlannedArticlesResult']) && isset($data['DeletePlannedArticlesResult']['DeleteResults'])) { return $data['DeletePlannedArticlesResult']['DeleteResults']; } return false; } /** * Gets the article fee. * * @param $getArticleFeeParameter * @return array */ public function getArticleFee($getArticleFeeParameter) { } public function getArticleFeeResult($getArticleFeeParameter) { } /** * @param GetArticlesFeeParameter $getArticlesFeeParameter * @return array */ public function getArticlesFee(GetArticlesFeeParameter $getArticlesFeeParameter) { return array( 'method' => 'GetArticlesFee', 'params' => array('getArticlesFeeParameter' => $getArticlesFeeParameter->getDataProperties()) ); } /** * @param array $data * @return bool * * [0] => Array ( [CoveredByPLP] => [ListingFee] => 0 [PromotionFees] => Array ( [0] => Array ( [PromotionFee] => 0 [PromotionId] => 4194304 ) [1] => Array ( [PromotionFee] => 0 [PromotionId] => 8388608 ) [...] => ... ) [TotalFee] => 5 ) */ public function getArticlesFeeResult(array $data) { if (isset($data['GetArticlesFeeResult']) && isset($data['GetArticlesFeeResult']['ArticlesFee'])) { return $data['GetArticlesFeeResult']['ArticlesFee']; } return false; } /** * Gets the update article fee. * * @param $getUpdateArticleFeeParameter */ public function getUpdateArticleFee($getUpdateArticleFeeParameter) { } /** * Gets the update classified fee. * * @param $getUpdateClassifiedFeeParameter */ public function getUpdateClassifiedFee($getUpdateClassifiedFeeParameter) { } /** * Inserts an article or a planned article * * @param $insertArticleParameter * @return array */ public function insertArticle(InsertArticleParameter $insertArticleParameter) { return array( 'method' => 'InsertArticle', 'params' => array('insertArticleParameter' => $insertArticleParameter->getDataProperties()) ); } /** * Get the article result data * * The Ricardo API returns: * <pre> * { * "InsertArticleResult": { * "ArticleFee": [{ * "ListingFee": "float" * "TotalFee": "float" * "PromotionFees": [{ * "PromotionFee": "float" * "PromotionId": "int" * }] * }] * "ArticleId": "int" * "CarDealerArticleId": "int" * "ErrorCodes": "int" ArticleErrors * "PlannedArticleId": "int" * } * } * </pre> * * @param array $data * @return array|bool */ public function insertArticleResult(array $data) { if (isset($data['InsertArticleResult'])) { return $data['InsertArticleResult']; } return false; } /** * Inserts a list of articles or a planned articles. This method is currently not fully usable to external partners * * @param InsertArticlesParameter $insertArticlesParameter * @return array */ public function insertArticles(InsertArticlesParameter $insertArticlesParameter) { return array( 'method' => 'InsertArticles', 'params' => array('insertArticlesParameter' => $insertArticlesParameter->getDataProperties()) ); } /** * Get the article result data * * The Ricardo API returns: * <pre> * { * "InsertArticlesResult": { * "Results": [{ * "ArticleFee": "float" * "ArticleId": "int" * "CarDealerArticleId": "int" * "CorrelationKey": "int" * "ErrorCodes": "int" ArticleErrors * "ErrorCodesType": "int" @see https://ws.ricardo.ch/RicardoApi/documentation/html/T_Ricardo_Enums_Errors_ErrorList.htm * "PlannedArticleId": "int" * }] * } * </pre> * * @param array $data * @return array|bool */ public function insertArticlesResult(array $data) { if (isset($data['InsertArticlesResult']) && isset($data['InsertArticlesResult']['Results'])) { return $data['InsertArticlesResult']['Results']; } return false; } /** * Inserts the classified. * * @param $insertClassifiedParameter */ public function insertClassified($insertClassifiedParameter) { } /** * Insert a list of classified items. This method is currently not fully usable to external partners * * @param $insertClassifiedsParameter */ public function insertClassifieds($insertClassifiedsParameter) { } /** * Inserts the preview converted classified. * * @param $insertPreviewConvertedClassifiedParameter */ public function insertPreviewConvertedClassified($insertPreviewConvertedClassifiedParameter) { } /** * Ocrs recognition. * * @param $ocrRecognizesParameter */ public function ocrRecognize($ocrRecognizesParameter) { } /** * @param $parameters * @return array */ public function relistArticle($parameters) { $articleId = $parameters['ArticleId']; $antiforgeryToken = $parameters['AntiforgeryToken']; return array( 'method' => 'RelistArticle', 'params' => array('relistArticleParameter' => array('ArticleId', $articleId, 'AntiforgeryToken' => $antiforgeryToken)) ); } /** * Relists the auction articles. This method is currently not fully usable to external partners * * @param array $articleIds * @return array */ public function relistArticles($articleIds) { return array( 'method' => 'RelistArticles', 'params' => array('relistArticlesParameter' => array('ArticleId', $articleIds)) ); } /** * Relists the auction articles without modification. This method is currently not fully usable to external partners * * @param $relistArticlesWithoutModificationParameter */ public function relistArticlesWithoutModification($relistArticlesWithoutModificationParameter) { } /** * Relists the article without modifing it. * * @param $relistArticleWithoutModificationParameter */ public function relistArticleWithoutModification($relistArticleWithoutModificationParameter) { } /** * Relists the classified. * * @param $relistClassifiedParameter */ public function relistClassified($relistClassifiedParameter) { } /** * Relists the classified articles. This method is currently not fully usable to external partners * * @param $relistClassifiedsParameter */ public function relistClassifieds($relistClassifiedsParameter) { } /** * Relists the classified article without modification. This method is currently not fully usable to external partners * * @param $relistClassifiedsWithoutModificationParameter */ public function relistClassifiedsWithoutModification($relistClassifiedsWithoutModificationParameter) { } /** * Relists the classified Without Modification. * * @param $relistClassifiedWithoutModificationParameter */ public function relistClassifiedWithoutModification($relistClassifiedWithoutModificationParameter) { } /** * Ocrs recognition. * * @param $ocrRecognizesParameter */ public function tesseractRecognize($ocrRecognizesParameter) { } /** * Updates the article. * * @param UpdateArticleParameter $updateArticleParameter * @return array */ public function updateArticle(UpdateArticleParameter $updateArticleParameter) { return array( 'method' => 'UpdateArticle', 'params' => array('updateArticleParameter' => $updateArticleParameter->getDataProperties()) ); } /** * Get the article result data * * The Ricardo API returns: * <pre> * { * "UpdateArticleResult": { * "ArticleFee": "float" * } * } * </pre> * * @param array $data * @return bool|array */ public function updateArticleResult(array $data) { if (isset($data['UpdateArticleResult'])) { return $data['UpdateArticleResult']; } return false; } /** * Updates the article buy now price. * * @param $updateArticleBuyNowPriceParameter */ public function updateArticleBuyNowPrice($updateArticleBuyNowPriceParameter) { } /** * Updates the article buy now quantity. * * @param $updateArticleBuyNowQuantityParameter */ public function updateArticleBuyNowQuantity($updateArticleBuyNowQuantityParameter) { } /** * Updates the article buy now relist count. * * @param $updateArticleBuyNowRelistCountParameter */ public function updateArticleBuyNowRelistCount($updateArticleBuyNowRelistCountParameter) { } /** * Updates the article pictures. * * @param UpdateArticlePicturesParameter $updateArticlePicturesParameter * @return array */ public function updateArticlePictures(UpdateArticlePicturesParameter $updateArticlePicturesParameter) { return array( 'method' => 'UpdateArticlePictures', 'params' => array('updateArticlePicturesParameter' => $updateArticlePicturesParameter->getDataProperties()) ); } /** * Nothing to return normally, we keep for errors or to have consistent API * * @param $data * @return array */ public function updateArticlePicturesResult($data) { return $data; } /** * Updates the classified. * * @param $updateClassifiedParameter */ public function updateClassified($updateClassifiedParameter) { } /** * Update classified pictures' * * @param $updateClassifiedPicturesParameter */ public function updateClassifiedPictures($updateClassifiedPicturesParameter) { } /** * Updates the planned article. * * @param $updatePlannedArticleParameter */ public function updatePlannedArticle($updatePlannedArticleParameter) { } /** * Upd * * @param $updatePlannedArticlePicturesParameter */ public function updatePlannedArticlePictures($updatePlannedArticlePicturesParameter) { } } |