Source of file SellerAccount.php

Size: 6,748 Bytes - Last Modified: 2015-02-05T12:57:19+01:00

/www-data/git/ricardo/src/Diglin/Ricardo/Managers/SellerAccount.php

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
<?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\Managers;

use Diglin\Ricardo\Enums\Article\ArticlesTypes;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\ArticlesParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\ClosedArticlesParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\OpenArticlesParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\PlannedArticleParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\PlannedArticlesParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\SoldArticlesParameter;
use Diglin\Ricardo\Managers\SellerAccount\Parameter\UnsoldArticlesParameter;

/**
 * Class SellerAccount
 * @package Diglin\Ricardo\Managers
 */
class SellerAccount extends ManagerAbstract
{
    /**
     * @var string
     */
    protected $_serviceName = 'seller_account';

    /**
     * @var array
     */
    protected $_templates;

    /**
     * Add Card payment options to one or more articles
     *
     * @param array $articleIds
     * @return array
     */
    public function addCardPaymentOption(array $articleIds)
    {
        return $this->_proceed('AddCardPaymentOption', array('article_ids' => $articleIds));
    }

    /**
     * Get if an article is allowed to be modified or not
     *
     * @param int $articleId
     * @return bool
     */
    public function getArticleModificationAllowed($articleId)
    {
        return (bool) $this->_proceed('AssertArticleModification', $articleId);
    }

    /**
     * Get Article Information for NOT planned article
     *
     * @param string $articleId
     * @return array
     */
    public function getArticle($articleId)
    {
        return $this->_proceed('Article', $articleId);
    }

    /**
     * Get all auctions by date and type
     *
     * @param ArticlesParameter $parameter
     * @return array
     */
    public function getArticles(ArticlesParameter $parameter)
    {
        return $this->_proceed('Articles', $parameter);
    }

    /**
     * @param ClosedArticlesParameter $parameter
     * @return array
     */
    public function getClosedArticles(ClosedArticlesParameter $parameter)
    {
        return $this->_proceed('ClosedArticles', $parameter);
    }

    /**
     * Gets an open article.
     */
    public function getOpenArticle($articleId)
    {
        return $this->_proceed('OpenArticle', $articleId);
    }

    /**
     * Gets the open articles.
     *
     * @param OpenArticlesParameter $parameter
     * @return array
     */
    public function getOpenArticles(OpenArticlesParameter $parameter)
    {
        return $this->_proceed('OpenArticles', $parameter);
    }


    /**
     * Gets the payment options for a seller.
     *
     * @param int $customerId
     * @return array
     */
    public function getPaymentOptions($customerId = null)
    {
        if (is_null($customerId)) {
            $customer = new Customer($this->getServiceManager());
            $customerInfo = $customer->getCustomerInformation();
            if (isset($customerInfo['CustomerId'])) {
                $customerId = $customerInfo['CustomerId'];
            }
        }

        return $this->_proceed('PaymentOptions', $customerId);

    }

    /**
     * Gets a planned articles
     *
     * @param PlannedArticleParameter $parameter
     * @return array
     */
    public function getPlannedArticle(PlannedArticleParameter $parameter)
    {
        return $this->_proceed('PlannedArticle', $parameter);
    }

    /**
     * Gets the planned articles.
     *
     * @param PlannedArticlesParameter $parameter
     * @return array
     */
    public function getPlannedArticles(PlannedArticlesParameter $parameter)
    {
        return $this->_proceed('PlannedArticles', $parameter);
    }

    /**
     * Gets the planned pictures.
     */
    public function getPlannedPictures()
    {
        // @todo
    }

    /**
     * Gets list of customer's listing packages(normally should be just one item)
     *
     * @return array
     */
    public function getSellerPackages()
    {
        return $this->_proceed('SellerPackages');
    }

    /**
     * Gets the sold article.
     *
     * @param int $articleId
     * @return array
     */
    public function getSoldArticle($articleId)
    {
        return $this->_proceed('SoldArticle', $articleId);
    }

    /**
     * @param SoldArticlesParameter $parameter
     * @return array
     */
    public function getSoldArticles(SoldArticlesParameter $parameter)
    {
        return $this->_proceed('SoldArticles', $parameter);
    }

    /**
     * @return array
     */
    public function getTemplates()
    {
        if (empty($this->_templates)) {
            $this->_templates = $this->_proceed('Templates');
        }
        return $this->_templates;
    }

    /**
     * Gets the unsold article.
     */
    public function getUnsoldArticle($articleId)
    {
        return $this->_proceed('UnsoldArticle', $articleId);
    }

    /**
     * Gets the unsold articles
     *
     * @param UnsoldArticlesParameter $parameter
     * @return array
     */
    public function getUnsoldArticles(UnsoldArticlesParameter $parameter)
    {
        return $this->_proceed('UnsoldArticles', $parameter);
    }

    /**
     * Inserts the answer.
     */
    public function insertAnswer()
    {
        // @todo
    }

    /**
     * Inserts selected by customer listing package
     */
    public function insertSellerPackage()
    {
        // @todo
    }

    /**
     * Removes the card payment option from specified articles.
     */
    public function removeCardPaymentOption()
    {
        // @todo
    }

    /**
     * Sets if the article has cumulative shipping.
     */
    public function setCumulativeShipping()
    {
        // @todo
    }

    /**
     * Change the automatic reactivation for a premium package
     */
    public function setPremiumPackageAutomaticReactivation()
    {
        // @todo
    }
}