AmazonLoginMethod.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License").
  6. * You may not use this file except in compliance with the License.
  7. * A copy of the License is located at
  8. *
  9. * http://aws.amazon.com/apache2.0
  10. *
  11. * or in the "license" file accompanying this file. This file is distributed
  12. * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  13. * express or implied. See the License for the specific language governing
  14. * permissions and limitations under the License.
  15. */
  16. namespace Amazon\Payment\Model\Method;
  17. use Amazon\Core\Helper\Data as AmazonCoreHelper;
  18. /**
  19. * Class AmazonLoginMethod
  20. * For display of Amazon Pay in payment method list
  21. */
  22. class AmazonLoginMethod extends \Magento\Payment\Model\Method\AbstractMethod
  23. {
  24. const PAYMENT_METHOD_LOGIN_METHOD = 'amazonlogin';
  25. /**
  26. * Payment method code
  27. *
  28. * @var string
  29. */
  30. protected $_code = self::PAYMENT_METHOD_LOGIN_METHOD;
  31. /**
  32. * @var string
  33. */
  34. protected $_formBlockType = 'Magento\Payment\Block\Form';
  35. /**
  36. * Info instructions block path
  37. *
  38. * @var string
  39. */
  40. protected $_infoBlockType = 'Magento\Payment\Block\Info\Instructions';
  41. /**
  42. * Availability option
  43. *
  44. * @var bool
  45. */
  46. protected $_isOffline = true;
  47. /**
  48. * Is active
  49. *
  50. * @param int|null $storeId
  51. * @return bool
  52. */
  53. public function isActive($storeId = null)
  54. {
  55. return (bool)(int)$this->_scopeConfig->getValue(
  56. 'payment/amazon_pay/active',
  57. \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
  58. $storeId
  59. ) && (bool)(int)$this->getConfigData('active', $storeId);
  60. }
  61. }