function commerce_braintree_update_8001 in Commerce Braintree 8
Add 3d_secure setting to gateway configuration.
File
- ./
commerce_braintree.install, line 28 - Contains install and update functions for Commerce Braintree.
Code
function commerce_braintree_update_8001() {
$gateway_storage = \Drupal::entityTypeManager()
->getStorage('commerce_payment_gateway');
/** @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface[] $gateways */
$gateways = $gateway_storage
->loadByProperties([
'plugin' => 'braintree_hostedfields',
]);
foreach ($gateways as $gateway) {
$configuration = $gateway
->getPlugin()
->getConfiguration();
$configuration['3d_secure'] = '';
$gateway
->getPlugin()
->setConfiguration($configuration);
$gateway
->save();
}
}