Skip to content

Commit b31423e

Browse files
committed
Merge branch '8.x-1.x' of github.com:drupalcommerce/commerce_paypal into 2843999-ipn-handler
2 parents 0bac0a3 + 80200f6 commit b31423e

File tree

4 files changed

+574
-7
lines changed

4 files changed

+574
-7
lines changed

config/schema/commerce_paypal.schema.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,18 @@ commerce_payment.commerce_payment_gateway.plugin.paypal_payments_pro:
2323
client_secret:
2424
type: string
2525
label: 'Client secret'
26+
commerce_payment.commerce_payment_gateway.plugin.paypal_payflow:
27+
type: commerce_payment_gateway_configuration
28+
mapping:
29+
partner:
30+
type: string
31+
label: 'Partner'
32+
vendor:
33+
type: string
34+
label: 'Vendor'
35+
user:
36+
type: string
37+
label: 'User'
38+
password:
39+
type: string
40+
label: 'Password'

src/Plugin/Commerce/PaymentGateway/ExpressCheckout.php

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

137-
if (!$form_state->getErrors()) {
137+
if (!$form_state->getErrors() && $form_state->isSubmitted()) {
138138
$values = $form_state->getValue($form['#parents']);
139139
$this->configuration['api_username'] = $values['api_username'];
140140
$this->configuration['api_password'] = $values['api_password'];
141141
$this->configuration['signature'] = $values['signature'];
142142
$this->configuration['solution_type'] = $values['solution_type'];
143-
}
144-
$response = $this->doRequest([
145-
'METHOD' => 'GetBalance',
146-
]);
147143

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

0 commit comments

Comments
 (0)