sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function translate($source, $languageFrom, $languageTo) { $context = $this->parse($source, $languageFrom, $languageTo); $hasBodyTag = (strpos($context->getSource(), '<body') !== false); // translating through Weglot API $translate = new Translate($context->getTranslateEntry(), $this->getClient()); $context->setTranslateEntry($translate->handle()); // dispatch - parser.translated $event = new ParserTranslatedEvent($context); $this->eventDispatcher->dispatch(ParserTranslatedEvent::NAME, $event); // rendering crawled source $source = $context->getCrawler()->html(); if (!$hasBodyTag) { $source = str_replace('<body>', '', $source); $source = str_replace('</body>', '', $source); } $context ->setCrawler(null) ->setSource($source); // dispatch - parser.render $event = new ParserRenderEvent($context); $this->eventDispatcher->dispatch(ParserRenderEvent::NAME, $event); return $context->getSource(); }
{@inheritdoc} @param $source @param $languageFrom @param $languageTo @return string @throws Exception\ParserContextException @throws \Weglot\Client\Api\Exception\ApiError @throws \Weglot\Client\Api\Exception\InputAndOutputCountMatchException @throws \Weglot\Client\Api\Exception\InvalidWordTypeException @throws \Weglot\Client\Api\Exception\MissingRequiredParamException @throws \Weglot\Client\Api\Exception\MissingWordsOutputException
entailment
protected function xpath() { $selectors = []; foreach ($this->attributes as $attribute) { $selectors[] = 'name() = \'' .$attribute. '\''; } return '//a[not(ancestor-or-self::*[@' .Parser::ATTRIBUTE_NO_TRANSLATE. '])]/@*[' .implode(' or ', $selectors). ']'; }
{@inheritdoc}
entailment
protected function type(\DOMNode $node) { $type = WordType::TEXT; if ($node->localName === 'href') { $type = WordType::PDF_HREF; } return $type; }
{@inheritdoc}
entailment
protected function validation(\DOMNode $node, $value) { $extended = true; $boolean = parent::validation($node, $value); if ($node->localName === 'href') { $extended = false; foreach ($this->hrefExtensions as $extension) { $start = (\strlen($extension) + 1) * -1; $extended = $extended || (strtolower(substr($value, $start)) === ('.' .$extension)); } } return $boolean && $extended; }
{@inheritdoc}
entailment
public function getOrderInfo($cmd, $original_delivery = false){ // Sanity check - for older versions of PHP if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati un ID valid al comenzii'); // Set method and action $method = 'orders'; $action = 'getOrder'; // Set data $data = array('order' => $cmd, 'original_delivery' => $original_delivery); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia datele asociate cu o anumita comanda (https://github.com/celdotro/marketplace/wiki/Datele-comenzii) [EN] Retrieve data associated with an order (https://github.com/celdotro/marketplace/wiki/Order-data) @param $cmd @param bool $original_delivery @return mixed @throws \Exception
entailment
public function updatesn($id_disp_fact, $products, $sn, $nr){ // Sanity check if(empty($id_disp_fact)) throw new \Exception('Specificati un ID valid al dispozitiei de facturare'); if(empty($products)) throw new \Exception('Specificati o lista valida de produse'); // Set method and action $method = 'orders'; $action = 'updateSN'; // Set data $data = array( 'id_disp_fact' => $id_disp_fact, 'products' => $products, 'sn' => $sn, 'nr' => $nr ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Actualizeaza SN-ul unui produs comandat (https://github.com/celdotro/marketplace/wiki/Actualizare-SN) [EN] Updates an ordered product's SN (https://github.com/celdotro/marketplace/wiki/Update-SN) @param $id_disp_fact @param $products @param $sn @param $nr @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function addOrderObservations($orders_id, $observations){ // Sanity check if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda'); // Set method and action $method = 'orders'; $action = 'addOrderObservations'; // Set data $data = array( 'orders_id' => $orders_id, 'observations' => $observations ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Adauga observatii comenzii (https://github.com/celdotro/marketplace/wiki/Adauga-observatii-comanda) [EN] Add order observations (https://github.com/celdotro/marketplace/wiki/Add-Order-Observations) @param $orders_id @param $observations @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function printOrder($orders_id){ // Sanity check if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda'); // Set method and action $method = 'orders'; $action = 'printOrder';; // Set data $data = array( 'orders_id' => $orders_id ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Returneaza un document PDF cu datele comenzii (https://github.com/celdotro/marketplace/wiki/Tipareste-comanda) [EN] Returns a PDF with the order's details (https://github.com/celdotro/marketplace/wiki/Print-order) @param $orders_id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function finishOrderCombined($orders_id, $serie, $nr_fact, $awb, $idAdresaRidicare, $observations, $products, $autogenerateAwb){ // Sanity check if(empty($orders_id)) throw new \Exception('Specificati un ID valid de comanda'); // Set method and action $method = 'orders'; $action = 'finishOrderCombined'; // Set data $data = array( 'orders_id' => $orders_id, 'serie' => $serie, 'nr_fact' => $nr_fact, 'awb' => $awb, 'idAdresaRidicare' => $idAdresaRidicare, 'observations' => $observations, 'products' => $products, 'autogenerateAwb' => $autogenerateAwb ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Finalizeaza o comanda parcurgand automat toti pasii (https://github.com/celdotro/marketplace/wiki/Finalizere-combinata-a-comenzii) [EN] Finishes an order by automatically taking all the necessary steps (https://github.com/celdotro/marketplace/wiki/Finish-order-combined) @param $orders_id @param $serie @param $nr_fact @param $awb @param $idAdresaRidicare @param $observations @param $products @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function setAwbInfo($cmd, $courier, $idAdresaRidicare, $plic = null, $packages = null, $kg = null, $sambata = 0){ // Sanity check if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda'); if(!isset($courier) || trim($courier) == '') throw new \Exception('Specificati curierul'); if(!isset($plic) || !is_int($plic) || $plic < 1){ if( (!isset($packages) || !is_int($packages) || $packages < 1) && (!isset($kg) || !is_int($kg) || $kg < 0) ){ throw new \Exception('Specificati daca este plic sau daca nu, atunci trimiteti numarul de pachete si kg'); } } if(!isset($idAdresaRidicare) || !is_numeric($idAdresaRidicare)) throw new \Exception('Specificati o adresa de ridicare valida'); // Set method and action $method = 'orders'; $action = 'setAwbInfo'; // Set data $data = array('cmd' => $cmd, 'courier' => $courier); if(isset($plic)) $data['plic'] = $plic; if(isset($packages)) { $data['packages'] = $packages; $data['kg'] = $kg; } $data['sambata'] = $sambata; $data['idAdresaRidicare'] = $idAdresaRidicare; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Seteaza informatiile necesare AWB-ului unei anumite comenzi (https://github.com/celdotro/marketplace/wiki/Setare-date-AWB) [EN] Set the AWB information for a specific order (https://github.com/celdotro/marketplace/wiki/Set-AWB-Info) @param $cmd @param $courier @param $idAdresaRidicare @param null $plic @param null $packages @param null $kg @param int $sambata @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function makeRequest($method, $endpoint, $body = [], $asArray = true) { try { list($rawBody, $httpStatusCode, $httpHeader) = $this->getHttpClient()->request( $method, $this->makeAbsUrl($endpoint), ['api_key' => $this->apiKey], $body ); $array = json_decode($rawBody, true); } catch (\Exception $e) { throw new ApiError($e->getMessage(), $body); } if ($asArray) { return $array; } return [$rawBody, $httpStatusCode, $httpHeader]; }
Make the API call and return the response. @param string $method Method to use for given endpoint @param string $endpoint Endpoint to hit on API @param array $body Body content of the request as array @param bool $asArray To know if we return an array or ResponseInterface @return array|ResponseInterface @throws ApiError
entailment
public function createProvider() { $graphApiVersion = 'v2.12'; if(!empty($this->providerInfos->config['graphApiVersion'])) { $graphApiVersion = $this->providerInfos->config['graphApiVersion']; } $config = [ 'clientId' => $this->providerInfos->clientId, 'clientSecret' => $this->providerInfos->clientSecret, 'redirectUri' => $this->getRedirectUri(), 'graphApiVersion' => $graphApiVersion ]; return new \League\OAuth2\Client\Provider\Facebook($config); }
Create Facebook Provider @return League\OAuth2\Client\Provider\Facebook
entailment
public function getRedirectUri() { $url = parent::getRedirectUri(); $parsedUrl = parse_url($url); if (isset($parsedUrl['query'])) { parse_str($parsedUrl['query'], $query); $query = http_build_query($query); return $parsedUrl['scheme'].'://'.$parsedUrl['host'].$parsedUrl['path'].'?'.$query; } return $url; }
{@inheritDoc}
entailment
public function safeUp() { Craft::log('Altering craft_oauth_tokens accessToken, secret and refreshToken columns to text...', LogLevel::Info, true); $this->alterColumn('oauth_tokens', 'accessToken', array(ColumnType::Text)); $this->alterColumn('oauth_tokens', 'secret', array(ColumnType::Text)); $this->alterColumn('oauth_tokens', 'refreshToken', array(ColumnType::Text)); Craft::log('Done altering craft_oauth_tokens accessToken, secret and refreshToken columns to text...', LogLevel::Info, true); return true; }
Any migration code in here is wrapped inside of a transaction. @return bool
entailment
public function getTransportTax($id = null){ // Set method and action $method = 'admininfo'; $action = 'getTransportTax'; // Set data if(!is_null($id)) $data = array('id' => $id); else $data = array(); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia taxa de transport (https://github.com/celdotro/marketplace/wiki/Preia-taxa-de-transport) [EN] Retrieves the transport tax (https://github.com/celdotro/marketplace/wiki/Get-transport-tax) @param null $id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function updateTransportTax($id, $newValue = null, $impusa = null){ // Sanity check if(is_null($newValue) && is_null($impusa)) throw new \Exception('Limita sau valoarea trebuie sa fie nenule'); // Set method and action $method = 'admininfo'; $action = 'updateTransportTax'; // Set data $data = array('id' => $id); if(!is_null($newValue)) $data['newValue'] = $newValue; if(!is_null($impusa)) $data['impusa'] = $impusa; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Actualizeaza o taxa de transport (https://github.com/celdotro/marketplace/wiki/Actualizeaza-taxa-de-transport) [EN] Updates a transport tax (https://github.com/celdotro/marketplace/wiki/Update-transport-tax) @param $id @param null $newValue @param null $impusa @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function insertTaxForAllCategories($newValue = null, $newLimit = null){ // Sanity check if(is_null($newValue) && is_null($newLimit)) throw new \Exception('Limita sau valoarea trebuie sa fie nenule'); // Set method and action $method = 'admininfo'; $action = 'insertTaxForAllCategories'; // Set data if(!is_null($newValue)) $data['newValue'] = $newValue; if(!is_null($newLimit)) $data['newLimit'] = $newLimit; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Actualizeaza in grup toate taxele de transport pentru categoriile disponibile (https://github.com/celdotro/marketplace/wiki/Actualizare-in-grup-a-taxelor-de-transport) [EN] Updates all transport taxes for available categories (https://github.com/celdotro/marketplace/wiki/Bulk-update-transport-taxes) @param null $newValue @param null $newLimit @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function updateDeliveryInformation($minimTara = null, $minimBucuresti = null, $kgIncluse = null, $pretKgInPlus = null, $deschidereColet = null){ // Set method and action $method = 'admininfo'; $action = 'updateDeliveryInformation'; // Set data $data = array(); if(!is_null($minimTara)) $data['minim_tara'] = $minimTara; if(!is_null($minimBucuresti)) $data['minim_bucuresti'] = $minimBucuresti; if(!is_null($kgIncluse)) $data['kgincluse'] = $kgIncluse; if(!is_null($pretKgInPlus)) $data['pretkginplus'] = $pretKgInPlus; if(!is_null($deschidereColet)) $data['deschiderecolet'] = $deschidereColet; // Late sanity check if(empty($data)) throw new \Exception('Specificati cel putin 1 informatie'); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Actualizeaza informatiil referitoare la taxele percepute pentru livrare (https://github.com/celdotro/marketplace/wiki/Actualizeaza-informatiile-livrarii) [EN] Updates information about delivery taxes (https://github.com/celdotro/marketplace/wiki/Update-delivery-information) @param null $minimTara @param null $minimBucuresti @param null $kgIncluse @param null $pretKgInPlus @param null $deschidereColet @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getDeliveryInformation($newValue = null, $newLimit = null){ // Set method and action $method = 'admininfo'; $action = 'getDeliveryInformation'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia informatiile despre taxele de livrare (https://github.com/celdotro/marketplace/wiki/Preia-informatii-despre-livrare) [EN] Get information about delivery taxes (https://github.com/celdotro/marketplace/wiki/Get-delivery-information) @param null $newValue @param null $newLimit @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCouriers(){ // Set method and action $method = 'admininfo'; $action = 'getCouriers'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia lista curierilor (https://github.com/celdotro/marketplace/wiki/Preia-lista-curieri) [EN] Get couriers list (https://github.com/celdotro/marketplace/wiki/Get-couriers) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCategoriesFaq(){ // Set method and action $method = 'admininfo'; $action = 'getCategoriesFaq'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia categoriile cu FAQ (https://github.com/celdotro/marketplace/wiki/Preia-FAQ-categorii) [EN] Retrieves categories with FAQ (https://github.com/celdotro/marketplace/wiki/Get-categories-FAQ) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCategoryFaqContent($category){ // Sanity check if(empty($category)) throw new \Exception('Categorie invalida'); // Set method and action $method = 'admininfo'; $action = 'getCategoryFaqContent'; // Set data $data = array('category' => $category); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia continutul FAQ pentru o categorie (https://github.com/celdotro/marketplace/wiki/Continut-FAQ-categorie) [EN] Retrieve a category's FAQ contents (https://github.com/celdotro/marketplace/wiki/Category-FAQ-contents) @param $category @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getMccCodes($filters = array(), $start = 0){ // Set method and action $method = 'admininfo'; $action = 'getMccCodes'; // Set data $data = array('filters' => $filters, 'start' => $start); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia toate codurile MCC (https://github.com/celdotro/marketplace/wiki/Preia-coduri-MCC) [EN] Get all MCC Codes (https://github.com/celdotro/marketplace/wiki/Get-MCC-Codes) @param array $filters @param int $start @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function addMccCode($mcc){ // Set method and action $method = 'admininfo'; $action = 'addMccCode'; // Set data $data = array('mcc' => $mcc); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Adauga un cod MCC in contul curent (https://github.com/celdotro/marketplace/wiki/Atribuie-cod-MCC) [EN] Add an MCC code to current account (https://github.com/celdotro/marketplace/wiki/Add-MCC-Code) @param $mcc @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCurrentMcc(){ // Set method and action $method = 'admininfo'; $action = 'getCurrentMcc'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia lista MCC-urilor atribuite (https://github.com/celdotro/marketplace/wiki/Preia-MCC-uri-atribuite) [EN] Get list of currently used MCC (https://github.com/celdotro/marketplace/wiki/Get-currently-used-MCC) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function removeMccCode($mcc){ // Set method and action $method = 'admininfo'; $action = 'removeMccCode'; // Set data $data = array('mcc' => $mcc); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Elimina un MCC atribuit contului curent (https://github.com/celdotro/marketplace/wiki/Elimina-MCC) [EN] Remove an MCC code linked to the current account (https://github.com/celdotro/marketplace/wiki/Remove-MCC-Code) @param $mcc @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCategoriesAccess(){ // Set method and action $method = 'admininfo'; $action = 'getCategoriesAccess'; // Set data $data = array('dummy' => 1); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia date referitoare la accesul la categorii (https://github.com/celdotro/marketplace/wiki/Preia-accesul-la--categorii) [EN] Retrieve information about category access (https://github.com/celdotro/marketplace/wiki/Retrieve-category-access) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function requestCategoryAccess($categ_id){ // Set method and action $method = 'admininfo'; $action = 'requestCategoryAccess'; // Set data $data = array('categ_id' => $categ_id); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Cere acces la o categorie (https://github.com/celdotro/marketplace/wiki/Cere-acces-la-o-categorie) [EN] Request access to category (https://github.com/celdotro/marketplace/wiki/Request-category-access) @param $categ_id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function listCategoryRequests($availability){ // Set method and action $method = 'admininfo'; $action = 'listCategoryRequests'; // Set data $data = array('availability' => $availability); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia lista ceririlor de acces la categorii (https://github.com/celdotro/marketplace/wiki/Preia-cererile-de-acces-la--categorii) [EN] Retrieve category access request list (https://github.com/celdotro/marketplace/wiki/Retrieve-access-requests) @param $availability @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getAll($page = '') { $page = !empty($page) ? "/page={$page}" : ''; $request = $this->paystackHttpClient->get( $this->transformUrl(Resource::GET_TRANSACTION, '').$page ); return $this->processResourceRequestResponse($request); }
Get all transactions. @param string $page @return \Exception|mixed
entailment
public function getTransactionTotals() { $request = $this->paystackHttpClient->get( Resource::GET_TRANSACTION_TOTALS ); return $this->processResourceRequestResponse($request); }
Get transactions totals.
entailment
public function verify($reference) { $request = $this->paystackHttpClient->get( $this->transformUrl(Resource::VERIFY_TRANSACTION, $reference, ':reference') ); return $this->processResourceRequestResponse($request); }
Verify Transaction by transaction reference. @param $reference @return \Exception|mixed
entailment
public function initialize($body) { $request = $this->paystackHttpClient->post( Resource::INITIALIZE_TRANSACTION, [ 'body' => is_array($body) ? $this->toJson($body) : $body, ] ); return $this->processResourceRequestResponse($request); }
Initialize one time transaction. @param $body @return \Exception|mixed
entailment
public function chargeAuthorization($body) { $request = $this->paystackHttpClient->post( Resource::CHARGE_AUTHORIZATION, [ 'body' => is_array($body) ? $this->toJson($body) : $body, ] ); return $this->processResourceRequestResponse($request); }
charge returning transaction. @param $body @return \Exception|mixed
entailment
public function chargeToken($body) { $request = $this->paystackHttpClient->post( Resource::CHARGE_TOKEN, [ 'body' => is_array($body) ? $this->toJson($body) : $body, ] ); return $this->processResourceRequestResponse($request); }
Charge Token. @param $body @return \Exception|mixed
entailment
public function getCategories() { // Set method and action $method = 'import'; $action = 'getSupplierCategories'; // Set data $data = array(); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Returneaza toate categoriile (https://github.com/celdotro/marketplace/wiki/Listeaza-categorii) [EN] Get all categories (https://github.com/celdotro/marketplace/wiki/List-categories) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function listProducts($start, $limit, $search = null, $forceCount = false, $filters = null, $includeTransport = null, $orderByMostViewed = false){ // Sanity check if(!isset($start) || !is_int($start) || $start < 0) throw new \Exception('Precizati o valoare de start numar natural'); if(!isset($limit) || !is_int($limit) || $limit < 0) throw new \Exception('Precizati un numar natural pentru limita'); // Set method and action $method = 'products'; $action = 'readProducts'; // Set data $data = array('start' => $start, 'limit' => $limit, 'forceCount' => $forceCount, 'orderByMostViewed' => $orderByMostViewed); if(!is_null($search)) $data['search'] = $search; if(!is_null($filters)) $data['filters'] = $filters; if(!is_null($includeTransport)) $data['includeTransport'] = $includeTransport; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza produsele. Lista este scurtata folosind o valoare de start si o limita. De asemenea, produsele pot fi filtrate. (https://github.com/celdotro/marketplace/wiki/Listeaza-produse) [EN] Lists products. The list is shrunk using a start and limit value. Also, the products can be filtered. (https://github.com/celdotro/marketplace/wiki/List-products) @param $start @param $limit @param null $search @param bool $forceCount @param null $filters @param null $includeTransport @param bool $orderByMostViewed @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCategoryCharacteristics($categID){ // Sanity check if(!isset($categID) || !is_int($categID) || $categID < 0) throw new \Exception('Specificati o categorie valida'); $method = 'products'; $action = 'getCategoryCharacteristics'; // Set data $data = array('categ_id' => $categID); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza caracteristicile unei categorii (https://github.com/celdotro/marketplace/wiki/Listeaza-caracteristicile-unei-categorii) [EN] Lists the characteristics of a category (https://github.com/celdotro/marketplace/wiki/List-characteristics-of-a-category) @param $categID @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function listFilters($filters = null){ $method = 'products'; $action = 'listFilters'; // Set data $data = array('filters' => $filters); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza filtrele disponibile si datele acestora dupa ce au fost corelate (https://github.com/celdotro/marketplace/wiki/Listeaza-filtre ) [EN] List available filters after correlation (https://github.com/celdotro/marketplace/wiki/List-filters) @param null $filters @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getLiveProductsFromCategory($category, $keyword = null, $start = null, $limit = null){ // Sanity check if(!isset($category) || !is_int($category) || $category < 0) throw new \Exception('Specificati o categorie valida'); $method = 'products'; $action = 'getLiveProductsFromCategory'; // Set data $data = array('category' => $category); if(!is_null($keyword)) $data['keyword'] = $keyword; if(!is_null($start)) $data['start'] = $start; if(!is_null($limit)) $data['limit'] = $limit; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza produsele live dintr-o categorie precizata prin parametru (https://github.com/celdotro/marketplace/wiki/Preluare-produse-live-din-categorie) [EN] List all live products from a category (https://github.com/celdotro/marketplace/wiki/Retrieve-live-products-from-category) @param $category @param null $keyword @param null $start @param null $limit @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getLiveProductsCategory(){ $method = 'products'; $action = 'getLiveProductsCategory'; // Set data $data = array('dummy' => true); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia produsele live pe categorii (https://github.com/celdotro/marketplace/wiki/Preia-produsele-live-pe-categorii) [EN] Get live products for each category (https://github.com/celdotro/marketplace/wiki/Get-live-products-categories) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function exportProducts(){ $method = 'products'; $action = 'exportProducts'; // Set data $data = array('dummy' => true); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Exporta lista de produse in format xlsx (https://github.com/celdotro/marketplace/wiki/Export-produse) [EN] Export products in xlsx format (https://github.com/celdotro/marketplace/wiki/Export-products) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getProductsFamilies($start, $limit, $search){ $method = 'products'; $action = 'getProductsFamilies'; // Set data $data = array( 'start' => $start, 'limit' => $limit, ); if(!empty($search)) $data['search'] = $search; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza familiile de produse (https://github.com/celdotro/marketplace/wiki/Listeaza-familiile-de-produse) [EN] List product families (https://github.com/celdotro/marketplace/wiki/List-product-families) @param $start @param $limit @param $search @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getProductsForFamily($id){ $method = 'products'; $action = 'getProductsForFamily'; // Set data $data = array( 'id' => $id ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia datele produselor dintr-o familie (https://github.com/celdotro/marketplace/wiki/Preia-produse-din-familie) [EN] Get product's data for the products that belong to a family (https://github.com/celdotro/marketplace/wiki/Get-product-from-family) @param $id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getManufacturerID($name){ $method = 'products'; $action = 'getManufacturerID'; // Set data $data = array( 'name' => $name ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia ID-ul unui producator (https://github.com/celdotro/marketplace/wiki/Preia-ID-producator) [EN] Retrieve manufacturer's ID (https://github.com/celdotro/marketplace/wiki/Get-manufacturer-ID) @param $name @return mixed @throws \Exception
entailment
public function getWaitingProducts($start){ // Sanity check if(!isset($start) || !is_int($start) || $start < 0) throw new \Exception('Precizati o valoare de start numar natural'); // Set method and action $method = 'products'; $action = 'getWaitingProducts'; // Set data $data = array('start' => $start); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia lista produselor aflate in asteptare (https://github.com/celdotro/marketplace/wiki/Preia-produse-in-asteptare) [EN] Get waiting products list (https://github.com/celdotro/marketplace/wiki/Get-waiting-products) @param $start @return mixed @throws \Exception
entailment
public function safeUp() { $providersTable = $this->dbConnection->schema->getTable('{{oauth_providers}}'); if ($providersTable) { if($this->renameColumn('{{oauth_providers}}', 'providerClass', 'class')) { OauthPlugin::log('Renamed `{{oauth_providers}}`.`providerClass` to `{{oauth_providers}}`.`class`.', LogLevel::Info, true); } else { OauthPlugin::log('Couldn\'t rename `{{oauth_providers}}`.`providerClass` to `{{oauth_providers}}`.`class`.', LogLevel::Warning); } } else { OauthPlugin::log('Could not find an `{{oauth_providers}}` table. Wut?', LogLevel::Error); } return true; }
Any migration code in here is wrapped inside of a transaction. @return bool
entailment
public function createProvider() { if($this->providerInfos->clientId && $this->providerInfos->clientSecret) { $config = [ 'identifier' => $this->providerInfos->clientId, 'secret' => $this->providerInfos->clientSecret, 'callback_uri' => $this->getRedirectUri(), ]; return new \League\OAuth1\Client\Server\Twitter($config); } }
Create Twitter Provider @return Twitter
entailment
public function cancelOrder($cmd, $motiv = 0, $observatii = ''){ // Sanity check if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda'); // Set method and action $method = 'orders'; $action = 'cancelOrder'; // Set data $data = array('order' => $cmd); $observatii = trim($observatii); if($observatii != '' && strlen($observatii) > 4) $data['observatii'] = $observatii; elseif($motiv != 0) $data['motiv'] = $motiv; else throw new \Exception('Specificati un motiv sau o observatie pentru anularea comenzii. Observatia trebuie sa fie formata din cel putin 4 caractere, spatiile de la inceput si sfarsit fiind ignorate'); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Anuleaza o anumita comanda. Un motiv valid e necesar. (https://github.com/celdotro/marketplace/wiki/Anularea-comenzii) [EN] Cancel a specific order. A valid reason is necessary. (https://github.com/celdotro/marketplace/wiki/Cancel-Order) @param $cmd @param int $motiv @param string $observatii @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function confirmOrder($cmd){ // Sanity check if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda'); // Set method and action $method = 'orders'; $action = 'confirmOrder'; // Set data $data = array('order' => $cmd); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Confirma o comanda existenta (https://github.com/celdotro/marketplace/wiki/Confirmare-comanda) [EN] Confirms an existing order (https://github.com/celdotro/marketplace/wiki/Confirm-order) @param $cmd @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function listCancellingStatuses(){ // Set method and action $method = 'orders'; $action = 'listCancellingStatuses'; // Set data $data = array('dummy' => true); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza statusurile ce pot fi folosite pentru anularea unei comenzi (https://github.com/celdotro/marketplace/wiki/Listare-statusuri-anulare) [EN] Lists the statuses that can be used for cancelling an order (https://github.com/celdotro/marketplace/wiki/List-order-cancelling-statuses) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getOrderStatusList(){ // Set method and action $method = 'orders'; $action = 'getOrderStatusList'; // Set data $data = array(); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preluare lista de statusuri ale comenzilor (https://github.com/celdotro/marketplace/wiki/Preluare-lista-de-statusuri-pentru-comenzi) [EN] Retrieves the list of statuses for orders (https://github.com/celdotro/marketplace/wiki/Get-status-list-for-orders) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function stornareComanda($orders_id, $reason){ // Sanity check if(empty($orders_id) || !is_int($orders_id)) throw new \Exception('Specificati comanda'); if(empty($reason)) throw new \Exception('Specificati motivul'); // Set method and action $method = 'orders'; $action = 'StornareComanda'; // Set data $data = array( 'orders_id' => $orders_id, 'reason' => $reason ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Storneaza comanda (https://github.com/celdotro/marketplace/wiki/Stornare-comanda) [EN] Order cancellation (https://github.com/celdotro/marketplace/wiki/Order-cancellation) @param $orders_id @param $reason @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function finishOrder($orders_id){ // Sanity check if(!isset($orders_id) || !is_int($orders_id)) throw new \Exception('Specificati comanda'); // Set method and action $method = 'orders'; $action = 'finishOrder'; // Set data $data = array('orders_id' => $orders_id); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Finalizeaza o comanda (https://github.com/celdotro/marketplace/wiki/Finalizeaza-comanda) [EN] Finishes an order (https://github.com/celdotro/marketplace/wiki/Finish-order) @param $orders_id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function processResourceRequestResponse(ResponseInterface $request) { $response = json_decode($request->getBody()->getContents()); if (Response::HTTP_OK !== $request->getStatusCode() && Response::HTTP_CREATED !== $request->getStatusCode()) { return ExceptionHandler::handle(get_class($this), $response, $request->getStatusCode()); } return (isset($response->data)) ? json_decode(json_encode($response->data), true) : json_decode(json_encode($response), true); }
Checks request response and dispatch result to appropriate handler. @param ResponseInterface $request @return \Exception|mixed
entailment
public function setType($type) { /** * Thoses WordType::__MIN and WordType::__MAX values are * only used to check if given type is okay according to * what we have in WordType. * * @see src/Client/Api/Enum/WordType.php */ if (!($type >= WordType::__MIN && $type <= WordType::__MAX)) { throw new InvalidWordTypeException(); } $this->type = $type; return $this; }
Set type of word you gonna translate. Returns false if type is incorrect. @param $type @return $this @throws InvalidWordTypeException
entailment
public function setInputType(string $inputType): self { $this->inputType = $inputType; $this->validate(); return $this; }
@param string $inputType @return FilterInput
entailment
public function updateProductsFromOrder($cmd, $arrProducts){ // Sanity check if(!isset($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda'); if(!isset($arrProducts) || !is_array($arrProducts) || empty($arrProducts)) throw new \Exception('$arrProducts trebuie sa fie un array care sa contina un alt array cu datele produselor pe care doriti sa le actualizati in comanda'); // Set method and action $method = 'orders'; $action = 'saveOrderData'; // Set data $data = array('order' => $cmd, 'data' => json_encode($arrProducts)); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Actualizeaza produsele pentru o comanda (https://github.com/celdotro/marketplace/wiki/Actualizare-comenzi) [EN] Update the products of an order (https://github.com/celdotro/marketplace/wiki/Update-orders) @param $cmd @param $arrProducts @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function importInvoice($cmd, $serie, $nr_fact){ // Sanity check if(empty($cmd) || !is_int($cmd)) throw new \Exception('Specificati comanda'); if(empty($serie)) throw new \Exception('Specificati seria facturii'); if(empty($nr_fact)) throw new \Exception('Specificati numarul facturii'); // Set method and action $method = 'orders'; $action = 'importInvoice'; // Set data $data = array( 'orders_id' => $cmd, 'serie' => $serie, 'nr_fact' => $nr_fact ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Permite importul unei facturi (https://github.com/celdotro/marketplace/wiki/Import-factura) [EN] Imports a new invoice (https://github.com/celdotro/marketplace/wiki/Import-Invoice) @param $cmd @param $serie @param $nr_fact @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function changeOrderProductStatus($orders_products_id, $status){ // Sanity check if(empty($orders_products_id)) throw new \Exception('Specificati ID-ul produsului'); if(!isset($status)) throw new \Exception('Specificati statusul produsului'); // Set method and action $method = 'orders'; $action = 'changeOrderProductStatus'; // Set data $data = array( 'orders_products_id' => $orders_products_id, 'status' => $status ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Schimba statusul unui produs dintr-o comanda (https://github.com/celdotro/marketplace/wiki/Schimba-statusul-unui-produs-din-comanda) [EN] Changes the status of a product from a specific order (https://github.com/celdotro/marketplace/wiki/Change-order-product-status) @param $orders_products_id @param $status @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function changeOrderPaymentMethod($order, $paymentMethod){ // Sanity check if(empty($order)) throw new \Exception('Comanda invalida'); if(empty($paymentMethod)) throw new \Exception('Mod de plata invalid'); // Set method and action $method = 'orders'; $action = 'ChangeOrderPaymentMethod'; // Set data $data = array( 'order_id' => $order, 'payment_method' => $paymentMethod ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Schimba modul de plata al unei comenzi (https://github.com/celdotro/marketplace/wiki/Schimba-modul-de-plata-al-unei-comenzi) [EN] Change an order's payment method (https://github.com/celdotro/marketplace/wiki/Change-order-payment-method) @param $order @param $paymentMethod @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function returProduct($orderId, $reason, $model){ // Sanity check if(empty($orderId)) throw new \Exception('Comanda invalida'); if(empty($reason)) throw new \Exception('Motiv invalid'); if(empty($model)) throw new \Exception('Model invalid'); // Set method and action $method = 'orders'; $action = 'returProduct'; // Set data $data = array( 'orderId' => $orderId, 'reason' => $reason, 'model' => $model ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Marcheaza un produs pentru retur (https://github.com/celdotro/marketplace/wiki/Retur-produs) [EN] Marks a product for return (https://github.com/celdotro/marketplace/wiki/Product-return) @param $orderId @param $reason @param $model @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function addWeightToOrder($orders_id, $weight){ // Sanity check if(empty($orders_id)) throw new \Exception('Comanda invalida'); // Set method and action $method = 'orders'; $action = 'addWeightToOrder'; // Set data $data = array( 'orders_id' => $orders_id, 'weight' => $weight ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Permite actualizarea greutatii comenzii (https://github.com/celdotro/marketplace/wiki/Adaugare-greutate) [EN] Add weight to order (https://github.com/celdotro/marketplace/wiki/Add-weight) @param $orders_id @param $weight @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function changeFinishingDate($orders_id, $date){ // Sanity check if(empty($orders_id)) throw new \Exception('Comanda invalida'); // Set method and action $method = 'orders'; $action = 'changeFinishingDate'; // Set data $data = array( 'orders_id' => $orders_id, 'date' => $date ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Inregistreaza o data personalizata a finalizarii comenzii (https://github.com/celdotro/marketplace/wiki/Schimba-data-finalizarii) [EN] Submits a custom date for order finishing (https://github.com/celdotro/marketplace/wiki/Change-finishing-date) @param $orders_id @param $date @return mixed @throws \Exception
entailment
private function processMethod($method, array $options, array $headers, array $body = []) { if ($method === 'get') { if ($body !== []) { throw new \Exception('Issuing a GET request with a body'); } $options[CURLOPT_HTTPGET] = 1; } elseif ($method === 'post') { $data_string = json_encode($body); $options[CURLOPT_POST] = 1; $options[CURLOPT_POSTFIELDS] = $data_string; array_push($headers, 'Content-Type: application/json'); array_push($headers, 'Content-Length: ' . strlen($data_string)); } else { throw new \Exception('Unrecognized method ' . strtoupper($method)); } return [$options, $headers]; }
Setup behavior for each methods @param string $method @param array $options @param array $headers @param array $body @return [$options, $headers] @throws \Exception
entailment
private function shouldRetry($errno, $rcode, $numRetries) { // Don't make too much retries if ($numRetries >= $this->getMaxNetworkRetries()) { return false; } // Retry on timeout-related problems (either on open or read). $timeoutRelated = ($errno === CURLE_OPERATION_TIMEOUTED); // Destination refused the connection, the connection was reset, or a // variety of other connection failures. This could occur from a single // saturated server, so retry in case it's intermittent. $refusedConnection = ($errno === CURLE_COULDNT_CONNECT); // 409 conflict $conflict = ($rcode === 409); if ($timeoutRelated || $refusedConnection || $conflict) { return true; } return false; }
Checks if an error is a problem that we should retry on. This includes both socket errors that may represent an intermittent problem and some special HTTP statuses. @param int $errno @param int $rcode @param int $numRetries @return bool
entailment
public function setSource($source) { $crawler = $this->getCrawler(); if (!is_null($crawler) && $crawler instanceof Crawler) { throw new ParserContextException('It is not allowed to update source when crawler is active.'); } $this->source = $source; return $this; }
@param string $source @return $this @throws ParserContextException
entailment
public function setTranslateEntry(TranslateEntry $translateEntry) { if (is_null($this->translateEntry)) { throw new ParserContextException('TranslateEntry should be generated through `generateTranslateEntry()` function first.'); } $this->translateEntry = $translateEntry; return $this; }
@param TranslateEntry $translateEntry @return $this @throws ParserContextException
entailment
public function generateTranslateEntry() { if (is_null($this->getCrawler())) { throw new ParserContextException('You can\'t generate translate entry without having a crawler initialized.'); } $parameters = [ 'language_from' => $this->getLanguageFrom(), 'language_to' => $this->getLanguageTo() ]; // if data is coming from $_SERVER, load it ... if ($this->getParser()->getConfigProvider() instanceof ServerConfigProvider) { $this->getParser()->getConfigProvider()->loadFromServer(); } // managing auto-discover for title if ($this->getParser()->getConfigProvider()->getAutoDiscoverTitle()) { $title = 'Empty title'; foreach ($this->getCrawler()->filter('title') as $element) { if ($element->nodeValue != '') { $title = $element->nodeValue; } } $parameters['title'] = $title; } $parameters = array_merge($parameters, $this->getParser()->getConfigProvider()->asArray()); $this->translateEntry = new TranslateEntry($parameters); return $this->translateEntry; }
@return TranslateEntry @throws ParserContextException @throws MissingRequiredParamException
entailment
public function addWord($text, callable $callback, $textType = WordType::TEXT) { $inputWords = $this->getTranslateEntry()->getInputWords(); $index = count($inputWords); $inputWords->addOne(new WordEntry($text, $textType)); $this->addToTranslateMap($index, $callback); }
@param string $text @param callable $callback @param int $textType @throws InvalidWordTypeException
entailment
public function getValidationErrors() { $errors = []; if (isset($this->response->errors)) { foreach ($this->response->errors as $error => $reasons) { $errors[] = [ 'attribute' => $error, 'reason' => $this->getValidationReasonsAsString($reasons), ]; } } return $errors; }
Get validation errors that occurred in requests. @return array
entailment
public function getPages(){ // Set method and action $method = 'settings'; $action = 'getPages'; // Set data $data = array(array(1)); // At least one parameter is required by API // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Returneaza toate paginile (https://github.com/celdotro/marketplace/wiki/Listare-Pagini) [EN] Get all pages (https://github.com/celdotro/marketplace/wiki/List-pages) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function readCampaign($name, $products, $availableProducts){ // Sanity check if(!isset($name) || $name == '') throw new \Exception('Specificati numele campaniei'); if(!isset($products)) throw new \Exception('Specificati produsele'); if(!isset($availableProducts)) throw new \Exception('Specificati produsele disponibile'); // Set method and action $method = 'campaign'; $action = 'readCampaign'; // Set data $data = array( 'numecampanie' => $name, 'products' => json_encode($products), 'availableProducts' => json_encode($availableProducts) ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Returneaza informatii referitoare la o campanie, produsele din ea filtrate in functie de nume, precum si alte produse disponibile care pot, de asemenea, sa fie filtrate in functie de nume (https://github.com/celdotro/marketplace/wiki/Citire-campanie) [EN] Provides information about a campaign, its products that can be filtered by name and other available products that can also be filtered by name (https://github.com/celdotro/marketplace/wiki/Read-Campaign) @param $name @param $products @param $availableProducts @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function listActiveCampaigns($start, $limit, $dateFrom = NULL, $dateTo = NULL, $search = NULL){ // Sanity check if(!isset($start) || $start === '' || !is_int($start)) throw new \Exception('Specificati valoarea de start'); if(!isset($limit) || $limit === '' || !is_int($limit)) throw new \Exception('Specificati o valoare limita'); if(isset($dateFrom)){ if(strtotime($dateFrom) === false) throw new \Exception('Specificati o data de inceput valida'); else // Add to data if everything is OK $data['date_from'] = $dateFrom; } if(isset($dateTo)){ if(strtotime($dateTo) === false) throw new \Exception('Specificati o data de sfarsit valida'); else // Add to data if everything is OK $data['date_to'] = $dateTo; } if(isset($search)) { if($search !== '') // Add to data if everything is OK $data['search'] = $search; } // Set method and action $method = 'campaign'; $action = 'activeCampaigns'; // Add additional values to $data array $data['start'] = $start; $data['limit'] = $limit; // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza toate campaniile active. Datele pot fi filtrate in functie de data de inceput, data de sfarsit si numele campaniei (https://github.com/celdotro/marketplace/wiki/Listare-campanii-active) [EN] Lists all active campaigns. Data can be filtered by start date, end date, and campaign name. (https://github.com/celdotro/marketplace/wiki/List-Active-Campaigns) @param $start @param $limit @param null $dateFrom @param null $dateTo @param null $search @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCouponCampaign($id){ // Sanity check if(empty($id)) throw new \Exception('Specificati un ID valid'); // Set method and action $method = 'coupons'; $action = 'getCouponsCampaignData'; $send = array( 'campaignId' => $id ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $send); return $result; }
[RO] Datele aferente unei campanii de cupoane (https://github.com/celdotro/marketplace/wiki/Date-campanie-cupoane) [EN] Get coupon campaign data (https://github.com/celdotro/marketplace/wiki/Coupon-Campaign-Data) @param $id @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function checkCouponUsage($campaignId, $couponId){ // Sanity check if(empty($campaignId)) throw new \Exception('Specificati un ID de campanie valid'); if(is_null($couponId)) throw new \Exception('Specificati un ID de cupon valid'); // Set method and action $method = 'coupons'; $action = 'checkCouponUsage'; $send = array( 'campaignId' => $campaignId, 'couponId' => $couponId ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $send); return $result; }
[RO] Verifica utilizarea cuponului (https://github.com/celdotro/marketplace/wiki/Verifica-utilizarea-cuponului) [EN] Check coupon's usage (https://github.com/celdotro/marketplace/wiki/Check-coupon-usage) @param $campaignId @param $couponId @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getCouponData($couponId){ // Sanity check if(is_null($couponId)) throw new \Exception('Specificati un ID de cupon valid'); // Set method and action $method = 'coupons'; $action = 'getCouponData'; $send = array( 'couponId' => $couponId ); // Send request and retrieve response $result = Dispatcher::send($method, $action, $send); return $result; }
[RO] Preia date cupon (https://github.com/celdotro/marketplace/wiki/Date-cupon) [EN] Get coupon data (https://github.com/celdotro/marketplace/wiki/Coupon-data) @param $couponId @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public static function data() { return [ 'sq' => [ 'code' => 'sq', 'english' => 'Albanian', 'local' => 'Shqip', 'rtl' => false, ], 'en' => [ 'code' => 'en', 'english' => 'English', 'local' => 'English', 'rtl' => false, ], 'ar' => [ 'code' => 'ar', 'english' => 'Arabic', 'local' => 'العربية‏', 'rtl' => true, ], 'hy' => [ 'code' => 'hy', 'english' => 'Armenian', 'local' => 'հայերեն', 'rtl' => false, ], 'az' => [ 'code' => 'az', 'english' => 'Azerbaijani', 'local' => 'Azərbaycan dili', 'rtl' => false, ], 'af' => [ 'code' => 'af', 'english' => 'Afrikaans', 'local' => 'Afrikaans', 'rtl' => false, ], 'eu' => [ 'code' => 'eu', 'english' => 'Basque', 'local' => 'Euskara', 'rtl' => false, ], 'be' => [ 'code' => 'be', 'english' => 'Belarusian', 'local' => 'Беларуская', 'rtl' => false, ], 'bg' => [ 'code' => 'bg', 'english' => 'Bulgarian', 'local' => 'български', 'rtl' => false, ], 'bs' => [ 'code' => 'bs', 'english' => 'Bosnian', 'local' => 'Bosanski', 'rtl' => false, ], 'cy' => [ 'code' => 'cy', 'english' => 'Welsh', 'local' => 'Cymraeg', 'rtl' => false, ], 'vi' => [ 'code' => 'vi', 'english' => 'Vietnamese', 'local' => 'Tiếng Việt', 'rtl' => false, ], 'hu' => [ 'code' => 'hu', 'english' => 'Hungarian', 'local' => 'Magyar', 'rtl' => false, ], 'ht' => [ 'code' => 'ht', 'english' => 'Haitian', 'local' => 'Kreyòl ayisyen', 'rtl' => false, ], 'gl' => [ 'code' => 'gl', 'english' => 'Galician', 'local' => 'Galego', 'rtl' => false, ], 'nl' => [ 'code' => 'nl', 'english' => 'Dutch', 'local' => 'Nederlands', 'rtl' => false, ], 'el' => [ 'code' => 'el', 'english' => 'Greek', 'local' => 'Ελληνικά', 'rtl' => false, ], 'ka' => [ 'code' => 'ka', 'english' => 'Georgian', 'local' => 'ქართული', 'rtl' => false, ], 'da' => [ 'code' => 'da', 'english' => 'Danish', 'local' => 'Dansk', 'rtl' => false, ], 'he' => [ 'code' => 'he', 'english' => 'Hebrew', 'local' => 'עברית', 'rtl' => true, ], 'id' => [ 'code' => 'id', 'english' => 'Indonesian', 'local' => 'Bahasa Indonesia', 'rtl' => false, ], 'ga' => [ 'code' => 'ga', 'english' => 'Irish', 'local' => 'Gaeilge', 'rtl' => false, ], 'it' => [ 'code' => 'it', 'english' => 'Italian', 'local' => 'Italiano', 'rtl' => false, ], 'is' => [ 'code' => 'is', 'english' => 'Icelandic', 'local' => 'Íslenska', 'rtl' => false, ], 'es' => [ 'code' => 'es', 'english' => 'Spanish', 'local' => 'Español', 'rtl' => false, ], 'kk' => [ 'code' => 'kk', 'english' => 'Kazakh', 'local' => 'Қазақша', 'rtl' => false, ], 'ca' => [ 'code' => 'ca', 'english' => 'Catalan', 'local' => 'Català', 'rtl' => false, ], 'ky' => [ 'code' => 'ky', 'english' => 'Kyrgyz', 'local' => 'кыргызча', 'rtl' => false, ], 'zh' => [ 'code' => 'zh', 'english' => 'Simplified Chinese', 'local' => '中文 (简体)', 'rtl' => false, ], 'tw' => [ 'code' => 'tw', 'english' => 'Traditional Chinese', 'local' => '中文 (繁體)', 'rtl' => false, ], 'ko' => [ 'code' => 'ko', 'english' => 'Korean', 'local' => '한국어', 'rtl' => false, ], 'lv' => [ 'code' => 'lv', 'english' => 'Latvian', 'local' => 'Latviešu', 'rtl' => false, ], 'lt' => [ 'code' => 'lt', 'english' => 'Lithuanian', 'local' => 'Lietuvių', 'rtl' => false, ], 'mg' => [ 'code' => 'mg', 'english' => 'Malagasy', 'local' => 'Malagasy', 'rtl' => false, ], 'ms' => [ 'code' => 'ms', 'english' => 'Malay', 'local' => 'Bahasa Melayu', 'rtl' => false, ], 'mt' => [ 'code' => 'mt', 'english' => 'Maltese', 'local' => 'Malti', 'rtl' => false, ], 'mk' => [ 'code' => 'mk', 'english' => 'Macedonian', 'local' => 'Македонски', 'rtl' => false, ], 'mn' => [ 'code' => 'mn', 'english' => 'Mongolian', 'local' => 'Монгол', 'rtl' => false, ], 'de' => [ 'code' => 'de', 'english' => 'German', 'local' => 'Deutsch', 'rtl' => false, ], 'no' => [ 'code' => 'no', 'english' => 'Norwegian', 'local' => 'Norsk', 'rtl' => false, ], 'fa' => [ 'code' => 'fa', 'english' => 'Persian', 'local' => 'فارسی', 'rtl' => true, ], 'pl' => [ 'code' => 'pl', 'english' => 'Polish', 'local' => 'Polski', 'rtl' => false, ], 'pt' => [ 'code' => 'pt', 'english' => 'Portuguese', 'local' => 'Português', 'rtl' => false, ], 'ro' => [ 'code' => 'ro', 'english' => 'Romanian', 'local' => 'Română', 'rtl' => false, ], 'ru' => [ 'code' => 'ru', 'english' => 'Russian', 'local' => 'Русский', 'rtl' => false, ], 'sr' => [ 'code' => 'sr', 'english' => 'Serbian', 'local' => 'Српски', 'rtl' => false, ], 'sk' => [ 'code' => 'sk', 'english' => 'Slovak', 'local' => 'Slovenčina', 'rtl' => false, ], 'sl' => [ 'code' => 'sl', 'english' => 'Slovenian', 'local' => 'Slovenščina', 'rtl' => false, ], 'sw' => [ 'code' => 'sw', 'english' => 'Swahili', 'local' => 'Kiswahili', 'rtl' => false, ], 'tg' => [ 'code' => 'tg', 'english' => 'Tajik', 'local' => 'Тоҷикӣ', 'rtl' => false, ], 'th' => [ 'code' => 'th', 'english' => 'Thai', 'local' => 'ภาษาไทย', 'rtl' => false, ], 'tl' => [ 'code' => 'tl', 'english' => 'Tagalog', 'local' => 'Tagalog', 'rtl' => false, ], 'tt' => [ 'code' => 'tt', 'english' => 'Tatar', 'local' => 'Tatar', 'rtl' => false, ], 'tr' => [ 'code' => 'tr', 'english' => 'Turkish', 'local' => 'Türkçe', 'rtl' => false, ], 'uz' => [ 'code' => 'uz', 'english' => 'Uzbek', 'local' => 'O\'zbek', 'rtl' => false, ], 'uk' => [ 'code' => 'uk', 'english' => 'Ukrainian', 'local' => 'Українська', 'rtl' => false, ], 'fi' => [ 'code' => 'fi', 'english' => 'Finnish', 'local' => 'Suomi', 'rtl' => false, ], 'fr' => [ 'code' => 'fr', 'english' => 'French', 'local' => 'Français', 'rtl' => false, ], 'hr' => [ 'code' => 'hr', 'english' => 'Croatian', 'local' => 'Hrvatski', 'rtl' => false, ], 'cs' => [ 'code' => 'cs', 'english' => 'Czech', 'local' => 'Čeština', 'rtl' => false, ], 'sv' => [ 'code' => 'sv', 'english' => 'Swedish', 'local' => 'Svenska', 'rtl' => false, ], 'et' => [ 'code' => 'et', 'english' => 'Estonian', 'local' => 'Eesti', 'rtl' => false, ], 'ja' => [ 'code' => 'ja', 'english' => 'Japanese', 'local' => '日本語', 'rtl' => false, ], 'hi' => [ 'code' => 'hi', 'english' => 'Hindi', 'local' => 'हिंदी', 'rtl' => false, ], 'ur' => [ 'code' => 'ur', 'english' => 'Urdu', 'local' => 'اردو', 'rtl' => false, ], 'co' => [ 'code' => 'co', 'english' => 'Corsican', 'local' => 'Corsu', 'rtl' => false, ], 'fj' => [ 'code' => 'fj', 'english' => 'Fijian', 'local' => 'Vosa Vakaviti', 'rtl' => false, ], 'hw' => [ 'code' => 'hw', 'english' => 'Hawaiian', 'local' => '‘Ōlelo Hawai‘i', 'rtl' => false, ], 'ig' => [ 'code' => 'ig', 'english' => 'Igbo', 'local' => 'Igbo', 'rtl' => false, ], 'ny' => [ 'code' => 'ny', 'english' => 'Chichewa', 'local' => 'chiCheŵa', 'rtl' => false, ], 'ps' => [ 'code' => 'ps', 'english' => 'Pashto', 'local' => 'پښت', 'rtl' => false, ], 'sd' => [ 'code' => 'sd', 'english' => 'Sindhi', 'local' => 'سنڌي، سندھی, सिन्धी', 'rtl' => false, ], 'sn' => [ 'code' => 'sn', 'english' => 'Shona', 'local' => 'chiShona', 'rtl' => false, ], 'to' => [ 'code' => 'to', 'english' => 'Tongan', 'local' => 'faka-Tonga', 'rtl' => false, ], 'yo' => [ 'code' => 'yo', 'english' => 'Yoruba', 'local' => 'Yorùbá', 'rtl' => false, ], 'zu' => [ 'code' => 'zu', 'english' => 'Zulu', 'local' => 'isiZulu', 'rtl' => false, ], 'ty' => [ 'code' => 'ty', 'english' => 'Tahitian', 'local' => 'te reo Tahiti, te reo Māʼohi', 'rtl' => false, ], 'sm' => [ 'code' => 'sm', 'english' => 'Samoan', 'local' => 'gagana fa\'a Samoa', 'rtl' => false, ], 'ku' => [ 'code' => 'ku', 'english' => 'Kurdish', 'local' => 'كوردی', 'rtl' => false, ], 'ha' => [ 'code' => 'ha', 'english' => 'Hausa', 'local' => 'هَوُسَ', 'rtl' => false, ], 'bn' => [ 'code' => 'bn', 'english' => 'Bengali', 'local' => 'বাংলা', 'rtl' => false, ], 'st' => [ 'code' => 'st', 'english' => 'Southern Sotho', 'local' => 'seSotho', 'rtl' => false, ], 'ba' => [ 'code' => 'ba', 'english' => 'Bashkir', 'local' => 'башҡорт теле', 'rtl' => false, ], 'jv' => [ 'code' => 'jv', 'english' => 'Javanese', 'local' => 'Wong Jawa', 'rtl' => false, ], 'kn' => [ 'code' => 'kn', 'english' => 'Kannada', 'local' => 'ಕನ್ನಡ', 'rtl' => false, ], 'la' => [ 'code' => 'la', 'english' => 'Latin', 'local' => 'Latine', 'rtl' => false, ], 'lo' => [ 'code' => 'lo', 'english' => 'Lao', 'local' => 'ພາສາລາວ', 'rtl' => false, ], 'mi' => [ 'code' => 'mi', 'english' => 'Māori', 'local' => 'te reo Māori', 'rtl' => false, ], 'ml' => [ 'code' => 'ml', 'english' => 'Malayalam', 'local' => 'മലയാളം', 'rtl' => false, ], 'mr' => [ 'code' => 'mr', 'english' => 'Marathi', 'local' => 'मराठी', 'rtl' => false, ], 'ne' => [ 'code' => 'ne', 'english' => 'Nepali', 'local' => 'नेपाली', 'rtl' => false, ], 'pa' => [ 'code' => 'pa', 'english' => 'Punjabi', 'local' => 'ਪੰਜਾਬੀ', 'rtl' => false, ], 'so' => [ 'code' => 'so', 'english' => 'Somali', 'local' => 'Soomaaliga', 'rtl' => false, ], 'su' => [ 'code' => 'su', 'english' => 'Sundanese', 'local' => 'Sundanese', 'rtl' => false, ], 'te' => [ 'code' => 'te', 'english' => 'Telugu', 'local' => 'తెలుగు', 'rtl' => false, ], 'yi' => [ 'code' => 'yi', 'english' => 'Yiddish', 'local' => 'ייִדיש', 'rtl' => false, ], 'am' => [ 'code' => 'am', 'english' => 'Amharic', 'local' => 'አማርኛ', 'rtl' => false, ], 'eo' => [ 'code' => 'eo', 'english' => 'Esperanto', 'local' => 'Esperanto', 'rtl' => false, ], 'fy' => [ 'code' => 'fy', 'english' => 'Western Frisian', 'local' => 'frysk', 'rtl' => false, ], 'gd' => [ 'code' => 'gd', 'english' => 'Scottish Gaelic', 'local' => 'Gàidhlig', 'rtl' => false, ], 'gu' => [ 'code' => 'gu', 'english' => 'Gujarati', 'local' => 'ગુજરાતી', 'rtl' => false, ], 'km' => [ 'code' => 'km', 'english' => 'Central Khmer', 'local' => 'ភាសាខ្មែរ', 'rtl' => false, ], 'lb' => [ 'code' => 'lb', 'english' => 'Luxembourgish', 'local' => 'Lëtzebuergesch', 'rtl' => false, ], 'my' => [ 'code' => 'my', 'english' => 'Burmese', 'local' => 'မျန္မာစာ', 'rtl' => false, ], 'si' => [ 'code' => 'si', 'english' => 'Sinhalese', 'local' => 'සිංහල', 'rtl' => false, ], 'ta' => [ 'code' => 'ta', 'english' => 'Tamil', 'local' => 'தமிழ்', 'rtl' => false, ], 'xh' => [ 'code' => 'xh', 'english' => 'Xhosa', 'local' => 'isiXhosa', 'rtl' => false, ], 'fl' => [ 'code' => 'fl', 'english' => 'Filipino', 'local' => 'Pilipino', 'rtl' => false, ] ]; }
Only used to replace API endpoint We planned to make this endpoint available soon ! @return array
entailment
public static function send($method, $action, $data, $files = null, $retryResponse = null) { ### 0. Check fail count ### if (!isset(self::$failCount) || is_null(self::$failCount)) { self::$failCount = 0; } if (is_null(self::$provider)) { throw new \Exception('Eroare la accesarea clasei derivate AuthProvider'); } self::$failCount++; $isLogin = false; if (self::$failCount > Config::MAX_FAILCOUNT) { if (!empty($retryResponse)) { throw new \Exception($retryResponse); } else { throw new \Exception('Autentificarea a esuat'); } } ### 1. Validate method and action, and build URL based on these ### // Sanity check if (!isset($method) || is_null($method) || empty($method) || !self::whitelistMethod($method)) { throw new \Exception('Metoda invalida'); } if (!isset($action) || is_null($action) || empty($action)) { throw new \Exception('Actiune invalida'); } if (!isset($data) || is_null($data)) { throw new \Exception('Datele nu pot fi nule'); } // Build URL $url = Config::$API_HTTP . $method . '/' . $action . '/'; $provider = self::$provider; ### 2. Authenticate user ## $token = ''; // Only get another instance if the method is not login if ($method != 'login' && $action != 'actionLogin') { // Get Auth instance $token = $provider::getToken(); } else { $isLogin = true; } ### 3. Uses dispatcher's guzzleClient object and makes a POST request to the API server ### // Check if test server has to be used if (Config::TEST) { $data['test'] = 1; } $data['api_version'] = Config::CURRENT_VERSION; // Build POST request with token placed in bearer authorization header $request = null; try { if (is_null($files)) { // No files to upload if (!Config::$IS_LIVE) { $headers['DEMO'] = 1; } $headers['AUTH'] = 'Bearer ' . $token; $request = self::getGuzzleClient()->request( 'POST', $url, array( 'form_params' => $data, 'headers' => $headers, ) ); } else { // Has files to upload /// Headers $options = array( 'headers' => array('AUTH' => 'Bearer ' . $token), ); /// Regular fields foreach ($data as $name => $value) { $options['multipart'][] = array( 'name' => $name, 'contents' => $value ); } /// Files foreach ($files as $fileName => $fileContents) { $options['multipart'][] = array( 'name' => $fileName, 'contents' => $fileContents, 'filename' => $fileName ); } $request = self::getGuzzleClient()->request( 'POST', $url, $options ); } } catch (RequestException $e) { // If a request exception is encountered if ($e->getResponse()->getStatusCode() == 400) { // If the exception has code 400, regenerate token if (!$isLogin) { $token = $provider::regenerateToken(); } return self::send($method, $action, $data, $files); } } ### 4. Process the response in order to throw relevant error messages or return the correctly formed response ### // Retrieve and decode contents $jsonContents = $request->getBody()->getContents(); $contents = json_decode($jsonContents); // Throw customised exception in case decoding fails if (json_last_error() !== JSON_ERROR_NONE) { throw new \Exception('Eroare la parsarea raspunsului: ' . $jsonContents); } // Check if the response returned a 302 error, in which case rerun this method if ($contents->error == 302 || $contents->error == 403 || $contents->error == 405) { $message = !empty($contents->message) && is_string($contents->message) ? $contents->message : null; if (!$isLogin) { $token = $provider::regenerateToken(); } return self::send($method, $action, $data, null, $message); } else { self::$failCount = 0; } // Return result if (is_object($contents)) { // Valid contents if ( isset($contents->error) && $contents->error === 0 && isset($contents->tokenStatus) && $contents->tokenStatus === 1 ) { // No error and token ok if (isset($contents->message)) { // Has message return $contents->message; } else { // Everything is fine, except the message throw new \Exception('Eroare: continutul nu are o forma adecvata : ' . $jsonContents); } } elseif (!isset($contents->tokenStatus) || $contents->tokenStatus === 0) { // Token problems if (isset($contents->error) && ($contents->error == 405 || $contents->error == 403)) { if (!empty($contents->message) && is_string($contents->message)) { throw new \Exception($contents->message); } else { throw new \Exception('Date de autentificare incorecte'); } } if (!$isLogin) { $token = $provider::regenerateToken(); } return self::send($method, $action, $data, null, $message); throw new \Exception('Eroare: token invalid'); } elseif (!isset($contents->error) || $contents->error !== 0) { // Error returned if (isset($contents->message)) { // Standard error return $contents; } else { // Exotic error throw new \Exception('Eroare neasteptata: ' . $jsonContents); } } } else { // Invalid contents throw new \Exception('Eroare: continutul are un format invalid: ' . $jsonContents); } }
Send data to API and retrieve response 0. Check fail count 1. Validate method and action, and build URL based on these 2. Authenticate user 3. Uses dispatcher's guzzleClient object and makes a POST request to the API server 4. Process the response in order to throw relevant error messages or return the correctly formed response @param $method @param $action @param $data @param null $files @return mixed @throws \Exception
entailment
public static function getGuzzleClient() { if (!isset(self::$guzzleClient) || is_null(self::$guzzleClient)) { self::$guzzleClient = new Client(array('timeout' => Config::TIMEOUT, 'connection_timeout' => Config::CONN_TIMEOUT, 'verify' => Config::$IS_LIVE)); } return self::$guzzleClient; }
Enforces the use of a single connection @return Client|null
entailment
public function deletePage($pageID){ // Sanity check if(!isset($pageID) || !is_int($pageID)) throw new \Exception('ID-ul trebuie sa fie un numar intreg'); // Set method and action $method = 'settings'; $action = 'deletePage'; // Set data $data = array('id' => $pageID); // Send request and retrieve response $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Sterge paginile pe baza ID-ului (https://github.com/celdotro/marketplace/wiki/Stergere-pagini) [EN] Delete page based on ID (https://github.com/celdotro/marketplace/wiki/Remove-page) @param $pageID @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function actionProviderTokens(array $variables = []) { $variables['provider'] = craft()->oauth->getProvider($variables['handle']); if($variables['provider']) { $this->renderTemplate('oauth/providers/_tokens', $variables); } else { throw new HttpException(404); } }
Provider Tokens @return null
entailment
public function actionDeleteToken(array $variables = array()) { $this->requirePostRequest(); $id = craft()->request->getRequiredPost('id'); $token = craft()->oauth->getTokenById($id); if (craft()->oauth->deleteToken($token)) { if (craft()->request->isAjaxRequest()) { $this->returnJson(array('success' => true)); } else { craft()->userSession->setNotice(Craft::t('Token deleted.')); $this->redirectToPostedUrl($token); } } else { if (craft()->request->isAjaxRequest()) { $this->returnJson(array('success' => false)); } else { craft()->userSession->setError(Craft::t('Couldn’t delete token.')); // Send the token back to the template craft()->urlManager->setRouteVariables(array( 'token' => $token )); } } }
Delete token. @return null
entailment
public function offsetSet($offset, $value) { if (isset($this->collection[$offset]) && $value instanceof AbstractCollectionEntry) { $this->collection[$offset] = $value; } }
{@inheritdoc}
entailment
public function get($id) { $request = $this->paystackHttpClient->get( $this->transformUrl(Resource::CUSTOMERS_URL, $id) ); return $this->processResourceRequestResponse($request); }
Get customer by customer code/id. @param $id @return \Exception|mixed
entailment
public function getAll($page = null) { $page = !empty($page) ? "page={$page}" : ''; $request = $this->paystackHttpClient->get( $this->transformUrl(Resource::CUSTOMERS_URL, '').$page ); return $this->processResourceRequestResponse($request); }
Get all customer. per page. @param null $page @return \Exception|mixed
entailment
public function save($body) { $request = $this->paystackHttpClient->post( $this->transformUrl(Resource::CUSTOMERS_URL, ''), [ 'body' => is_array($body) ? $this->toJson($body) : $body, ] ); return $this->processResourceRequestResponse($request); }
create new customer. @param $body @return \Exception|mixed
entailment
public function update($id, $body) { $request = $this->paystackHttpClient->put( $this->transformUrl(Resource::CUSTOMERS_URL, $id), [ 'body' => is_array($body) ? $this->toJson($body) : $body, ] ); return $this->processResourceRequestResponse($request); }
update customer. @param $id @param $body @return \Exception|mixed
entailment
public function parseJsonString(string $jsonString, string $entityClassName, array $sortColumns = null): ParsedRuleGroup { $doctrineParser = $this->newParser($entityClassName); return $doctrineParser->parse($this->jsonDeserializer->deserialize($jsonString), $sortColumns); }
@param string $jsonString @param string $entityClassName @param array|null $sortColumns @return ParsedRuleGroup
entailment
private function newParser(string $className) { if (!array_key_exists($className, $this->classNameToDoctrineParser)) { throw new \DomainException(sprintf( 'You have requested a Doctrine Parser for %s, but you have not defined a mapping for it in your configuration', $className )); } return $this->classNameToDoctrineParser[$className]; }
@param string $className @return DoctrineParser @throws \DomainException
entailment
public function getBillableProducts(){ // Set method and action $method = 'admininfo'; $action = 'GetBillableProducts'; // Set data $data = array('param' => 1); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Listeaza produsele facturabile (https://github.com/celdotro/marketplace/wiki/Listeaza-produsele-facturabile) [EN] List all products that can be billed (https://github.com/celdotro/marketplace/wiki/List-billable-products) @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function billProducts($products){ // Set method and action $method = 'admininfo'; $action = 'BillProducts'; // Set data $data = array('products' => $products); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Factureaza produsele disponibile (https://github.com/celdotro/marketplace/wiki/Factureaza-produse) [EN] Bills available products (https://github.com/celdotro/marketplace/wiki/Bill-products) @param $products @return mixed @throws \GuzzleHttp\Exception\GuzzleException
entailment
public function getServiceRequests($type, $page = 1){ // Set method and action $method = 'admininfo'; $action = 'GetServiceRequests'; // Set data $data = array('type' => $type, 'page' => $page); $result = Dispatcher::send($method, $action, $data); return $result; }
[RO] Preia cererile de service sau retur ale clientilor (https://github.com/celdotro/marketplace/wiki/Preia-cererile-de-service) [EN] Retrieve service or return requests (https://github.com/celdotro/marketplace/wiki/Retrieve-service-requests) @param $type @param int $page @return mixed
entailment
public function createProvider() { $config = [ 'clientId' => $this->providerInfos->clientId, 'clientSecret' => $this->providerInfos->clientSecret, 'redirectUri' => $this->getRedirectUri(), ]; return new \AdamPaterson\OAuth2\Client\Provider\Slack($config); }
Create Provider
entailment
public function createSubscriber(Oauth_TokenModel $token) { $infos = $this->getInfos(); return new \Dukt\OAuth\Guzzle\Subscribers\Slack([ 'access_token' => $token->accessToken, ]); }
Create Subscriber
entailment
public function getPlan($planCode) { $plan = $this->planResource->get($planCode); if ($plan instanceof \Exception) { throw $plan; } $this->setDeletable(true); return $this->_setAttributes($plan); }
Get plan by plan code. @param $planCode @throws @throws \Exception @return $this
entailment
public function make($name, $description, $amount, $currency, array $otherAttributes = []) { $this->name = $name; $this->description = $description; $this->amount = $amount; $this->currency = $currency; $this->_setAttributes($otherAttributes); $this->setCreatable(true); return $this; }
Create new Plan Object. @param $name @param $description @param $amount @param $currency @param array $otherAttributes @return $this
entailment
public function save() { $resourceResponse = null; if ($this->isCreatable() && !$this->isUpdateable()) { //available for creation $resourceResponse = $this->planResource->save($this->transform(ModelInterface::TRANSFORM_TO_JSON_ARRAY)); } if ($this->isUpdateable() && !$this->isCreatable()) { //available for update $resourceResponse = $this->planResource->update( $this->plan_code, $this->transform(ModelInterface::TRANSFORM_TO_JSON_ARRAY) ); } if ($resourceResponse == null) { throw new \InvalidArgumentException('You Cant Perform This Operation on an empty plan'); } if ($resourceResponse instanceof \Exception) { throw $resourceResponse; } return $this->_setAttributes($resourceResponse); }
Save/Update plan object. @throws \Exception @throws \Exception|mixed @throws null @return $this|Plan
entailment
public function transform($transformMode = '') { $planObject = [ 'plan_code' => $this->plan_code, 'name' => $this->name, 'description' => $this->description, 'amount' => $this->amount, 'interval' => $this->interval, 'currency' => $this->currency, 'hosted_page' => $this->hosted_page, 'hosted_page_url' => $this->hosted_page_url, 'hosted_page_summary' => $this->hosted_page_summary, 'subscription_count' => count($this->subscriptions), ]; switch ($transformMode) { case ModelInterface::TRANSFORM_TO_JSON_ARRAY: return json_encode($planObject); default: return $planObject; } }
Outward presentation of object. @param $transformMode @return mixed
entailment
public static function make($authorization, $amount, $email, $plan) { return new static( self::generateTransactionRef(), $authorization, $amount, $email, $plan ); }
Create a new returning transaction object. @param $authorization @param $amount @param $email @param $plan @return static
entailment