7
7
8
8
use Magento \Checkout \Controller \Express \RedirectLoginInterface ;
9
9
use Magento \Framework \App \Action \Action as AppAction ;
10
+ use Magento \Framework \App \Action \HttpGetActionInterface ;
11
+ use Magento \Framework \App \Action \HttpPostActionInterface ;
10
12
11
13
/**
12
14
* Abstract Express Checkout Controller
13
15
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14
16
*/
15
- abstract class AbstractExpress extends AppAction implements RedirectLoginInterface
17
+ abstract class AbstractExpress extends AppAction implements
18
+ RedirectLoginInterface,
19
+ HttpGetActionInterface,
20
+ HttpPostActionInterface
16
21
{
17
22
/**
18
23
* @var \Magento\Paypal\Model\Express\Checkout
@@ -137,6 +142,14 @@ protected function _initCheckout()
137
142
$ this ->getResponse ()->setStatusHeader (403 , '1.1 ' , 'Forbidden ' );
138
143
throw new \Magento \Framework \Exception \LocalizedException (__ ('We can \'t initialize Express Checkout. ' ));
139
144
}
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
+ }
140
153
if (!isset ($ this ->_checkoutTypes [$ this ->_checkoutType ])) {
141
154
$ parameters = [
142
155
'params ' => [
@@ -151,6 +164,8 @@ protected function _initCheckout()
151
164
}
152
165
153
166
/**
167
+ * Get Proper Checkout Token
168
+ *
154
169
* Search for proper checkout token in request or session or (un)set specified one
155
170
* Combined getter/setter
156
171
*
@@ -221,17 +236,15 @@ protected function _getQuote()
221
236
}
222
237
223
238
/**
224
- * Returns before_auth_url redirect parameter for customer session
225
- * @return null
239
+ * @inheritdoc
226
240
*/
227
241
public function getCustomerBeforeAuthUrl ()
228
242
{
229
243
return ;
230
244
}
231
245
232
246
/**
233
- * Returns a list of action flags [flag_key] => boolean
234
- * @return array
247
+ * @inheritdoc
235
248
*/
236
249
public function getActionFlagList ()
237
250
{
@@ -240,6 +253,7 @@ public function getActionFlagList()
240
253
241
254
/**
242
255
* Returns login url parameter for redirect
256
+ *
243
257
* @return string
244
258
*/
245
259
public function getLoginUrl ()
@@ -249,6 +263,7 @@ public function getLoginUrl()
249
263
250
264
/**
251
265
* Returns action name which requires redirect
266
+ *
252
267
* @return string
253
268
*/
254
269
public function getRedirectActionName ()
@@ -269,4 +284,9 @@ public function redirectLogin()
269
284
$ this ->_urlHelper ->addRequestParam ($ this ->_customerUrl ->getLoginUrl (), ['context ' => 'checkout ' ])
270
285
);
271
286
}
287
+
288
+ /**
289
+ * @inheritdoc
290
+ */
291
+ abstract public function execute ();
272
292
}
0 commit comments