Skip to content

Commit bac1ff6

Browse files
authored
Merge pull request #978 from magento-mpi/api-coverage
- 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
2 parents 86d67e4 + d8a4d0e commit bac1ff6

File tree

91 files changed

+272
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+272
-41
lines changed

app/code/Magento/OfflinePayments/Model/Banktransfer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Bank Transfer payment method model
1010
*
1111
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
12+
*
13+
* @api
1214
*/
1315
class Banktransfer extends \Magento\Payment\Model\Method\AbstractMethod
1416
{

app/code/Magento/OfflinePayments/Model/Cashondelivery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Cash on delivery payment method model
1010
*
1111
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
12+
*
13+
* @api
1214
*/
1315
class Cashondelivery extends \Magento\Payment\Model\Method\AbstractMethod
1416
{

app/code/Magento/OfflinePayments/Model/Checkmo.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Class Checkmo
1010
*
1111
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
12+
*
13+
* @api
1214
*/
1315
class Checkmo extends \Magento\Payment\Model\Method\AbstractMethod
1416
{

app/code/Magento/OfflinePayments/Model/Purchaseorder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Class Purchaseorder
1010
*
1111
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
12+
*
13+
* @api
1214
*/
1315
class Purchaseorder extends \Magento\Payment\Model\Method\AbstractMethod
1416
{

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/banktransfer-method.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* @api */
67
define([
78
'ko',
89
'Magento_Checkout/js/view/payment/default'

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/cashondelivery-method.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* @api */
67
define([
78
'Magento_Checkout/js/view/payment/default'
89
], function (Component) {

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/checkmo-method.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* @api */
67
define([
78
'Magento_Checkout/js/view/payment/default'
89
], function (Component) {

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/method-renderer/purchaseorder-method.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* @api */
67
define([
78
'Magento_Checkout/js/view/payment/default',
89
'jquery',

app/code/Magento/OfflinePayments/view/frontend/web/js/view/payment/offline-payments.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/* @api */
67
define([
78
'uiComponent',
89
'Magento_Checkout/js/model/payment/renderer-list'

app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/**
1515
* Flat rate shipping model
16+
*
17+
* @api
1618
*/
1719
class Flatrate extends AbstractCarrier implements CarrierInterface
1820
{

app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

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

16+
/**
17+
* Free shipping model
18+
*
19+
* @api
20+
*/
1621
class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
1722
\Magento\Shipping\Model\Carrier\CarrierInterface
1823
{

app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

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

10+
/**
11+
* Pickup shipping model
12+
*
13+
* @api
14+
*/
1015
class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
1116
\Magento\Shipping\Model\Carrier\CarrierInterface
1217
{
@@ -54,34 +59,12 @@ public function __construct(
5459
/**
5560
* @param RateRequest $request
5661
* @return \Magento\Shipping\Model\Rate\Result
57-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
62+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5863
*/
5964
public function collectRates(RateRequest $request)
6065
{
61-
if (!$this->getConfigFlag('active')) {
62-
return false;
63-
}
64-
65-
/** @var \Magento\Shipping\Model\Rate\Result $result */
66-
$result = $this->_rateResultFactory->create();
67-
68-
if (!empty($rate)) {
69-
/** @var \Magento\Quote\Model\Quote\Address\RateResult\Method $method */
70-
$method = $this->_rateMethodFactory->create();
71-
72-
$method->setCarrier('pickup');
73-
$method->setCarrierTitle($this->getConfigData('title'));
74-
75-
$method->setMethod('store');
76-
$method->setMethodTitle(__('Store Pickup'));
77-
78-
$method->setPrice(0);
79-
$method->setCost(0);
80-
81-
$result->append($method);
82-
}
83-
84-
return $result;
66+
// Pickup shipping method is not supported in Magento2 yet.
67+
return false;
8568
}
8669

8770
/**

app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
use Magento\Framework\Exception\LocalizedException;
99
use Magento\Quote\Model\Quote\Address\RateRequest;
1010

11+
/**
12+
* Table rate shipping model
13+
*
14+
* @api
15+
*/
1116
class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements
1217
\Magento\Shipping\Model\Carrier\CarrierInterface
1318
{

app/code/Magento/OfflineShipping/Model/Config/Source/Flatrate.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\OfflineShipping\Model\Config\Source;
77

8+
/**
9+
* @api
10+
*/
811
class Flatrate implements \Magento\Framework\Option\ArrayInterface
912
{
1013
/**

app/code/Magento/OfflineShipping/Model/Config/Source/Tablerate.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\OfflineShipping\Model\Config\Source;
77

8+
/**
9+
* @api
10+
*/
811
class Tablerate implements \Magento\Framework\Option\ArrayInterface
912
{
1013
/**

app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
/**
2121
* @SuppressWarnings(PHPMD.TooManyFields)
2222
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
23+
*
24+
* @api
2325
*/
2426
class Tablerate extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
2527
{

app/code/Magento/OfflineShipping/Model/ResourceModel/Carrier/Tablerate/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Shipping table rates collection
1010
*
11-
* @author Magento Core Team <core@magentocommerce.com>
11+
* @api
1212
*/
1313
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
1414
{

app/code/Magento/OfflineShipping/Model/SalesRule/Calculator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Magento\SalesRule\Model\Validator;
1515

16+
/**
17+
* @api
18+
*/
1619
class Calculator extends Validator
1720
{
1821
/**

app/code/Magento/OfflineShipping/Model/SalesRule/Rule.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
namespace Magento\OfflineShipping\Model\SalesRule;
1313

14+
/**
15+
* @api
16+
*/
1417
class Rule
1518
{
1619
/**

app/code/Magento/OfflineShipping/Model/Source/SalesRule/FreeShippingOptions.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Framework\Data\OptionSourceInterface;
99
use Magento\OfflineShipping\Model\SalesRule\Rule;
1010

11+
/**
12+
* @api
13+
*/
1114
class FreeShippingOptions implements OptionSourceInterface
1215
{
1316
/**

app/code/Magento/Payment/Block/Adminhtml/Transparent/Form.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Payment\Block\Adminhtml\Transparent;
77

8+
/**
9+
* @api
10+
*/
811
class Form extends \Magento\Payment\Block\Transparent\Form
912
{
1013
/**

app/code/Magento/Payment/Block/Form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
/**
1111
* Payment method form base block
12+
*
13+
* @api
1214
*/
1315
class Form extends \Magento\Framework\View\Element\Template
1416
{

app/code/Magento/Payment/Block/Form/Cc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Payment\Block\Form;
77

8+
/**
9+
* @api
10+
*/
811
class Cc extends \Magento\Payment\Block\Form
912
{
1013
/**

app/code/Magento/Payment/Block/Form/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @method \Magento\Quote\Model\Quote getQuote()
1515
*
16-
* @author Magento Core Team <core@magentocommerce.com>
16+
* @api
1717
*/
1818
class Container extends \Magento\Framework\View\Element\Template
1919
{

app/code/Magento/Payment/Block/Info.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* Base payment iformation block
10+
*
11+
* @api
1012
*/
1113
class Info extends \Magento\Framework\View\Element\Template
1214
{

app/code/Magento/Payment/Block/Info/AbstractContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Payment information container block
1010
*
11-
* @author Magento Core Team <core@magentocommerce.com>
11+
* @api
1212
*/
1313
abstract class AbstractContainer extends \Magento\Framework\View\Element\Template
1414
{

app/code/Magento/Payment/Block/Info/Cc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* Credit card generic payment info
10+
*
11+
* @api
1012
*/
1113
class Cc extends \Magento\Payment\Block\Info
1214
{

app/code/Magento/Payment/Block/Info/Instructions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
/**
99
* Block for Bank Transfer payment generic info
10+
*
11+
* @api
1012
*/
1113
class Instructions extends \Magento\Payment\Block\Info
1214
{

app/code/Magento/Payment/Block/Transparent/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Transparent form block
1717
*
18-
* @author Magento Core Team <core@magentocommerce.com>
18+
* @api
1919
*/
2020
class Form extends \Magento\Payment\Block\Form\Cc
2121
{

app/code/Magento/Payment/Block/Transparent/Iframe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Iframe block for register specific params in layout
1010
*
11-
* @author Magento Core Team <core@magentocommerce.com>
11+
* @api
1212
*/
1313
class Iframe extends \Magento\Framework\View\Element\Template
1414
{

app/code/Magento/Payment/Block/Transparent/Info.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
/**
99
* Class Info. Payment Information block used for transparent redirect feature
10-
* @package Magento\Payment\Block\Transparent
10+
*
11+
* @api
1112
*/
1213
class Info extends \Magento\Framework\View\Element\Template
1314
{

app/code/Magento/Payment/Gateway/Command/NullCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88
use Magento\Payment\Gateway\Command;
99
use Magento\Payment\Gateway\CommandInterface;
1010

11+
/**
12+
* Null command. Does nothing.
13+
*
14+
* Use this class as an implementation of CommandInterface to ignore some action
15+
* or in case if command invoked by Magento has no sense for payment method.
16+
*
17+
* @api
18+
*/
1119
class NullCommand implements CommandInterface
1220
{
1321
/**
14-
* Null command. Does nothing. Stable.
22+
* Process command without any side effect.
1523
*
1624
* @param array $commandSubject
1725
*

app/code/Magento/Payment/Gateway/Command/Result/ArrayResult.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Payment\Gateway\Command\ResultInterface;
99

10+
/**
11+
* Container for array that should be returned as command result.
12+
*
13+
* @api
14+
*/
1015
class ArrayResult implements ResultInterface
1116
{
1217
/**

app/code/Magento/Payment/Gateway/Command/Result/BoolResult.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
use Magento\Payment\Gateway\Command\ResultInterface;
99

1010
/**
11-
* Class BoolResult
11+
* Container for boolean value that should be returned as command result.
12+
*
13+
* @api
1214
*/
1315
class BoolResult implements ResultInterface
1416
{

app/code/Magento/Payment/Gateway/Config/Config.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
use Magento\Payment\Gateway\ConfigInterface;
1010
use Magento\Store\Model\ScopeInterface;
1111

12+
/**
13+
* Default implementation of Payment Gateway Config.
14+
*
15+
* To process value retrieved from config implementation of \Magento\Payment\Gateway\Config\ValueHandlerInterface
16+
* should be used (inheritance and overriding of getValue method or introduction of new public methods
17+
* is not recommended).
18+
*/
1219
class Config implements ConfigInterface
1320
{
1421
const DEFAULT_PATH_PATTERN = 'payment/%s/%s';

app/code/Magento/Payment/Gateway/Config/ConfigValueHandler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
use Magento\Payment\Gateway\ConfigInterface;
99
use Magento\Payment\Gateway\Helper\SubjectReader;
1010

11+
/**
12+
* Default implementation of config value handler.
13+
*
14+
* This class is designed to be injected into other classes. Inheritance in not recommended.
15+
*
16+
* @api
17+
*/
1118
class ConfigValueHandler implements ValueHandlerInterface
1219
{
1320
/**

0 commit comments

Comments
 (0)