Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Braintree.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Block\Block;
10 use Magento\Mtf\Client\Locator;
11 
15 class Braintree extends Block
16 {
22  private $fields = [
23  'Merchant ID' => '#payment_us_braintree_section_braintree_braintree_required_merchant_id',
24  'Public Key' => '#payment_us_braintree_section_braintree_braintree_required_public_key',
25  'Private Key' => '#payment_us_braintree_section_braintree_braintree_required_private_key',
26  ];
27 
33  private $enablers = [
34  'Enable this Solution' => "#payment_us_braintree_section_braintree_active",
35  'Enable PayPal through Braintree' => '#payment_us_braintree_section_braintree_active_braintree_paypal',
36  'Vault Enabled' => '#payment_us_braintree_section_braintree_braintree_cc_vault_active'
37  ];
38 
44  private $configureBraintreeButton = '#payment_us_braintree_section_braintree-head';
45 
51  public function getFields()
52  {
53  return $this->fields;
54  }
55 
61  public function specifyCredentials()
62  {
63  $this->_rootElement->find($this->fields['Merchant ID'])->setValue('1');
64  $this->_rootElement->find($this->fields['Public Key'])->setValue('1');
65  $this->_rootElement->find($this->fields['Private Key'])->setValue('1');
66  }
67 
73  public function clearCredentials()
74  {
75  $this->_rootElement->find($this->fields['Merchant ID'])->setValue('');
76  $this->_rootElement->find($this->fields['Public Key'])->setValue('');
77  $this->_rootElement->find($this->fields['Private Key'])->setValue('');
78  }
79 
85  public function getEnablerFields()
86  {
87  return $this->enablers;
88  }
89 
95  public function clickConfigureButton()
96  {
97  $this->_rootElement->find($this->configureBraintreeButton)->click();
98  }
99 
105  public function enableBraintree()
106  {
107  $this->_rootElement->find(
108  $this->enablers['Enable this Solution'],
109  Locator::SELECTOR_CSS,
110  'select'
111  )->setValue('Yes');
112  }
113 
119  public function disableBraintree()
120  {
121  $this->_rootElement->find(
122  $this->enablers['Enable this Solution'],
123  Locator::SELECTOR_CSS,
124  'select'
125  )->setValue('No');
126  }
127 }