Commit 8da8824e authored by GiorgosK's avatar GiorgosK

Add auto redirect option on settings page

parent 5715320a
......@@ -40,6 +40,9 @@ commerce_payment.commerce_payment_gateway.plugin.winbankpayment_redirect:
request_type:
type: string
label: 'RequestType'
auto_redirect:
type: boolean
label: 'Auto Redirect'
......
......@@ -46,6 +46,7 @@ class WinbankPaymentRedirect extends OffsitePaymentGatewayBase {
'request_type' => '02',
'currency_code' => '978',
'language_code' => 'en-US',
'auto_redirect' => 1,
] + parent::defaultConfiguration();
}
......@@ -159,6 +160,14 @@ class WinbankPaymentRedirect extends OffsitePaymentGatewayBase {
'#default_value' => $this->configuration['language_code'],
];
$form['auto_redirect'] = [
'#type' => 'checkbox',
'#required' => FALSE,
'#title' => $this->t('Auto Redirect'),
'#description' => $this->t('Should the user be automatically redirected to bank ?'),
'#default_value' => $this->configuration['auto_redirect'],
];
return $form;
}
......@@ -182,6 +191,7 @@ class WinbankPaymentRedirect extends OffsitePaymentGatewayBase {
$this->configuration['currency_code'] = $values['currency_code'];
$this->configuration['language_code'] = $values['language_code'];
$this->configuration['request_type'] = $values['request_type'];
$this->configuration['auto_redirect'] = $values['auto_redirect'];
}
}
......
......@@ -71,6 +71,9 @@ class WinbankPaymentRedirectForm extends BasePaymentOffsiteForm {
];
$form = $this->buildRedirectForm($form, $form_state, $config['paycenter_url'], $data, 'post');
if($config['auto_redirect']){
unset($form['#attached']['library']);
}
return $form;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment