Skip to content

Commit

Permalink
Merge pull request #978 from magento-mpi/api-coverage
Browse files Browse the repository at this point in the history
- MAGETWO-65690 Cover Payment module with @api annotation
- MAGETWO-66607 Cover OfflinePayments module with @api annotation
- MAGETWO-66608 Cover OfflineShipping module with @api annotation
- MAGETWO-66609 Cover Vault module with @api annotation
  • Loading branch information
viktym authored Mar 30, 2017
2 parents 86d67e4 + d8a4d0e commit bac1ff6
Show file tree
Hide file tree
Showing 91 changed files with 272 additions and 41 deletions.
2 changes: 2 additions & 0 deletions app/code/Magento/OfflinePayments/Model/Banktransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Bank Transfer payment method model
*
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
*
* @api
*/
class Banktransfer extends \Magento\Payment\Model\Method\AbstractMethod
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/OfflinePayments/Model/Cashondelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Cash on delivery payment method model
*
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
*
* @api
*/
class Cashondelivery extends \Magento\Payment\Model\Method\AbstractMethod
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/OfflinePayments/Model/Checkmo.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Class Checkmo
*
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
*
* @api
*/
class Checkmo extends \Magento\Payment\Model\Method\AbstractMethod
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/OfflinePayments/Model/Purchaseorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Class Purchaseorder
*
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
*
* @api
*/
class Purchaseorder extends \Magento\Payment\Model\Method\AbstractMethod
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See COPYING.txt for license details.
*/

/* @api */
define([
'ko',
'Magento_Checkout/js/view/payment/default'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See COPYING.txt for license details.
*/

/* @api */
define([
'Magento_Checkout/js/view/payment/default'
], function (Component) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See COPYING.txt for license details.
*/

/* @api */
define([
'Magento_Checkout/js/view/payment/default'
], function (Component) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See COPYING.txt for license details.
*/

/* @api */
define([
'Magento_Checkout/js/view/payment/default',
'jquery',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* See COPYING.txt for license details.
*/

/* @api */
define([
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* Flat rate shipping model
*
* @api
*/
class Flatrate extends AbstractCarrier implements CarrierInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@

use Magento\Quote\Model\Quote\Address\RateRequest;

/**
* Free shipping model
*
* @api
*/
class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
\Magento\Shipping\Model\Carrier\CarrierInterface
{
Expand Down
33 changes: 8 additions & 25 deletions app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

use Magento\Quote\Model\Quote\Address\RateRequest;

/**
* Pickup shipping model
*
* @api
*/
class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
\Magento\Shipping\Model\Carrier\CarrierInterface
{
Expand Down Expand Up @@ -54,34 +59,12 @@ public function __construct(
/**
* @param RateRequest $request
* @return \Magento\Shipping\Model\Rate\Result
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function collectRates(RateRequest $request)
{
if (!$this->getConfigFlag('active')) {
return false;
}

/** @var \Magento\Shipping\Model\Rate\Result $result */
$result = $this->_rateResultFactory->create();

if (!empty($rate)) {
/** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
$method = $this->_rateMethodFactory->create();

$method->setCarrier('pickup');
$method->setCarrierTitle($this->getConfigData('title'));

$method->setMethod('store');
$method->setMethodTitle(__('Store Pickup'));

$method->setPrice(0);
$method->setCost(0);

$result->append($method);
}

return $result;
// Pickup shipping method is not supported in Magento2 yet.
return false;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Quote\Model\Quote\Address\RateRequest;

/**
* Table rate shipping model
*
* @api
*/
class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
\Magento\Shipping\Model\Carrier\CarrierInterface
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\OfflineShipping\Model\Config\Source;

/**
* @api
*/
class Flatrate implements \Magento\Framework\Option\ArrayInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\OfflineShipping\Model\Config\Source;

/**
* @api
*/
class Tablerate implements \Magento\Framework\Option\ArrayInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
/**
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
* @api
*/
class Tablerate extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Shipping table rates collection
*
* @author Magento Core Team <[email protected]>
* @api
*/
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

use Magento\SalesRule\Model\Validator;

/**
* @api
*/
class Calculator extends Validator
{
/**
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/OfflineShipping/Model/SalesRule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
namespace Magento\OfflineShipping\Model\SalesRule;

/**
* @api
*/
class Rule
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Magento\Framework\Data\OptionSourceInterface;
use Magento\OfflineShipping\Model\SalesRule\Rule;

/**
* @api
*/
class FreeShippingOptions implements OptionSourceInterface
{
/**
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Payment/Block/Adminhtml/Transparent/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Payment\Block\Adminhtml\Transparent;

/**
* @api
*/
class Form extends \Magento\Payment\Block\Transparent\Form
{
/**
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Payment/Block/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

/**
* Payment method form base block
*
* @api
*/
class Form extends \Magento\Framework\View\Element\Template
{
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Payment/Block/Form/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
*/
namespace Magento\Payment\Block\Form;

/**
* @api
*/
class Cc extends \Magento\Payment\Block\Form
{
/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Block/Form/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @method \Magento\Quote\Model\Quote getQuote()
*
* @author Magento Core Team <[email protected]>
* @api
*/
class Container extends \Magento\Framework\View\Element\Template
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Payment/Block/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Base payment iformation block
*
* @api
*/
class Info extends \Magento\Framework\View\Element\Template
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Block/Info/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Payment information container block
*
* @author Magento Core Team <[email protected]>
* @api
*/
abstract class AbstractContainer extends \Magento\Framework\View\Element\Template
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Payment/Block/Info/Cc.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Credit card generic payment info
*
* @api
*/
class Cc extends \Magento\Payment\Block\Info
{
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Payment/Block/Info/Instructions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Block for Bank Transfer payment generic info
*
* @api
*/
class Instructions extends \Magento\Payment\Block\Info
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Block/Transparent/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Transparent form block
*
* @author Magento Core Team <[email protected]>
* @api
*/
class Form extends \Magento\Payment\Block\Form\Cc
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Payment/Block/Transparent/Iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Iframe block for register specific params in layout
*
* @author Magento Core Team <[email protected]>
* @api
*/
class Iframe extends \Magento\Framework\View\Element\Template
{
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Payment/Block/Transparent/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

/**
* Class Info. Payment Information block used for transparent redirect feature
* @package Magento\Payment\Block\Transparent
*
* @api
*/
class Info extends \Magento\Framework\View\Element\Template
{
Expand Down
10 changes: 9 additions & 1 deletion app/code/Magento/Payment/Gateway/Command/NullCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@
use Magento\Payment\Gateway\Command;
use Magento\Payment\Gateway\CommandInterface;

/**
* Null command. Does nothing.
*
* Use this class as an implementation of CommandInterface to ignore some action
* or in case if command invoked by Magento has no sense for payment method.
*
* @api
*/
class NullCommand implements CommandInterface
{
/**
* Null command. Does nothing. Stable.
* Process command without any side effect.
*
* @param array $commandSubject
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

use Magento\Payment\Gateway\Command\ResultInterface;

/**
* Container for array that should be returned as command result.
*
* @api
*/
class ArrayResult implements ResultInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
use Magento\Payment\Gateway\Command\ResultInterface;

/**
* Class BoolResult
* Container for boolean value that should be returned as command result.
*
* @api
*/
class BoolResult implements ResultInterface
{
Expand Down
7 changes: 7 additions & 0 deletions app/code/Magento/Payment/Gateway/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
use Magento\Payment\Gateway\ConfigInterface;
use Magento\Store\Model\ScopeInterface;

/**
* Default implementation of Payment Gateway Config.
*
* To process value retrieved from config implementation of \Magento\Payment\Gateway\Config\ValueHandlerInterface
* should be used (inheritance and overriding of getValue method or introduction of new public methods
* is not recommended).
*/
class Config implements ConfigInterface
{
const DEFAULT_PATH_PATTERN = 'payment/%s/%s';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
use Magento\Payment\Gateway\ConfigInterface;
use Magento\Payment\Gateway\Helper\SubjectReader;

/**
* Default implementation of config value handler.
*
* This class is designed to be injected into other classes. Inheritance in not recommended.
*
* @api
*/
class ConfigValueHandler implements ValueHandlerInterface
{
/**
Expand Down
Loading

0 comments on commit bac1ff6

Please sign in to comment.