| Total Complexity | 7 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class WidgetController extends AbstractController |
||
| 17 | { |
||
| 18 | const AMAZON_PAY_CONFIG = 'amazonpayConfig'; |
||
| 19 | const LOGOUT = 'logout'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return array |
||
| 23 | */ |
||
| 24 | public function payButtonAction() |
||
| 25 | { |
||
| 26 | return [ |
||
| 27 | static::AMAZON_PAY_CONFIG => $this->getAmazonPayConfig(), |
||
| 28 | static::LOGOUT => (int)$this->isLogout(), |
||
| 29 | ]; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return bool |
||
| 34 | */ |
||
| 35 | protected function isLogout() |
||
| 36 | { |
||
| 37 | $quote = $this->getFactory()->getQuoteClient()->getQuote(); |
||
| 38 | |||
| 39 | return $quote->getAmazonpayPayment() |
||
| 40 | && $quote->getAmazonpayPayment()->getResponseHeader() |
||
| 41 | && !$quote->getAmazonpayPayment()->getResponseHeader()->getIsSuccess(); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return array |
||
| 46 | */ |
||
| 47 | public function checkoutWidgetAction() |
||
| 48 | { |
||
| 49 | return [ |
||
| 50 | static::AMAZON_PAY_CONFIG => $this->getAmazonPayConfig(), |
||
| 51 | ]; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return array |
||
| 56 | */ |
||
| 57 | public function walletWidgetAction() |
||
| 61 | ]; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return \SprykerEco\Shared\AmazonPay\AmazonPayConfigInterface |
||
| 66 | */ |
||
| 67 | protected function getAmazonPayConfig() |
||
| 70 | } |
||
| 71 | } |
||
| 72 |