diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index 27f72fb347f391cd41e74da27eb83713e46abd1a..8cf93dd33eaa66b2e65598029299152b508dc991 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -34,7 +34,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart protected $_directoryBlock; /** - * @var \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface + * @var \Magento\Shipping\Model\CarrierFactoryInterface */ protected $_carrierFactory; @@ -48,7 +48,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Directory\Block\Data $directoryBlock - * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param PriceCurrencyInterface $priceCurrency * @param array $data */ @@ -57,7 +57,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, PriceCurrencyInterface $priceCurrency, array $data = [] ) { diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 50db79346bdbb9c2e5c0f05a300135a83e6d7161..2877afcf85ed8820a084c34cd72c03874baf4996 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -10,6 +10,7 @@ "magento/module-customer": "0.74.0-beta4", "magento/module-catalog": "0.74.0-beta4", "magento/module-payment": "0.74.0-beta4", + "magento/module-shipping": "0.74.0-beta4", "magento/module-tax": "0.74.0-beta4", "magento/module-directory": "0.74.0-beta4", "magento/module-eav": "0.74.0-beta4", diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 6d5c1720a2ce7b03dd418fb59139810ca3592116..dc2388e4e0c5606d3fbc3ff45c0a36d97d128da4 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -295,10 +295,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return bool|Result|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -1255,10 +1255,10 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Processing additional validation to check is carrier applicable. * - * @param RateRequest $request - * @return $this|Error|boolean + * @param \Magento\Framework\Object $request + * @return $this|\Magento\Framework\Object|boolean */ - public function proccessAdditionalValidation(RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { diff --git a/app/code/Magento/Fedex/Model/Carrier.php b/app/code/Magento/Fedex/Model/Carrier.php index 51ac852ac050d79893f68a4dc7a1d4fc47da9ad8..66f266dd1a8450611cba7a72e55e406a135e6caa 100644 --- a/app/code/Magento/Fedex/Model/Carrier.php +++ b/app/code/Magento/Fedex/Model/Carrier.php @@ -236,10 +236,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php index ff96421b77034d67dc4cf1cb6ab6c4d83077d3ad..d85a0d771d2fb3a8602b779c84ca27c9204efccf 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php @@ -55,12 +55,12 @@ class Flatrate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implement } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php index 0586b180b8832ae34b16ca6267c77dab93df82e4..fdbc3c264671dfe4714d0f003a48d54efcba85dc 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Freeshipping.php @@ -58,10 +58,10 @@ class Freeshipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier imple /** * FreeShipping Rates Collector * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result|bool */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php index e1411217d1d5d1b96dae3cfd82ee4ba78047b4b1..40df2042c043dbb3782b0d3e6b8f3d6a1d304734 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Pickup.php @@ -50,11 +50,11 @@ class Pickup extends \Magento\Shipping\Model\Carrier\AbstractCarrier implements } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.UnusedLocalVariable) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php index 4456feee0578c38c56347f4ec2f474d5d5d765fa..21c1fc1cf75899ce1fdbb49c15e31c9865d57c32 100644 --- a/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Carrier/Tablerate.php @@ -72,13 +72,13 @@ class Tablerate extends \Magento\Shipping\Model\Carrier\AbstractCarrier implemen } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag('active')) { return false; diff --git a/app/code/Magento/Payment/Model/Cart.php b/app/code/Magento/Payment/Model/Cart.php index 85962afa760aac013aa161f98e21225336030a10..436bdc899a48d198278823bd4ec1c381384d6447 100644 --- a/app/code/Magento/Payment/Model/Cart.php +++ b/app/code/Magento/Payment/Model/Cart.php @@ -75,7 +75,7 @@ class Cart /** * @param \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel + * @param \Magento\Quote\Api\Data\CartInterface $salesModel */ public function __construct( \Magento\Payment\Model\Cart\SalesModel\Factory $salesModelFactory, @@ -91,6 +91,7 @@ class Cart * Return payment cart sales model * * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface + * @api */ public function getSalesModel() { @@ -102,6 +103,7 @@ class Cart * * @param float $taxAmount * @return void + * @api */ public function addTax($taxAmount) { @@ -113,6 +115,7 @@ class Cart * * @param float $taxAmount * @return void + * @api */ public function setTax($taxAmount) { @@ -123,6 +126,7 @@ class Cart * Get tax amount * * @return float + * @api */ public function getTax() { @@ -134,6 +138,7 @@ class Cart * * @param float $discountAmount * @return void + * @api */ public function addDiscount($discountAmount) { @@ -145,6 +150,7 @@ class Cart * * @param float $discountAmount * @return void + * @api */ public function setDiscount($discountAmount) { @@ -155,6 +161,7 @@ class Cart * Get discount amount * * @return float + * @api */ public function getDiscount() { @@ -166,6 +173,7 @@ class Cart * * @param float $shippingAmount * @return void + * @api */ public function addShipping($shippingAmount) { @@ -177,6 +185,7 @@ class Cart * * @param float $shippingAmount * @return void + * @api */ public function setShipping($shippingAmount) { @@ -187,6 +196,7 @@ class Cart * Get shipping amount * * @return float + * @api */ public function getShipping() { @@ -198,6 +208,7 @@ class Cart * * @param float $subtotalAmount * @return void + * @api */ public function addSubtotal($subtotalAmount) { @@ -208,6 +219,7 @@ class Cart * Get subtotal amount * * @return float + * @api */ public function getSubtotal() { @@ -222,6 +234,7 @@ class Cart * @param float $amount * @param string|null $identifier * @return void + * @api */ public function addCustomItem($name, $qty, $amount, $identifier = null) { @@ -232,6 +245,7 @@ class Cart * Get all cart items * * @return array + * @api */ public function getAllItems() { @@ -243,6 +257,7 @@ class Cart * Get shipping, tax, subtotal and discount amounts all together * * @return array + * @api */ public function getAmounts() { @@ -255,6 +270,7 @@ class Cart * Specify that shipping should be transferred as cart item * * @return void + * @api */ public function setTransferShippingAsItem() { @@ -265,6 +281,7 @@ class Cart * Specify that discount should be transferred as cart item * * @return void + * @api */ public function setTransferDiscountAsItem() { diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php index 186a6fc45f5c8dc0ffe77e8f31aa54476da796ba..f077e1a72f1870943e626cbcc0dc41c1062c9ac6 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/Factory.php @@ -26,7 +26,7 @@ class Factory /** * Wrap sales model with Magento\Payment\Model\Cart\SalesModel\SalesModelInterface * - * @param \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote $salesModel + * @param \Magento\Quote\Api\Data\CartInterface $salesModel * @return \Magento\Payment\Model\Cart\SalesModel\SalesModelInterface * @throws \InvalidArgumentException */ diff --git a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php index 117eb8b1d48e2ba5fd61cf5c504e67f6730c7003..a210f55bb3a2b3f7cb6a7d75d92377bac6070b17 100644 --- a/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php +++ b/app/code/Magento/Payment/Model/Cart/SalesModel/SalesModelInterface.php @@ -14,26 +14,31 @@ interface SalesModelInterface * Get all items from shopping sales model * * @return array + * @api */ public function getAllItems(); /** * @return float|null + * @api */ public function getBaseSubtotal(); /** * @return float|null + * @api */ public function getBaseTaxAmount(); /** * @return float|null + * @api */ public function getBaseShippingAmount(); /** * @return float|null + * @api */ public function getBaseDiscountAmount(); @@ -43,13 +48,15 @@ interface SalesModelInterface * @param string $key * @param mixed $args * @return mixed + * @api */ public function getDataUsingMethod($key, $args = null); /** * Return object that contains tax related fields * - * @return \Magento\Sales\Model\Order|\Magento\Quote\Model\Quote\Address + * @return \Magento\Sales\Api\Data\OrderInterface|\Magento\Quote\Api\Data\AddressInterface + * @api */ public function getTaxContainer(); } diff --git a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php index d2bb13d0eda1823369883e738efa3888c7507b65..9d2ad43801e5ebda0834b4c4adff7019e4631b65 100644 --- a/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php +++ b/app/code/Magento/Payment/Model/Checks/PaymentMethodChecksInterface.php @@ -14,6 +14,7 @@ interface PaymentMethodChecksInterface * Retrieve payment method code * * @return string + * @api */ public function getCode(); @@ -22,6 +23,7 @@ interface PaymentMethodChecksInterface * Can be used in admin * * @return bool + * @api */ public function canUseInternal(); @@ -29,6 +31,7 @@ interface PaymentMethodChecksInterface * Can be used in regular checkout * * @return bool + * @api */ public function canUseCheckout(); @@ -37,6 +40,7 @@ interface PaymentMethodChecksInterface * * @param string $country * @return bool + * @api */ public function canUseForCountry($country); @@ -45,6 +49,7 @@ interface PaymentMethodChecksInterface * * @param string $currencyCode * @return bool + * @api */ public function canUseForCurrency($currencyCode); @@ -55,6 +60,7 @@ interface PaymentMethodChecksInterface * @param int|string|null|\Magento\Store\Model\Store $storeId * * @return mixed + * @api */ public function getConfigData($field, $storeId = null); } diff --git a/app/code/Magento/Payment/Model/Config.php b/app/code/Magento/Payment/Model/Config.php index 62a196bfce79f0b267fea1af1edc2cbf5dd35097..9d782ce97998d70e2a78f63ecd92a51fa7a1a2ed 100644 --- a/app/code/Magento/Payment/Model/Config.php +++ b/app/code/Magento/Payment/Model/Config.php @@ -86,6 +86,7 @@ class Config * Retrieve active system payments * * @return array + * @api */ public function getActiveMethods() { @@ -107,6 +108,7 @@ class Config * Get list of credit card types * * @return array + * @api */ public function getCcTypes() { @@ -117,6 +119,7 @@ class Config * Retrieve array of payment methods information * * @return array + * @api */ public function getMethodsInfo() { @@ -127,6 +130,7 @@ class Config * Get payment groups * * @return array + * @api */ public function getGroups() { @@ -137,6 +141,7 @@ class Config * Retrieve list of months translation * * @return array + * @api */ public function getMonths() { @@ -155,6 +160,7 @@ class Config * Retrieve array of available years * * @return array + * @api */ public function getYears() { diff --git a/app/code/Magento/Payment/Model/InfoInterface.php b/app/code/Magento/Payment/Model/InfoInterface.php index 270ee9c16fe89c98208ec2f8ac1cde356adae12b..b39670441cf23d5fd320c6faf98f421ee39b5321 100644 --- a/app/code/Magento/Payment/Model/InfoInterface.php +++ b/app/code/Magento/Payment/Model/InfoInterface.php @@ -16,6 +16,7 @@ interface InfoInterface * * @param string $data * @return string + * @api */ public function encrypt($data); @@ -24,6 +25,7 @@ interface InfoInterface * * @param string $data * @return string + * @api */ public function decrypt($data); @@ -33,6 +35,7 @@ interface InfoInterface * @param string $key * @param string|null $value * @return mixed + * @api */ public function setAdditionalInformation($key, $value = null); @@ -41,6 +44,7 @@ interface InfoInterface * * @param mixed|null $key * @return bool + * @api */ public function hasAdditionalInformation($key = null); @@ -49,6 +53,7 @@ interface InfoInterface * * @param string|null $key * @return $this + * @api */ public function unsAdditionalInformation($key = null); @@ -57,6 +62,7 @@ interface InfoInterface * * @param string|null $key * @return mixed + * @api */ public function getAdditionalInformation($key = null); @@ -65,6 +71,7 @@ interface InfoInterface * * @return \Magento\Payment\Model\MethodInterface * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function getMethodInstance(); } diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 74e26082b6c0b7525c47b07c57f5c6cf08bc263d..e316982a1be7081f470bc8cb2493d19ea0debfea 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -260,6 +260,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check order availability * * @return bool + * @api */ public function canOrder() { @@ -270,6 +271,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check authorize availability * * @return bool + * @api */ public function canAuthorize() { @@ -280,6 +282,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check capture availability * * @return bool + * @api */ public function canCapture() { @@ -290,6 +293,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check partial capture availability * * @return bool + * @api */ public function canCapturePartial() { @@ -300,6 +304,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check whether capture can be performed once and no further capture possible * * @return bool + * @api */ public function canCaptureOnce() { @@ -310,6 +315,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check refund availability * * @return bool + * @api */ public function canRefund() { @@ -320,6 +326,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check partial refund availability for invoice * * @return bool + * @api */ public function canRefundPartialPerInvoice() { @@ -332,6 +339,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Framework\Object $payment * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function canVoid(\Magento\Framework\Object $payment) { @@ -363,6 +371,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Can be edit order (renew order) * * @return bool + * @api */ public function canEdit() { @@ -373,6 +382,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Check fetch transaction info availability * * @return bool + * @api */ public function canFetchTransactionInfo() { @@ -386,6 +396,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param string $transactionId * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId) { @@ -396,6 +407,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve payment system relation flag * * @return bool + * @api */ public function isGateway() { @@ -406,6 +418,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve payment method online/offline flag * * @return bool + * @api */ public function isOffline() { @@ -416,6 +429,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Flag if we need to run payment initialize while order place * * @return bool + * @api */ public function isInitializeNeeded() { @@ -482,6 +496,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Retrieve block type for display method information * * @return string + * @api */ public function getInfoBlockType() { @@ -491,8 +506,9 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Retrieve payment information model object * - * @return \Magento\Payment\Model\Info + * @return \Magento\Payment\Model\InfoInterface * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function getInfoInstance() { @@ -508,6 +524,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function validate() { @@ -537,6 +554,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function order(\Magento\Framework\Object $payment, $amount) { @@ -555,6 +573,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function authorize(\Magento\Framework\Object $payment, $amount) { @@ -573,6 +592,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function capture(\Magento\Framework\Object $payment, $amount) { @@ -591,6 +611,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param Invoice $invoice * @param Payment $payment * @return $this + * @api */ public function processInvoice($invoice, $payment) { @@ -606,6 +627,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param Invoice $invoice * @param Payment $payment * @return $this + * @api */ public function processBeforeRefund($invoice, $payment) { @@ -621,6 +643,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function refund(\Magento\Framework\Object $payment, $amount) { @@ -635,6 +658,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo * @param Payment $payment * @return $this + * @api */ public function processCreditmemo($creditmemo, $payment) { @@ -649,6 +673,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function cancel(\Magento\Framework\Object $payment) { @@ -661,6 +686,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Framework\Object $payment * @return $this * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function void(\Magento\Framework\Object $payment) { @@ -676,6 +702,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Payment\Model\InfoInterface $payment * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function canReviewPayment(\Magento\Payment\Model\InfoInterface $payment) { @@ -688,6 +715,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Payment\Model\InfoInterface $payment * @return false * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment) { @@ -703,6 +731,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * @param \Magento\Payment\Model\InfoInterface $payment * @return false * @throws \Magento\Framework\Exception\LocalizedException + * @api */ public function denyPayment(\Magento\Payment\Model\InfoInterface $payment) { @@ -744,6 +773,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @param array|\Magento\Framework\Object $data * @return $this + * @api */ public function assignData($data) { @@ -759,6 +789,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Prepare info instance for save * * @return $this + * @api */ public function prepareSave() { @@ -768,9 +799,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl /** * Check whether payment method can be used * - * TODO: payment method instance is not supposed to know about quote - * - * @param \Magento\Quote\Model\Quote|null $quote + * @param \Magento\Quote\Api\Data\CartInterface|null $quote * @return bool */ public function isAvailable($quote = null) @@ -797,6 +826,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return $this * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function initialize($paymentAction, $stateObject) { @@ -808,6 +838,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * Used to universalize payment actions when processing payment place * * @return string + * @api */ public function getConfigPaymentAction() { @@ -832,6 +863,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getDebugFlag() { @@ -843,6 +875,7 @@ abstract class AbstractMethod extends \Magento\Framework\Model\AbstractExtensibl * * @param mixed $debugData * @return void + * @api */ public function debugData($debugData) { diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 167f88c7e9fca09662aaad2148ed7c3599c210f9..978e75c5840aaeae528aad5111f93b3c77fc75c5 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -250,6 +250,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @return bool + * @api */ public function hasVerification() { @@ -262,6 +263,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @return array + * @api */ public function getVerificationRegEx() { @@ -298,6 +300,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * @param string $type * @return bool + * @api */ public function otherCcType($type) { @@ -309,6 +312,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * * @param string $ccNumber * @return bool + * @api */ public function validateCcNum($ccNumber) { @@ -348,6 +352,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * * @param string $ccNumber * @return bool + * @api */ public function validateCcNumOther($ccNumber) { @@ -357,7 +362,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod /** * Check whether there are CC types set in configuration * - * @param \Magento\Quote\Model\Quote|null $quote + * @param \Magento\Quote\Api\Data\CartInterface|null $quote * @return bool */ public function isAvailable($quote = null) diff --git a/app/code/Magento/Payment/Model/MethodInterface.php b/app/code/Magento/Payment/Model/MethodInterface.php index 0e6c1da86887622a33d98efeb2df06b65e14741b..f800703d73e3cf04cbbd8294c70262e5fb60ae0a 100644 --- a/app/code/Magento/Payment/Model/MethodInterface.php +++ b/app/code/Magento/Payment/Model/MethodInterface.php @@ -15,6 +15,7 @@ interface MethodInterface * Retrieve payment method code * * @return string + * @api */ public function getCode(); @@ -22,6 +23,7 @@ interface MethodInterface * Retrieve block type for method form generation * * @return string + * @api */ public function getFormBlockType(); @@ -29,6 +31,7 @@ interface MethodInterface * Retrieve payment method title * * @return string + * @api */ public function getTitle(); } diff --git a/app/code/Magento/Payment/Model/MethodList.php b/app/code/Magento/Payment/Model/MethodList.php index 8ba8a76d77acc33da2bb8e9c2f1423776ed76313..5d486411b9f7a8d63139579ff76d55d13e26ccb8 100644 --- a/app/code/Magento/Payment/Model/MethodList.php +++ b/app/code/Magento/Payment/Model/MethodList.php @@ -33,10 +33,11 @@ class MethodList } /** - * @param \Magento\Quote\Model\Quote $quote + * @param \Magento\Quote\Api\Data\CartInterface $quote * @return \Magento\Payment\Model\MethodInterface[] + * @api */ - public function getAvailableMethods(\Magento\Quote\Model\Quote $quote = null) + public function getAvailableMethods(\Magento\Quote\Api\Data\CartInterface $quote = null) { $store = $quote ? $quote->getStoreId() : null; $methods = []; @@ -54,10 +55,10 @@ class MethodList * Check payment method model * * @param \Magento\Payment\Model\MethodInterface $method - * @param \Magento\Quote\Model\Quote $quote + * @param \Magento\Quote\Api\Data\CartInterface $quote * @return bool */ - protected function _canUseMethod($method, \Magento\Quote\Model\Quote $quote) + protected function _canUseMethod($method, \Magento\Quote\Api\Data\CartInterface $quote) { return $this->methodSpecificationFactory->create( [ diff --git a/app/code/Magento/Quote/Model/Quote.php b/app/code/Magento/Quote/Model/Quote.php index 1d663cfd5d942c84d88a63f9161cdc9773f2c4aa..88010642002f69ba6d36ff56c882fd2f96076ccd 100644 --- a/app/code/Magento/Quote/Model/Quote.php +++ b/app/code/Magento/Quote/Model/Quote.php @@ -2253,12 +2253,6 @@ class Quote extends AbstractExtensibleModel implements \Magento\Quote\Api\Data\C { if (!$this->getReservedOrderId()) { $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this)); - } else { - //checking if reserved order id was already used for some order - //if yes reserving new one if not using old one - if ($this->_getResource()->isOrderIncrementIdUsed($this->getReservedOrderId())) { - $this->setReservedOrderId($this->_getResource()->getReservedOrderId($this)); - } } return $this; } diff --git a/app/code/Magento/Quote/Model/Quote/Address.php b/app/code/Magento/Quote/Model/Quote/Address.php index c57a8d0d5e8163661cdb1e240d60924801c3e5bb..4cddfa347659b75a2930348d1fb19cf54bf3226c 100644 --- a/app/code/Magento/Quote/Model/Quote/Address.php +++ b/app/code/Magento/Quote/Model/Quote/Address.php @@ -248,7 +248,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements * @param \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory * @param Address\TotalFactory $addressTotalFactory * @param \Magento\Framework\Object\Copy $objectCopyService - * @param Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param Address\Validator $validator * @param \Magento\Customer\Model\Address\Mapper $addressMapper * @param \Magento\Framework\Model\Resource\AbstractResource $resource @@ -280,7 +280,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress implements \Magento\Quote\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory, \Magento\Quote\Model\Quote\Address\TotalFactory $addressTotalFactory, \Magento\Framework\Object\Copy $objectCopyService, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, Address\Validator $validator, \Magento\Customer\Model\Address\Mapper $addressMapper, \Magento\Framework\Model\Resource\AbstractResource $resource = null, diff --git a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php index 6f58b342a667a7b0a56dee8e649007f5710ddfba..3b4649c44736fce125edcde2e664247dd5a22411 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php +++ b/app/code/Magento/Quote/Model/Quote/Address/ToOrder.php @@ -75,7 +75,8 @@ class ToOrder '\Magento\Sales\Api\Data\OrderInterface' ); $order->setStoreId($object->getQuote()->getStoreId()) - ->setQuoteId($object->getQuote()->getId()); + ->setQuoteId($object->getQuote()->getId()) + ->setIncrementId($object->getQuote()->getReservedOrderId()); $this->objectCopyService->copyFieldsetToTarget('sales_convert_quote', 'to_order', $object->getQuote(), $order); $this->eventManager->dispatch( diff --git a/app/code/Magento/Quote/Model/Resource/Quote.php b/app/code/Magento/Quote/Model/Resource/Quote.php index 4483f59150e89ab68d768e1971b2507ce8461194..990902300124466ee9cdc4a3437425e9f5841156 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote.php +++ b/app/code/Magento/Quote/Model/Resource/Quote.php @@ -16,22 +16,22 @@ use Magento\Framework\Model\Resource\Db\AbstractDb; class Quote extends AbstractDb { /** - * @var \Magento\Eav\Model\Config + * @var \Magento\SalesSequence\Model\Manager */ - protected $_config; + protected $sequenceManager; /** * @param \Magento\Framework\Model\Resource\Db\Context $context - * @param \Magento\Eav\Model\Config $config - * @param string|null $resourcePrefix + * @param \Magento\SalesSequence\Model\Manager $sequenceManager + * @param null $resourcePrefix */ public function __construct( \Magento\Framework\Model\Resource\Db\Context $context, - \Magento\Eav\Model\Config $config, + \Magento\SalesSequence\Model\Manager $sequenceManager, $resourcePrefix = null ) { parent::__construct($context, $resourcePrefix); - $this->_config = $config; + $this->sequenceManager = $sequenceManager; } /** @@ -156,28 +156,8 @@ class Quote extends AbstractDb */ public function getReservedOrderId($quote) { - $storeId = (int)$quote->getStoreId(); - return $this->_config->getEntityType(\Magento\Sales\Model\Order::ENTITY)->fetchNewIncrementId($storeId); - } - - /** - * Check is order increment id use in sales/order table - * - * @param int $orderIncrementId - * @return bool - */ - public function isOrderIncrementIdUsed($orderIncrementId) - { - $adapter = $this->_getReadAdapter(); - $bind = [':increment_id' => $orderIncrementId]; - $select = $adapter->select(); - $select->from($this->getTable('sales_order'), 'entity_id')->where('increment_id = :increment_id'); - $entity_id = $adapter->fetchOne($select, $bind); - if ($entity_id > 0) { - return true; - } - - return false; + return $this->sequenceManager->getSequence(\Magento\Sales\Model\Order::ENTITY, (int)$quote->getStoreId()) + ->getNextValue(); } /** diff --git a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php index 6801bb83f5e43e43ad241ac5fed14dae285e9302..f21945483c6873facccac4eb9efeebe611ba723c 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/Address/Rate/Collection.php @@ -24,7 +24,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac * @param \Psr\Log\LoggerInterface $logger * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -33,7 +33,7 @@ class Collection extends \Magento\Framework\Model\Resource\Db\Collection\Abstrac \Psr\Log\LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Quote\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + \Magento\Shipping\Model\CarrierFactoryInterface $carrierFactory, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php index 8dea99e3bed4cc480d50780aff182647a8d95a37..0859ec68fe7bde8d106915f6a98a7c013813872b 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Address/ToOrderTest.php @@ -84,7 +84,7 @@ class ToOrderTest extends \PHPUnit_Framework_TestCase $object = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false); $quote = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false); - $object->expects($this->exactly(4))->method('getQuote')->willReturn($quote); + $object->expects($this->exactly(5))->method('getQuote')->willReturn($quote); $quote->expects($this->once())->method('getId')->willReturn($quoteId); $quote->expects($this->once())->method('getStoreId')->willReturn($storeId); $this->objectCopyMock->expects($this->once())->method('getDataFromFieldset')->with( diff --git a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php b/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php deleted file mode 100644 index 33885a47c6bb30365fdff0b0ca2ed287dc4a2bf8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Quote/Test/Unit/Model/Resource/QuoteTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Quote\Test\Unit\Model\Resource; - -class QuoteTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Quote\Model\Resource\Quote - */ - protected $model; - - /** - * @var \Magento\Framework\App\Resource - */ - protected $resourceMock; - - /** - * @var \Magento\Eav\Model\Config - */ - protected $configMock; - - /** - * @var \Magento\Framework\DB\Adapter\Pdo\Mysql - */ - protected $adapterMock; - - /** - * @var \Magento\Framework\DB\Select - */ - protected $selectMock; - - protected function setUp() - { - $this->selectMock = $this->getMock('\Magento\Framework\DB\Select', [], [], '', false); - $this->selectMock->expects($this->any())->method('from')->will($this->returnSelf()); - $this->selectMock->expects($this->any())->method('where'); - - $this->adapterMock = $this->getMock('\Magento\Framework\DB\Adapter\Pdo\Mysql', [], [], '', false); - $this->adapterMock->expects($this->any())->method('select')->will($this->returnValue($this->selectMock)); - - $this->resourceMock = $this->getMock('\Magento\Framework\App\Resource', [], [], '', false); - $this->resourceMock->expects( - $this->any() - )->method( - 'getConnection' - )->will( - $this->returnValue($this->adapterMock) - ); - - $this->configMock = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false); - - $contextMock = $this->getMock('\Magento\Framework\Model\Resource\Db\Context', [], [], '', false); - $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock); - - $this->model = new \Magento\Quote\Model\Resource\Quote( - $contextMock, - $this->configMock - ); - } - - /** - * @param $value - * @dataProvider isOrderIncrementIdUsedDataProvider - */ - public function testIsOrderIncrementIdUsed($value) - { - $expectedBind = [':increment_id' => $value]; - $this->adapterMock->expects($this->once())->method('fetchOne')->with($this->selectMock, $expectedBind); - $this->model->isOrderIncrementIdUsed($value); - } - - /** - * @return array - */ - public function isOrderIncrementIdUsedDataProvider() - { - return [[100000001], ['10000000001'], ['M10000000001']]; - } -} diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json index 2d867ccca552b0bf3dee8361003601c036092d3a..173e239f796d8072845d23365a02360f0f45a16d 100644 --- a/app/code/Magento/Quote/composer.json +++ b/app/code/Magento/Quote/composer.json @@ -10,6 +10,8 @@ "magento/module-authorization": "0.74.0-beta4", "magento/module-payment": "0.74.0-beta4", "magento/module-sales": "0.74.0-beta4", + "magento/module-shipping": "0.74.0-beta4", + "magento/module-sales-sequence": "0.74.0-beta4", "magento/module-backend": "0.74.0-beta4", "magento/module-directory": "0.74.0-beta4", "magento/module-eav": "0.74.0-beta4", diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 517a40fe28ed150a3f02cd66cf834f7f0e80fc41..94847e91dbe200c9ea34764d4981d08ac986db98 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -521,7 +521,7 @@ class Order extends AbstractModel implements EntityInterface, OrderInterface */ protected function _canVoidOrder() { - return !($this->canUnhold() || $this->isPaymentReview()); + return !($this->isCanceled() || $this->canUnhold() || $this->isPaymentReview()); } /** diff --git a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php index d3a0a17afb3e01472852a13c96b1c486fe9f0572..b222a99d487454639b77b3a2552c45115a8f1919 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/OrderTest.php @@ -348,6 +348,11 @@ class OrderTest extends \PHPUnit_Framework_TestCase $order->setData('state', $orderState); $payment = $this->_prepareOrderPayment($order); $canVoidOrder = true; + + if ($orderState == \Magento\Sales\Model\Order::STATE_CANCELED) { + $canVoidOrder = false; + } + if ($orderState == \Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW) { $canVoidOrder = false; } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index fd793ff3d03a7945feee7850449a192985b97485..04e8bc658ade10cc6a5f6d42ce34d7835710a5f4 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -8,10 +8,12 @@ namespace Magento\Shipping\Model\Carrier; -use Magento\Quote\Model\Quote\Address\AbstractCarrierInterface; use Magento\Quote\Model\Quote\Address\RateResult\Error; use Magento\Shipping\Model\Shipment\Request; +/** + * Class AbstractCarrier + */ abstract class AbstractCarrier extends \Magento\Framework\Object implements AbstractCarrierInterface { /** @@ -137,6 +139,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst * @param string $field * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getConfigFlag($field) { @@ -154,11 +157,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Shipping\Model\Rate\Result|bool|null * @abstract */ - abstract public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request); + abstract public function collectRates(\Magento\Framework\Object $request); /** * Do request to shipment @@ -276,11 +279,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst } /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ - public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function checkAvailableShipCountries(\Magento\Framework\Object $request) { $speCountriesAllow = $this->getConfigData('sallowspecific'); /* @@ -323,11 +326,11 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request - * @return $this|bool|Error + * @param \Magento\Framework\Object $request + * @return $this|bool|\Magento\Framework\Object * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { return $this; } @@ -593,6 +596,7 @@ abstract class AbstractCarrier extends \Magento\Framework\Object implements Abst * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) + * @api */ public function getDebugFlag() { diff --git a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php similarity index 83% rename from app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php rename to app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php index acc4f1b93d48291383afedf533b76438717bdaca..a8a9f2f747c31adfd37f69aae90489b571b69298 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/AbstractCarrierInterface.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierInterface.php @@ -3,8 +3,11 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Quote\Model\Quote\Address; +namespace Magento\Shipping\Model\Carrier; +/** + * Interface AbstractCarrierInterface + */ interface AbstractCarrierInterface { /** @@ -12,16 +15,18 @@ interface AbstractCarrierInterface * * @param string $field * @return mixed + * @api */ public function getConfigData($field); /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object|bool|null + * @api */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function collectRates(\Magento\Framework\Object $request); /** * Do request to shipment @@ -29,6 +34,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object + * @api */ public function requestToShipment($request); @@ -38,6 +44,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $request * @return \Magento\Framework\Object + * @api */ public function returnOfShipment($request); @@ -46,6 +53,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object|null $params * @return array + * @api */ public function getContainerTypes(\Magento\Framework\Object $params = null); @@ -53,6 +61,7 @@ interface AbstractCarrierInterface * Get Container Types, that could be customized * * @return array + * @api */ public function getCustomizableContainerTypes(); @@ -61,27 +70,31 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object|null $params * @return array + * @api */ public function getDeliveryConfirmationTypes(\Magento\Framework\Object $params = null); /** - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return $this|bool|false|\Magento\Framework\Model\AbstractModel + * @api */ - public function checkAvailableShipCountries(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function checkAvailableShipCountries(\Magento\Framework\Object $request); /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request - * @return $this|\Magento\Quote\Model\Quote\Address\RateResult\Error|boolean + * @param \Magento\Framework\Object $request + * @return $this|\Magento\Framework\Object|boolean + * @api */ - public function proccessAdditionalValidation(\Magento\Quote\Model\Quote\Address\RateRequest $request); + public function proccessAdditionalValidation(\Magento\Framework\Object $request); /** * Determine whether current carrier enabled for activity * * @return bool + * @api */ public function isActive(); @@ -89,6 +102,7 @@ interface AbstractCarrierInterface * Whether this carrier has fixed rates calculation * * @return bool + * @api */ public function isFixed(); @@ -96,6 +110,7 @@ interface AbstractCarrierInterface * Check if carrier has shipping tracking option available * * @return bool + * @api */ public function isTrackingAvailable(); @@ -103,6 +118,7 @@ interface AbstractCarrierInterface * Check if carrier has shipping label option available * * @return bool + * @api */ public function isShippingLabelsAvailable(); @@ -110,6 +126,7 @@ interface AbstractCarrierInterface * Retrieve sort order of current carrier * * @return string|null + * @api */ public function getSortOrder(); @@ -118,6 +135,7 @@ interface AbstractCarrierInterface * * @param float $cost * @return float final price for shipping method + * @api */ public function getFinalPriceWithHandlingFee($cost); @@ -126,6 +144,7 @@ interface AbstractCarrierInterface * * @param int $weight in someone measure * @return float Weight in pounds + * @api */ public function convertWeightToLbs($weight); @@ -134,6 +153,7 @@ interface AbstractCarrierInterface * * @param int|float $weight * @return int|float weight + * @api */ public function getTotalNumOfBoxes($weight); @@ -141,6 +161,7 @@ interface AbstractCarrierInterface * Is state province required * * @return bool + * @api */ public function isStateProvinceRequired(); @@ -148,6 +169,7 @@ interface AbstractCarrierInterface * Check if city option required * * @return bool + * @api */ public function isCityRequired(); @@ -156,6 +178,7 @@ interface AbstractCarrierInterface * * @param string|null $countryId * @return bool + * @api */ public function isZipCodeRequired($countryId = null); @@ -164,6 +187,7 @@ interface AbstractCarrierInterface * * @param mixed $debugData * @return void + * @api */ public function debugData($debugData); @@ -171,6 +195,7 @@ interface AbstractCarrierInterface * Getter for carrier code * * @return string + * @api */ public function getCarrierCode(); @@ -179,6 +204,7 @@ interface AbstractCarrierInterface * * @param \Magento\Framework\Object $params * @return array + * @api */ public function getContentTypes(\Magento\Framework\Object $params); } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index e4f38e73beec05dc3b6955429b04c0ffa6af97e8..99e544593f16bc73c2b191233afa2ffe99184657 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -157,6 +157,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @param string $code * @return $this + * @api */ public function setActiveFlag($code = 'active') { @@ -179,6 +180,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @param string $tracking * @return string|false + * @api */ public function getTrackingInfo($tracking) { @@ -249,6 +251,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param RateRequest $request * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @api */ public function getAllItems(RateRequest $request) { @@ -279,12 +282,12 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * Processing additional validation to check if carrier applicable. * - * @param RateRequest $request - * @return $this|bool|Error + * @param \Magento\Framework\Object $request + * @return $this|bool|\Magento\Framework\Object * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function proccessAdditionalValidation(RateRequest $request) + public function proccessAdditionalValidation(\Magento\Framework\Object $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { @@ -523,6 +526,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * * @todo implement rollback logic * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function rollBack($data) { @@ -572,6 +576,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param null|string $countyDest * @return bool * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @api */ public function isGirthAllowed($countyDest = null) { @@ -581,6 +586,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier /** * @param \Magento\Framework\Object|null $request * @return $this + * @api */ public function setRawRequest($request) { @@ -594,6 +600,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param string $cost * @param string $method * @return float|string + * @api */ public function getMethodPrice($cost, $method = '') { @@ -615,6 +622,7 @@ abstract class AbstractCarrierOnline extends AbstractCarrier * @param string $customSimplexml * * @return \SimpleXMLElement|bool + * @api */ public function parseXml($xmlContent, $customSimplexml = 'SimpleXMLElement') { diff --git a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php index 980fe636356a5edcac7dc153e174085d21ac2c28..f422d20a9e3a3ed33ce3c5f560c1d4d57589d84a 100644 --- a/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php +++ b/app/code/Magento/Shipping/Model/Carrier/CarrierInterface.php @@ -11,6 +11,7 @@ interface CarrierInterface * Check if carrier has shipping tracking option available * * @return boolean + * @api */ public function isTrackingAvailable(); @@ -18,6 +19,7 @@ interface CarrierInterface * Get allowed shipping methods * * @return array + * @api */ public function getAllowedMethods(); } diff --git a/app/code/Magento/Shipping/Model/CarrierFactory.php b/app/code/Magento/Shipping/Model/CarrierFactory.php index ac7dcc25146347f60e41e5e6696a02b171dc1c1a..699a7a3be09aa754363f208b337b5d3e416fa832 100644 --- a/app/code/Magento/Shipping/Model/CarrierFactory.php +++ b/app/code/Magento/Shipping/Model/CarrierFactory.php @@ -5,8 +5,9 @@ */ namespace Magento\Shipping\Model; -use Magento\Quote\Model\Quote\Address\CarrierFactoryInterface; - +/** + * Class CarrierFactory + */ class CarrierFactory implements CarrierFactoryInterface { /** diff --git a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php similarity index 83% rename from app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php rename to app/code/Magento/Shipping/Model/CarrierFactoryInterface.php index 9cd570db6feeccecbecad70df05a0ba2a58ab44e..2c0ac4c801d2f21ae0746930329689e5fb0f2e11 100644 --- a/app/code/Magento/Quote/Model/Quote/Address/CarrierFactoryInterface.php +++ b/app/code/Magento/Shipping/Model/CarrierFactoryInterface.php @@ -3,8 +3,13 @@ * Copyright © 2015 Magento. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Quote\Model\Quote\Address; +namespace Magento\Shipping\Model; +use Magento\Shipping\Model\Carrier\AbstractCarrierInterface; + +/** + * Interface CarrierFactoryInterface + */ interface CarrierFactoryInterface { /** @@ -12,6 +17,7 @@ interface CarrierFactoryInterface * * @param string $carrierCode * @return bool|AbstractCarrierInterface + * @api */ public function get($carrierCode); @@ -21,6 +27,7 @@ interface CarrierFactoryInterface * @param string $carrierCode * @param int|null $storeId * @return bool|AbstractCarrierInterface + * @api */ public function create($carrierCode, $storeId = null); @@ -29,6 +36,7 @@ interface CarrierFactoryInterface * * @param string $carrierCode * @return bool|AbstractCarrierInterface + * @api */ public function getIfActive($carrierCode); @@ -38,6 +46,7 @@ interface CarrierFactoryInterface * @param string $carrierCode * @param null|int $storeId * @return bool|AbstractCarrierInterface + * @api */ public function createIfActive($carrierCode, $storeId = null); } diff --git a/app/code/Magento/Shipping/etc/di.xml b/app/code/Magento/Shipping/etc/di.xml index 92fad82f65d25fb31c36ebc8f3de56a5b3abb8d7..9b785dac596f1f2a0bf2addc690fa8ca8cec1799 100644 --- a/app/code/Magento/Shipping/etc/di.xml +++ b/app/code/Magento/Shipping/etc/di.xml @@ -7,6 +7,6 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <preference for="Magento\Quote\Model\Quote\Address\RateCollectorInterface" type="Magento\Shipping\Model\Shipping" /> - <preference for="Magento\Quote\Model\Quote\Address\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> + <preference for="Magento\Shipping\Model\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> <preference for="Magento\Shipping\Model\Carrier\Source\GenericInterface" type="\Magento\Shipping\Model\Carrier\Source\GenericDefault" /> </config> diff --git a/app/code/Magento/Ups/Model/Carrier.php b/app/code/Magento/Ups/Model/Carrier.php index e88b68ea433cafc08dba11c7c4dbec7547c6aaf8..3085a8b35c988766d5d48820d5727fc498c1bf65 100644 --- a/app/code/Magento/Ups/Model/Carrier.php +++ b/app/code/Magento/Ups/Model/Carrier.php @@ -184,10 +184,10 @@ class Carrier extends AbstractCarrierOnline implements CarrierInterface /** * Collect and get rates * - * @param RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/app/code/Magento/Usps/Model/Carrier.php b/app/code/Magento/Usps/Model/Carrier.php index 49976c39fef46b183e6fd46190f5a28edfd11336..2d7845696c840f6695756459fa162e9c1832b5b5 100644 --- a/app/code/Magento/Usps/Model/Carrier.php +++ b/app/code/Magento/Usps/Model/Carrier.php @@ -177,10 +177,10 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C /** * Collect and get rates * - * @param \Magento\Quote\Model\Quote\Address\RateRequest $request + * @param \Magento\Framework\Object $request * @return Result|bool|null */ - public function collectRates(\Magento\Quote\Model\Quote\Address\RateRequest $request) + public function collectRates(\Magento\Framework\Object $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php deleted file mode 100644 index 7b3f1e37c8db98dd810ec1553d1033b9159022dd..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Resource/QuoteTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Sales\Model\Resource; - -class QuoteTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Quote\Model\Resource\Quote - */ - protected $_resourceModel; - - protected function setUp() - { - $this->_resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Quote\Model\Resource\Quote' - ); - } - - /** - * @magentoDataFixture Magento/Sales/_files/order.php - */ - public function testIsOrderIncrementIdUsedNumericIncrementId() - { - $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('100000001')); - } - - /** - * @magentoDataFixture Magento/Sales/_files/order_alphanumeric_id.php - */ - public function testIsOrderIncrementIdUsedAlphanumericIncrementId() - { - $this->assertTrue($this->_resourceModel->isOrderIncrementIdUsed('M00000001')); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index 1862adfcee81f7a0d9a509e88b0d51b9febd2b05..c476e27898e83aa6c0632abe182c97d668349729 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -48,7 +48,7 @@ $quote->setCustomerIsGuest( 'Magento\Store\Model\StoreManagerInterface' )->getStore()->getId() )->setReservedOrderId( - 'test01' + '100000001' )->setBillingAddress( $billingAddress )->setShippingAddress( diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 36a143317f30e558a4695c544ff38b9660c2ecc0..6a1f2846a85df46a6293a7fc8c210feddce5d60d 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -2163,4 +2163,5 @@ return [ ['addOrderedQty', 'Magento\Reports\Model\Resource\Product\Collection'], ['prepareForProductsInCarts', 'Magento\Reports\Model\Resource\Quote\Collection'], ['getOrdersSubSelect', 'Magento\Reports\Model\Resource\Quote\Collection'], + ['isOrderIncrementIdUsed', 'Magento\Quote\Model\Resource\Quote'], ];