Skip to content

Commit 6f7ddf9

Browse files
Merge remote-tracking branch 'remotes/github/MAGETWO-95821' into EPAM-PR-23
2 parents 790540d + 879961c commit 6f7ddf9

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

app/code/Magento/Paypal/Controller/Express/AbstractExpress.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@
77

88
use Magento\Checkout\Controller\Express\RedirectLoginInterface;
99
use Magento\Framework\App\Action\Action as AppAction;
10+
use Magento\Framework\App\Action\HttpGetActionInterface;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1012

1113
/**
1214
* Abstract Express Checkout Controller
1315
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1416
*/
15-
abstract class AbstractExpress extends AppAction implements RedirectLoginInterface
17+
abstract class AbstractExpress extends AppAction implements
18+
RedirectLoginInterface,
19+
HttpGetActionInterface,
20+
HttpPostActionInterface
1621
{
1722
/**
1823
* @var \Magento\Paypal\Model\Express\Checkout
@@ -137,6 +142,14 @@ protected function _initCheckout()
137142
$this->getResponse()->setStatusHeader(403, '1.1', 'Forbidden');
138143
throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t initialize Express Checkout.'));
139144
}
145+
if (!(float)$quote->getGrandTotal()) {
146+
throw new \Magento\Framework\Exception\LocalizedException(
147+
__(
148+
'PayPal can\'t process orders with a zero balance due. '
149+
. 'To finish your purchase, please go through the standard checkout process.'
150+
)
151+
);
152+
}
140153
if (!isset($this->_checkoutTypes[$this->_checkoutType])) {
141154
$parameters = [
142155
'params' => [
@@ -151,6 +164,8 @@ protected function _initCheckout()
151164
}
152165

153166
/**
167+
* Get Proper Checkout Token
168+
*
154169
* Search for proper checkout token in request or session or (un)set specified one
155170
* Combined getter/setter
156171
*
@@ -221,17 +236,15 @@ protected function _getQuote()
221236
}
222237

223238
/**
224-
* Returns before_auth_url redirect parameter for customer session
225-
* @return null
239+
* @inheritdoc
226240
*/
227241
public function getCustomerBeforeAuthUrl()
228242
{
229243
return;
230244
}
231245

232246
/**
233-
* Returns a list of action flags [flag_key] => boolean
234-
* @return array
247+
* @inheritdoc
235248
*/
236249
public function getActionFlagList()
237250
{
@@ -240,6 +253,7 @@ public function getActionFlagList()
240253

241254
/**
242255
* Returns login url parameter for redirect
256+
*
243257
* @return string
244258
*/
245259
public function getLoginUrl()
@@ -249,6 +263,7 @@ public function getLoginUrl()
249263

250264
/**
251265
* Returns action name which requires redirect
266+
*
252267
* @return string
253268
*/
254269
public function getRedirectActionName()
@@ -269,4 +284,9 @@ public function redirectLogin()
269284
$this->_urlHelper->addRequestParam($this->_customerUrl->getLoginUrl(), ['context' => 'checkout'])
270285
);
271286
}
287+
288+
/**
289+
* @inheritdoc
290+
*/
291+
abstract public function execute();
272292
}

0 commit comments

Comments
 (0)