Skip to content

Commit

Permalink
Merge pull request #52 from genecommerce/hotfix/lpm-configuration
Browse files Browse the repository at this point in the history
LPM allowed methods hotfix
  • Loading branch information
Paul Canning authored Nov 27, 2019
2 parents 83aefc5 + 1241600 commit 73f3c20
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
22 changes: 22 additions & 0 deletions Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
if (version_compare($context->getVersion(), '2.0.1', '<')) {
$this->convertSerializedDataToJson($setup);
}

// Hotfix to remove incorrectly stored LPM config key/values
if (version_compare($context->getVersion(), '4.0.1', '<')) {
$this->removeNullLpmAllowedMethods($setup);
}
}

/**
Expand Down Expand Up @@ -90,4 +95,21 @@ private function convertSerializedDataToJson(ModuleDataSetupInterface $setup)
$queryModifier
);
}

/**
* Hotfix to remove incorrectly stored config value for `payment/braintree_local_paymnet/allowed_methods`
*
* @param ModuleDataSetupInterface $setup
*/
private function removeNullLpmAllowedMethods(ModuleDataSetupInterface $setup)
{
$connection = $setup->getConnection();
$connection->delete(
$setup->getTable('core_config_data'),
[
'`path`=?' => 'payment/braintree_local_payment/allowed_methods',
'`value` IS NULL'
]
);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gene/module-braintree",
"description": "Fork from the Magento Braintree 2.2.0 module by Gene Commerce for PayPal.",
"version": "4.0.0",
"version": "4.0.1",
"type": "magento2-module",
"license": "proprietary",
"require": {
Expand Down
3 changes: 2 additions & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
<field id="title" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1">
<label>Title</label>
<config_path>payment/braintree_local_payment/title</config_path>
<validate>required-entry</validate>
<depends>
<field id="active">1</field>
</depends>
Expand All @@ -330,8 +331,8 @@
valid for that method, regardless of the method being enabled here.
</comment>
<source_model>Magento\Braintree\Model\Adminhtml\Source\LpmMethods</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/braintree_local_payment/allowed_methods</config_path>
<validate>required-entry</validate>
<depends>
<field id="active">1</field>
</depends>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Braintree" setup_version="4.0.0">
<module name="Magento_Braintree" setup_version="4.0.1">
<sequence>
<module name="Magento_Customer"/>
<module name="Magento_Config"/>
Expand Down

0 comments on commit 73f3c20

Please sign in to comment.