Skip to content
Snippets Groups Projects
Commit 6273210c authored by Vadym Abramchuk's avatar Vadym Abramchuk Committed by Vadym Abramchuk
Browse files

Issue #3270758 by abramm: Introduce strict interface check

parent f018bc1b
Branches
Tags
1 merge request!6Issue #3270758: 3D Secure support
......@@ -2,6 +2,7 @@
namespace Drupal\commerce_omise\PluginForm\Omise;
use Drupal\commerce_omise\Plugin\Commerce\PaymentGateway\OmiseInterface;
use Drupal\commerce_payment\PluginForm\PaymentMethodAddForm as BasePaymentMethodAddForm;
use Drupal\Core\Form\FormStateInterface;
......@@ -22,10 +23,11 @@ class PaymentMethodAddForm extends BasePaymentMethodAddForm {
$element['#attributes']['class'][] = 'omise-form';
// Set our key to settings array.
/** @var \Drupal\commerce_omise\Plugin\Commerce\PaymentGateway\OmiseInterface $plugin */
$plugin = $this->plugin;
if (!($this->plugin instanceof OmiseInterface)) {
throw new \InvalidArgumentException('Omise payment method required.');
}
$element['#attached']['drupalSettings']['commerceOmise'] = [
'publicKey' => $plugin->getPublicKey(),
'publicKey' => $this->plugin->getPublicKey(),
];
// To display validation errors.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment