Skip to content

Commit 80200f6

Browse files
mglamanmglaman
authored andcommitted
Issue #2854584 by vasike, mglaman, sumanthkumarc, julien, Londova, terribeausejour, sedax: Express Checkout gateway broken on Payment gateways UI
1 parent 3b7d3f6 commit 80200f6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,20 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
132132
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
133133
parent::validateConfigurationForm($form, $form_state);
134134

135-
if (!$form_state->getErrors()) {
135+
if (!$form_state->getErrors() && $form_state->isSubmitted()) {
136136
$values = $form_state->getValue($form['#parents']);
137137
$this->configuration['api_username'] = $values['api_username'];
138138
$this->configuration['api_password'] = $values['api_password'];
139139
$this->configuration['signature'] = $values['signature'];
140140
$this->configuration['solution_type'] = $values['solution_type'];
141-
}
142-
$response = $this->doRequest([
143-
'METHOD' => 'GetBalance',
144-
]);
145141

146-
if ($response['ACK'] != 'Success') {
147-
$form_state->setError($form['api_username'], $this->t('Invalid API credentials.'));
142+
$response = $this->doRequest([
143+
'METHOD' => 'GetBalance',
144+
]);
145+
146+
if ($response['ACK'] != 'Success') {
147+
$form_state->setError($form, $this->t('Invalid API credentials.'));
148+
}
148149
}
149150
}
150151

0 commit comments

Comments
 (0)