Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PaymentsPro.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 PaymentsPro extends Block
16 {
22  private $fields = [
23  'Partner' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_paypal_payflow_api_' .
24  'settings_partner',
25  'Vendor' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_paypal_payflow_api_' .
26  'settings_vendor',
27  'User' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_paypal_payflow_api_settings' .
28  '_user',
29  'Password' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_paypal_payflow_api_' .
30  'settings_pwd'
31  ];
32 
38  private $enablers = [
39  'Enable this Solution' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_enable_paypal' .
40  '_payflow',
41  'Enable PayPal Credit' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_enable_' .
42  'express_checkout_bml_payflow',
43  'Vault Enabled' => '#payment_us_paypal_group_all_in_one_wpp_usuk_paypal_payflow_required_payflowpro_cc_vault' .
44  '_active'
45  ];
46 
52  private $configureProButton = '#payment_us_paypal_group_all_in_one_wpp_usuk-head';
53 
59  public function specifyCredentials()
60  {
61  $this->_rootElement->find($this->fields['Partner'])->setValue('1');
62  $this->_rootElement->find($this->fields['Vendor'])->setValue('1');
63  $this->_rootElement->find($this->fields['User'])->setValue('1');
64  $this->_rootElement->find($this->fields['Password'])->setValue('1');
65  }
66 
72  public function clearCredentials()
73  {
74  $this->_rootElement->find($this->fields['Partner'])->setValue('');
75  $this->_rootElement->find($this->fields['Vendor'])->setValue('');
76  $this->_rootElement->find($this->fields['User'])->setValue('');
77  $this->_rootElement->find($this->fields['Password'])->setValue('');
78  }
79 
85  public function getFields()
86  {
87  return $this->fields;
88  }
89 
95  public function getEnablerFields()
96  {
97  return $this->enablers;
98  }
99 
105  public function clickConfigureButton()
106  {
107  $this->_rootElement->find($this->configureProButton)->click();
108  }
109 
115  public function enablePaymentsPro()
116  {
117  $this->_rootElement->find(
118  $this->enablers['Enable this Solution'],
119  Locator::SELECTOR_CSS,
120  'select'
121  )->setValue('Yes');
122  }
123 
129  public function disablePaymentsPro()
130  {
131  $this->_rootElement->find(
132  $this->enablers['Enable this Solution'],
133  Locator::SELECTOR_CSS,
134  'select'
135  )->setValue('No');
136  }
137 }