Skip to content

Commit

Permalink
BP-1488 - have one single config that set the client mode to test or …
Browse files Browse the repository at this point in the history
…production
  • Loading branch information
LucianTuriacArnia committed Oct 10, 2023
1 parent b10a79e commit 365bae4
Show file tree
Hide file tree
Showing 37 changed files with 133 additions and 36 deletions.
97 changes: 97 additions & 0 deletions Setup/Patch/Data/UpdateBuckarooAccountConfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please email
* to [email protected], so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact [email protected] for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/
declare(strict_types=1);

namespace Buckaroo\Magento2\Setup\Patch\Data;

use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

class UpdateBuckarooAccountConfig implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private ModuleDataSetupInterface $moduleDataSetup;

/**
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {
$this->moduleDataSetup = $moduleDataSetup;
}

/**
* {@inheritdoc}
*/
public function apply(): void
{
$this->moduleDataSetup->startSetup();

$connection = $this->moduleDataSetup->getConnection();

$path = 'buckaroo_magento2/account/active';
$valueToUpdate = '2';

$select = $connection->select()
->from($this->moduleDataSetup->getTable('core_config_data'))
->where('path = ?', $path);

$data = $connection->fetchRow($select);

if ($data) {
$connection->update(
$this->moduleDataSetup->getTable('core_config_data'),
['value' => $valueToUpdate],
['path = ?' => $path]
);
} else {
$connection->insert(
$this->moduleDataSetup->getTable('core_config_data'),
[
'scope' => 'default',
'scope_id' => 0,
'path' => $path,
'value' => $valueToUpdate
]
);
}

$this->moduleDataSetup->endSetup();
}

/**
* {@inheritdoc}
*/
public static function getDependencies(): array
{
return [];
}

/**
* {@inheritdoc}
*/
public function getAliases(): array
{
return [];
}
}
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/afterpay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Riverty | Afterpay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_afterpay/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/afterpay2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Riverty | Afterpay 2</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_afterpay2/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/afterpay20.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Riverty | Afterpay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_afterpay20/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/alipay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Alipay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_alipay/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/applepay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Apple Pay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_applepay/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/belfius.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Belfius</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_belfius/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/billink.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Billink</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_billink/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/capayable_in3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable In3</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_capayablein3/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/capayable_postpay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Capayable Postpay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_capayablepostpay/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/creditcard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable credit and debit cards</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_creditcard/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/creditcards.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment tooltip" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable credit and debit cards (Client sided)</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_creditcards/active</config_path>
<tooltip>
<![CDATA[Check with Buckaroo whether Client Side Encryption is enabled, otherwise transactions will fail. If in doubt, please contact us.]]>
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/creditclick.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable CreditClick</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_creditclick/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/eps.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable EPS</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_eps/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/giftcards.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Giftcards</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_giftcards/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/giropay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Giropay</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_giropay/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/ideal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable iDEAL</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_ideal/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/idealprocessing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable iDEAL Processing</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_idealprocessing/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/kbc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable KBC</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_kbc/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/klarna.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Klarna</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_klarna/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/klarnain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Klarna</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_klarnain/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/klarnakp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Klarna</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_klarnakp/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/mrcash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Bancontact / Mister Cash</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_mrcash/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/p24.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Przelewy24</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_p24/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/paybybank.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable PayByBank</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_paybybank/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/payconiq.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Payconiq</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_payconiq/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/paylink.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable PayLink</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_paylink/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/paypal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Paypal</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_paypal/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/payperemail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable PayPerEmail</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_payperemail/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/pospayment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable Point of Sale</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_pospayment/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/sepa_direct_debit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable SEPA direct debit</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_sepadirectdebit/active</config_path>
</field>

Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/system/payment_methods/sofort_banking.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<field id="active" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Enable SOFORT</label>
<comment><![CDATA[Enable or disable this payment method.]]></comment>
<source_model>Buckaroo\Magento2\Model\Config\Source\Enablemode</source_model>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/buckaroo_magento2_sofortbanking/active</config_path>
</field>

Expand Down
Loading

0 comments on commit 365bae4

Please sign in to comment.