Source of file System.php
Size: 33,238 Bytes - Last Modified: 2015-02-05T12:57:19+01:00
/www-data/git/ricardo/src/Diglin/Ricardo/Services/System.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229 | <?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; /** * Class System * * This service exposes referential data about the ricardo's system, for example available languages, list of categories, list of possible packages * * @package Diglin\Ricardo\Services * @link https://ws.ricardo.ch/RicardoApi/documentation/html/Methods_T_Ricardo_Contracts_ISystemService.htm */ class System extends ServiceAbstract { /** * @var string */ protected $_service = 'SystemService'; /** * @var string */ protected $_typeOfToken = self::TOKEN_TYPE_ANONYMOUS; /** * Gets all errors code list. * * @return array */ public function getAllErrorsCodes() { return array( 'method' => 'GetAllErrorsCodes', 'params' => array('getAllErrorsCodesParameter' => array()) ); } /** * Gets the result article conditions list * * The Ricardo API returns: * <pre> * { * "GetAllErrorsCodesResult": { * "ErrorNamespaceResults": [{ * "Errors": [{ * "ErrorId": "INT", * "ErrorText": "TEXT" * }], * "NameSpace": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getAllErrorsCodesResult(array $data) { if (isset($data['GetAllErrorsCodesResult']) && isset($data['GetAllErrorsCodesResult']['ErrorNamespaceResults'])) { return $data['GetAllErrorsCodesResult']['ErrorNamespaceResults']; } return array(); } /** * Gets if on the current country the user is allowed to activate is account. * * @return array */ // public function getAllowedToActivateAccount() // { // return array( // 'method' => 'GetAllowedToActivateAccount', // 'params' => array('getAllowedToActivateAccountParameter' => array()) // ); // } /** * Gets the article conditions list * * @return array */ public function getArticleConditions() { $isGroup = false; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['is_group'])) ? $isGroup = $args[0]['is_group'] : ''; }; return array( 'method' => 'GetArticleConditions', 'params' => array('getArticleConditionsParameter' => array('IsGroup' => (bool) $isGroup)) ); } /** * Gets the result article conditions list * * The Ricardo API returns: * <pre> * { * "GetArticleConditionsResult": { * "ArticleConditions": [{ * "ArticleConditionId": "ID", * "ArticleConditionText": "TEXT", * "IsGroup": "TEXT" * }, * { * "ArticleConditionId": "ID", * "ArticleConditionText": "TEXT", * "IsGroup": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getArticleConditionsResult(array $data) { if (isset($data['GetArticleConditionsResult']) && isset($data['GetArticleConditionsResult']['ArticleConditions'])) { return $data['GetArticleConditionsResult']['ArticleConditions']; } return array(); } /** * Get the product availabilities. * * @return array */ public function getAvailabilities() { return array( 'method' => 'GetAvailabilities', 'params' => array('getAvailabilitiesParameter' => array()) ); } /** * Get the product availabilities. * * The Ricardo API returns: * <pre> * { * "GetAvailabilitiesResult": { * "Availabilities": [{ * "AvailabilityId": "ID", * "AvailabilityText": "TEXT" * }, * { * "AvailabilityId": "ID", * "AvailabilityText": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getAvailabilitiesResult(array $data) { if (isset($data['GetAvailabilitiesResult']) && isset($data['GetAvailabilitiesResult']['Availabilities'])) { return $data['GetAvailabilitiesResult']['Availabilities']; } return array(); } /** * Gets the categories list * AllCategories: * - 0 = Doesn't filter any categories * - 1 = Filter the categories without branding ones * - 2 = Filter categories to get only the branding ones * * @return array */ public function getCategories() { $categoryBrandingFilter = 0; $onlyAllowToSell = true; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['category_branding_filter'])) ? $categoryBrandingFilter = $args[0]['category_branding_filter'] : ''; (isset($args[0]['only_allow_to_sell'])) ? $onlyAllowToSell = $args[0]['only_allow_to_sell'] : ''; } return array( 'method' => 'GetCategories', 'params' => array('getCategoriesParameter' => array('CategoryBrandingFilter' => (int) $categoryBrandingFilter, 'OnlyAllowToSell' => (int) $onlyAllowToSell)) ); } /** * Gets the categories list result * * The Ricardo API returns: * <pre> * { * "GetCategoriesResult": { * "Categories": [{ * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }, * { * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getCategoriesResult(array $data) { if (isset($data['GetCategoriesResult']) && isset($data['GetCategoriesResult']['Categories'])) { return $data['GetCategoriesResult']['Categories']; } return array(); } /** * Get a category * * @param int $categoryId * @return array */ public function getCategory($categoryId) { return array( 'method' => 'GetCategory', 'params' => array('getCategoryParameter' => array('CategoryId' => (int) $categoryId)) ); } /** * Get a category result * * The Ricardo API returns: * <pre> * { * "GetCategoriesResult": { * "Category": [{ * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getCategoryResult(array $data) { if (isset($data['GetCategoryResult']) && isset($data['GetCategoryResult']['Category'])) { return $data['GetCategoryResult']['Category']; } return array(); } /** * Gets the countries. * * @return array */ public function getCountries() { return array( 'method' => 'GetCountries', 'params' => array('getCountriesParameter' => array()) ); } /** * Get the countries result * * The Ricardo API returns: * <pre> * { * "GetCountriesResult": { * "Countries": [{ * "CountryId": "INT", * "CountryName": "TEXT", * }, * { * "CountryId": "INT", * "CountryName": "TEXT", * }] * } * } * </pre> * * @param array $data * @return array */ public function getCountriesResult(array $data) { if (isset($data['GetCountriesResult']) && isset($data['GetCountriesResult']['Countries'])) { return $data['GetCountriesResult']['Countries']; } return array(); } /** * Gets the 2 letter country ISO. * * @FIXME seems to not work on Ricardo side * * @param string $ip * @return array */ public function getCountryIso($ip) { return array( 'method' => 'GetCountryIso', 'params' => array('countryIsoParameter' => array('IpAddress' => $ip)) ); } /** * Gets the 2 letter country ISO result * * The Ricardo API returns: * <pre> * { * "GetCountryIsoResult": { * "CountryIso": [{ * "CountryId": "INT", * "CountryName": "TEXT", * }, * { * "CountryId": "INT", * "CountryName": "TEXT", * }] * } * } * </pre> * * @param array $data * @return array */ public function getCountryIsoResult(array $data) { if (isset($data['GetCountryIsoResult']) && isset($data['GetCountryIsoResult']['CountryIso'])) { return $data['GetCountryIsoResult']['CountryIso']; } return array(); } /** * Gets the delivery conditions. * * @return array */ public function getDeliveryConditions() { return array( 'method' => 'GetDeliveryConditions', 'params' => array('getDeliveryConditionsParameter' => array()) ); } /** * Get the delivery conditions result * * The Ricardo API returns: * <pre> * { * "GetDeliveryConditionsResult": { * "DeliveryConditions": [{ * "DeliveryConditionId": "INT", * "DeliveryConditionText": "TEXT", * "DeliveryCost": "INT" * "PackageSizes": [ * { * "PackageSizeCost": "INT" * "PackageSizeId": "INT" * "PackageSizeText": "TEXT" * }, * { * "PackageSizeCost": "INT" * "PackageSizeId": "INT" * "PackageSizeText": "TEXT" * } * ]}, * }, * "DeliveryConditionId": "INT", * "DeliveryConditionText": "TEXT", * "DeliveryCost": "INT" * "PackageSizes": [ * { * "PackageSizeCost": "INT" * "PackageSizeId": "INT" * "PackageSizeText": "TEXT" * }, * { * "PackageSizeCost": "INT" * "PackageSizeId": "INT" * "PackageSizeText": "TEXT" * } * ]} * } * } * </pre> * * @param array $data * @return array */ public function getDeliveryConditionsResult(array $data) { if (isset($data['GetDeliveryConditionsResult']) && isset($data['GetDeliveryConditionsResult']['DeliveryConditions'])) { return $data['GetDeliveryConditionsResult']['DeliveryConditions']; } return array(); } /** * Gets the first childs categories. * * @return array */ public function getFirstChildsCategories() { $categoryBrandingFilter = 0; $onlyAllowToSell = true; $categoryId = 0; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['category_branding_filter'])) ? $categoryBrandingFilter = $args[0]['category_branding_filter'] : ''; (isset($args[0]['only_allow_to_sell'])) ? $onlyAllowToSell = $args[0]['only_allow_to_sell'] : ''; (isset($args[0]['category_id'])) ? $categoryId = $args[0]['category_id'] : ''; } return array( 'method' => 'GetFirstChildsCategories', 'params' => array('getFirstChildsCategoriesParameter' => array( 'CategoryBrandingFilter' => $categoryBrandingFilter, 'CategoryId' => (int) $categoryId, 'OnlyAllowToSell' => (int) $onlyAllowToSell)) ); } /** * Gets the first childs categories result * * The Ricardo API returns: * <pre> * { * "GetFirstChildsCategoriesResult": { * "Categories": [{ * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }, * { * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getFirstChildsCategoriesResult(array $data) { if (isset($data['GetFirstChildsCategoriesResult']) && isset($data['GetFirstChildsCategoriesResult']['Categories'])) { return $data['GetFirstChildsCategoriesResult']['Categories']; } return array(); } /** * Gets available headers and footers * * @return array */ // public function getHeaderAndFooterTexts() // { // return array( // 'method' => 'GetHeaderAndFooterTexts', // 'params' => array('getHeaderAndFooterTextsParameter' => array()) // ); // } // // public function getHeaderAndFooterTextsResult(array $data) // { // if (isset($data['GetHeaderAndFooterTextsResult']) && isset($data['GetHeaderAndFooterTextsResult']['HeadersAndFooters'])) { // return $data['GetHeaderAndFooterTextsResult']['HeadersAndFooters']; // } // // return array(); // } /** * Gets the increment. * * @return array */ // public function getIncrements() // { // return array( // 'method' => 'GetIncrements', // 'params' => array('getIncrementsParameter' => array()) // ); // } /** * Gets the languages. * * @return array */ public function getLanguages() { return array( 'method' => 'GetLanguages', 'params' => array('getLanguagesParameter' => array()) ); } /** * Get the languages result * * The Ricardo API returns: * <pre> * { * "GetLanguagesResult": { * "Languages": [{ * "IsMainLanguage": "INT", * "LanguageId": "INT", * "LanguageText": "TEXT", * }, * { * "IsMainLanguage": "INT", * "LanguageId": "INT", * "LanguageText": "TEXT", * }] * } * } * </pre> * * @param array $data * @return array */ public function getLanguagesResult(array $data) { if (isset($data['GetLanguagesResult']) && isset($data['GetLanguagesResult']['Languages'])) { return $data['GetLanguagesResult']['Languages']; } return array(); } /** * Gets list of listing packages * * @param int $packageType * @return array */ public function getPackages($packageType = 0) { return array( 'method' => 'GetPackages', 'params' => array('getPackagesParameter' => array('PackageType' => (int) $packageType)) ); } /** * Get the languages result * * The Ricardo API returns: * <pre> * { * "GetPackagesResult": { * "Packages": [{ * "PackageId": "INT", * "PackagePrice": "INT", * "PackageSize": "INT", * }, * { * "PackageId": "INT", * "PackagePrice": "INT", * "PackageSize": "INT", * }] * } * } * </pre> * * @param array $data * @return array */ public function getPackagesResult(array $data) { if (isset($data['GetPackagesResult']) && isset($data['GetPackagesResult']['Packages'])) { return $data['GetPackagesResult']['Packages']; } return array(); } /** * Gets the parents categories. * * @param int $categoryId * @return array */ public function getParentsCategories($categoryId) { return array( 'method' => 'GetParentsCategories', 'params' => array('getParentsCategoriesParameter' => array('CategoryId' => (int) $categoryId)) ); } /** * Gets the parents categories result * * The Ricardo API returns: * <pre> * { * "GetParentsCategoriesResult": { * "Categories": [{ * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }, * { * "ArticleTypeId": "INT", * "CategoryId": "INT", * "CategoryName": "TEXT", * "CategoryNameRewritten": "TEXT", * "CategoryTypeId": "INT", * "IsBranding": "INT", * "IsFinal": "INT", * "Level": "INT", * "ParentId": "INT", * "PartialUrl": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getParentsCategoriesResult(array $data) { if (isset($data['GetParentsCategoriesResult']) && isset($data['GetParentsCategoriesResult']['Categories'])) { return $data['GetParentsCategoriesResult']['Categories']; } return array(); } /** * Gets the partner configurations. * * @return array */ public function getPartnerConfigurations() { return array( 'method' => 'GetPartnerConfigurations', 'params' => array('getPartnerConfigurationsParameter' => array()) ); } /** * Get the partner configuration result * * The Ricardo API returns: * <pre> * Array * ( * [CurrencyId] => 2 * [CurrencyPrefix] => CHF * [CurrencySuffix] => * [DataProtectionUrl] => http://www.ricardo.ch/ueber-uns/de-ch/reglemente.aspx * [DecimalSeparator] => . * [DefaultSellingDuration] => 7 * [DomainName] => ch.betaqxl.com * [GrantedDescriptionTags] => Array * ( * [0] => b * [1] => br * [2] => center * [3] => ... * ) * [LangIso] => DE * [LanguageId] => 2 * [MaxRelistCount] => 9 * [MaxSellingDuration] => 10 * [MaximumPicturesToUpload] => 10 * [MinSellingDuration] => 1 * [MinimumAgeOnSite] => 18 * [PictureServer] => images.betaqxl.com * [TermsConditionsUrl] => http://www.ricardo.ch/ueber-uns/de-ch/reglemente.aspx * ) * </pre> * * @param array $data * @return array */ public function getPartnerConfigurationsResult(array $data) { if (isset($data['GetPartnerConfigurationsResult'])) { return $data['GetPartnerConfigurationsResult']; } return array(); } /** * Gets the payment conditions. * * @param int $paymentMethodId * @return array */ public function getPaymentConditions($paymentMethodId = null) { // $paymentMethodId has no effect on the Ricardo API side ! @fixme return array( 'method' => 'GetPaymentConditions', 'params' => array('getPaymentConditionsParameter' => array('PaymentMethodId' => (int) $paymentMethodId)) ); } /** * Get the payment conditions result * * The Ricardo API returns: * <pre> * { * "GetPaymentConditionsResult": { * "PaymentConditions": [{ * "PaymentConditionId": "INT", * "PaymentConditionText": "TEXT", * "PaymentMethods": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getPaymentConditionsResult(array $data) { if (isset($data['GetPaymentConditionsResult']) && isset($data['GetPaymentConditionsResult']['PaymentConditions'])) { return $data['GetPaymentConditionsResult']['PaymentConditions']; } return array(); } /** * Gets the payment conditions and payment function associated. * * @param int $paymentMethodId * @return array */ public function getPaymentConditionsAndMethods($paymentMethodId = null) { // $paymentMethodId has no effect on the Ricardo API side ! @fixme return array( 'method' => 'GetPaymentConditionsAndMethods', 'params' => array('getPaymentConditionsParameter' => array('PaymentMethodId' => (int) $paymentMethodId)) ); } /** * Gets the payment conditions and payment function associated result * * The Ricardo API returns: * <pre> * { * "GetPaymentConditionsResult": { * "PaymentConditions": [{ * "PaymentConditionId": "INT", * "PaymentConditionText": "TEXT", * "PaymentMethods": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getPaymentConditionsAndMethodsResult(array $data) { if (isset($data['GetPaymentConditionsAndMethodsResult']) && isset($data['GetPaymentConditionsAndMethodsResult']['PaymentConditions'])) { return $data['GetPaymentConditionsAndMethodsResult']['PaymentConditions']; } return array(); } /** * Gets the payment methods. * * @return array */ public function getPaymentMethods() { // $paymentConditionId has no effect on the Ricardo API side ! @fixme $onlyAllowToSell = true; $paymentConditionId = null; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['only_allow_to_sell'])) ? $onlyAllowToSell = $args[0]['only_allow_to_sell'] : ''; (isset($args[0]['payment_condition_id'])) ? $paymentConditionId = $args[0]['payment_condition_id'] : ''; } return array( 'method' => 'GetPaymentMethods', 'params' => array('getPaymentMethodsParameter' => array('OnlyAllowToSell' => (int) $onlyAllowToSell, 'PaymentConditionId' => (int) $paymentConditionId )) ); } /** * Gets the payment methods result * * The Ricardo API returns: * <pre> * { * "GetPaymentMethodsResult": { * "PaymentMethods": [{ * "PaymentMethodId": "INT", * "PaymentMethodText": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getPaymentMethodsResult(array $data) { if (isset($data['GetPaymentMethodsResult']) && isset($data['GetPaymentMethodsResult']['PaymentMethods'])) { return $data['GetPaymentMethodsResult']['PaymentMethods']; } return array(); } /** * Gets the phone prefixes. * * @return array */ public function getPhonePrefixes() { return array( 'method' => 'GetPhonePrefixes', 'params' => array('getPhonePrefixesParameter' => array()) ); } /** * Gets the phone prefixes result * * The Ricardo API returns: * <pre> * { * "GetPhonePrefixesResult": { * "AllTelCodes": [{ * "PaymentMethodId": "INT", * "PaymentMethodText": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getPhonePrefixesResult(array $data) { if (isset($data['GetPhonePrefixesResult']) && isset($data['GetPhonePrefixesResult']['AllTelCodes'])) { return $data['GetPhonePrefixesResult']['AllTelCodes']; } return array(); } /** * Gets the promotions. * * @return array */ public function getPromotions() { $articleStartDate = null; $articleType = 0; // All: 0, Auction: 1, BuyNow: 2, Classified: 3 $categoryId = null; $displayMandatory = null; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['article_start_date'])) ? $articleStartDate = $args[0]['article_start_date'] : ''; (isset($args[0]['article_type'])) ? $articleType = $args[0]['article_type'] : ''; (isset($args[0]['category_id'])) ? $categoryId = $args[0]['category_id'] : ''; (isset($args[0]['display_mandatory'])) ? $displayMandatory = $args[0]['display_mandatory'] : ''; } return array( 'method' => 'GetPromotions', 'params' => array('getPromotionsParameter' => array( 'ArticleStartDate' => $articleStartDate, 'ArticleType' => $articleType, 'CategoryId' => $categoryId, 'DisplayMandatory' => $displayMandatory )) ); } /** * Gets the phone prefixes result * * The Ricardo API returns: * <pre> * { * "GetPromotionsResult": { * "Promotions": [{ * "GroupId": "INT", * "IsMandatory": "BOOL" * "PromotionFee": "FLOAT" * "PromotionId": "INT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getPromotionsResult(array $data) { if (isset($data['GetPromotionsResult']) && isset($data['GetPromotionsResult']['Promotions'])) { return $data['GetPromotionsResult']['Promotions']; } return array(); } /** * Gets the regions. * * @return array */ public function getRegions() { $countryId = null; $args = func_get_args(); if (!empty($args) && is_array($args[0])) { (isset($args[0]['country_id'])) ? $countryId = $args[0]['country_id'] : ''; } return array( 'method' => 'GetRegions', 'params' => array('getRegionsParameter' => array( 'CountryId' => $countryId )) ); } /** * Gets the regions result * * The Ricardo API returns: * <pre> * { * "GetRegionsResult": { * "Regions": [{ * "RegionId": "INT", * "RegionName": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getRegionsResult(array $data) { if (isset($data['GetRegionsResult']) && isset($data['GetRegionsResult']['Regions'])) { return $data['GetRegionsResult']['Regions']; } return array(); } /** * Gets the template. * * @return array */ public function getTemplates() { return array( 'method' => 'GetTemplates', 'params' => array('getTemplatesParameter' => array()) ); } /** * Gets the template result * * The Ricardo API returns: * <pre> * { * "GetTemplatesResult": { * "Templates": [{ * "BeginTemplateText": "TEXT", * "EndTemplateText": "TEXT" * "IsCustomerTemplate": "BOOL" * "TemplateId": "INT" * "TemplateName": "TEXT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getTemplatesResult(array $data) { if (isset($data['GetTemplatesResult']) && isset($data['GetTemplatesResult']['Templates'])) { return $data['GetTemplatesResult']['Templates']; } return array(); } /** * Gets the warranties. * * @return array */ public function getWarranties() { return array( 'method' => 'GetWarranties', 'params' => array('getWarrantiesParameter' => array()) ); } /** * Gets the warranties result * * The Ricardo API returns: * <pre> * { * "GetWarrantiesResult": { * "Warranties": [{ * "WarrantyConditionText": "TEXT", * "WarrantyId": "INT" * }] * } * } * </pre> * * @param array $data * @return array */ public function getWarrantiesResult(array $data) { if (isset($data['GetWarrantiesResult']) && isset($data['GetWarrantiesResult']['Warranties'])) { return $data['GetWarrantiesResult']['Warranties']; } return array(); } /** * Inserts the customer workstation mapping. * * @return array */ // public function insertCustomerWorkstation() // { // return array( // 'method' => 'InsertCustomerWorkstation', // 'params' => array('insertCustomerWorkstationParameter' => array('CustomerId' => '', 'WorkstationId' => '')) // ); // } /** * Inserts the device log. * * @return array */ // public function insertDeviceLog() // { // return array( // 'method' => 'InsertDeviceLog', // 'params' => array('insertDeviceLogParameter' => array()) // ); // } /** * Inserts Optimizely traffic logs * * @return array */ // public function insertOptimizelyTrafficLog() // { // return array( // 'method' => 'InsertOptimizelyTrafficLog', // 'params' => array('insertOptimizelyTrafficLogParameter' => array()) // ); // } /** * Inserts the traffic log. * * @return array */ // public function insertTrafficLog() // { // return array( // 'method' => 'InsertTrafficLog', // 'params' => array('insertTrafficLogParameter' => array()) // ); // } // public function webAlertCheck() // { // return array( // 'method' => 'WebAlertCheck', // 'params' => array() // ); // } } |