1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Braintree\Model\Ui\PayPal;
- use Magento\Braintree\Gateway\Config\PayPal\Config;
- use Magento\Checkout\Model\ConfigProviderInterface;
- use Magento\Framework\Locale\ResolverInterface;
- /**
- * Class ConfigProvider
- */
- class ConfigProvider implements ConfigProviderInterface
- {
- const PAYPAL_CODE = 'braintree_paypal';
- const PAYPAL_VAULT_CODE = 'braintree_paypal_vault';
- /**
- * @var Config
- */
- private $config;
- /**
- * @var ResolverInterface
- */
- private $resolver;
- /**
- * Initialize dependencies.
- *
- * @param Config $config
- * @param ResolverInterface $resolver
- */
- public function __construct(Config $config, ResolverInterface $resolver)
- {
- $this->config = $config;
- $this->resolver = $resolver;
- }
- /**
- * Retrieve assoc array of checkout configuration
- *
- * @return array
- */
- public function getConfig()
- {
- $requireBillingAddressAll = \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_ALL;
-
- return [
- 'payment' => [
- self::PAYPAL_CODE => [
- 'isActive' => $this->config->isActive(),
- 'title' => $this->config->getTitle(),
- 'isAllowShippingAddressOverride' => $this->config->isAllowToEditShippingAddress(),
- 'merchantName' => $this->config->getMerchantName(),
- 'locale' => $this->resolver->getLocale(),
- 'paymentAcceptanceMarkSrc' =>
- 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png',
- 'vaultCode' => self::PAYPAL_VAULT_CODE,
- 'skipOrderReview' => $this->config->isSkipOrderReview(),
- 'paymentIcon' => $this->config->getPayPalIcon(),
- 'isRequiredBillingAddress' =>
- (int)$this->config->isRequiredBillingAddress() === $requireBillingAddressAll
- ]
- ]
- ];
- }
- }
|