-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pt 564 magento 2 webhooks 400 response (#92)
- Loading branch information
Showing
8 changed files
with
75 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
namespace Mondu\Mondu\Setup\Patch\Data; | ||
|
||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
|
||
class WebhookSecretPatch implements DataPatchInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
public function __construct( | ||
ModuleDataSetupInterface $moduleDataSetup | ||
) { | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
$this->moduleDataSetup->getConnection()->startSetup(); | ||
|
||
$liveWebhookSecret = $this->moduleDataSetup->getConnection()->fetchOne('SELECT `value` FROM core_config_data WHERE path = "payment/mondu/live_webhook_secret"'); | ||
$sandboxWebhookSecret = $this->moduleDataSetup->getConnection()->fetchOne('SELECT `value` FROM core_config_data WHERE path = "payment/mondu/sandbox_webhook_secret"'); | ||
|
||
$this->moduleDataSetup->getConnection()->delete('core_config_data', ['path = "payment/mondu/sandbox_webhook_secret"']); | ||
$this->moduleDataSetup->getConnection()->delete('core_config_data', ['path = "payment/mondu/live_webhook_secret"']); | ||
|
||
$this->moduleDataSetup->getConnection()->insert('core_config_data', [ | ||
'scope' => 'default', | ||
'scope_id' => 0, | ||
'path' => 'payment/mondu/sandbox_webhook_secret', | ||
'value' => $sandboxWebhookSecret, | ||
]); | ||
|
||
$this->moduleDataSetup->getConnection()->insert('core_config_data', [ | ||
'scope' => 'default', | ||
'scope_id' => 0, | ||
'path' => 'payment/mondu/live_webhook_secret', | ||
'value' => $liveWebhookSecret, | ||
]); | ||
|
||
$this->moduleDataSetup->getConnection()->endSetup(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters