Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order_action_failed_payment is Null if config is default #532

Open
kpitn opened this issue Sep 25, 2023 · 0 comments
Open

order_action_failed_payment is Null if config is default #532

kpitn opened this issue Sep 25, 2023 · 0 comments

Comments

@kpitn
Copy link

kpitn commented Sep 25, 2023

Hi,

I Controller/Payment/Fail.php File you are using :

$action = $this->config->getValue('order_action_failed_payment', null, $storeCode);

    public function getValue(
        string $field,
        string $methodId = null,
        $storeCode = null,
        string $scope = ScopeInterface::SCOPE_WEBSITE
    ) {
        return $this->loader->getValue($field, $methodId, $storeCode, $scope);
    }

The module is config in defaut vue :

+---------+-------+--------+--------------------------------------------------------------+------+-------------------+
|config_id|scope  |scope_id|path                                                          |value |updated_at         |
+---------+-------+--------+--------------------------------------------------------------+------+-------------------+
|1429     |default|0       |settings/checkoutcom_configuration/order_action_failed_payment|cancel|2022-08-11 08:58:17|
+---------+-------+--------+--------------------------------------------------------------+------+-------------------+

$action is always NULL.

The solution is to use store scope instead of website scope.

Another patch for the module :

--- Controller/Payment/Fail.php
+++ Controller/Payment/Fail.php
@@ -179,7 +179,7 @@
                     ]);
 
                     $storeCode = $this->storeManager->getStore()->getCode();
-                    $action    = $this->config->getValue('order_action_failed_payment', null, $storeCode);
+                    $action    = $this->config->getValue('order_action_failed_payment', null, $storeCode, ScopeInterface::SCOPE_STORE);
                     $status    = $action === 'cancel' ? 'canceled' : 'false';
 
                     // Log the payment error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant