Worldpay / Worldpay-Magento2-CG

Worldpay Magento 2 Plugin for Worldpay Corporate Gateway
Other
17 stars 35 forks source link

Worldpay Plugin is not available - missing store scope #105

Closed obsergiu closed 1 year ago

obsergiu commented 1 year ago

issue: Store Scope not Passed in Worldpay Module's Capture and Refund Functions module version tested in: "version": "2.4.5-rc1122"

During the migration process, 70% of our stores are currently disabled. To simplify the process, we would like to have the Worldpay module disabled on the "Default" level and enabled on the website level.

However, we have discovered that the store scope is not being passed in the capture and refund functions located in:

Sapient\Worldpay\Model\PaymentMethods\AbstractMethod

The code line: vendor/sapient/module-worldpay/Model/PaymentMethods/AbstractMethod.php:492 and vendor/sapient/module-worldpay/Model/PaymentMethods/AbstractMethod.php:566

elavarasann commented 1 year ago

Hi, I checked the code and found that we are getting configuration values based on store view. We are fetching all store configuration values from store view only not from main website level. Please refer the below screenshot. File Path: app\code\Sapient\Worldpay\Helper\Data.php

image-2023-01-27-12-56-40-766

obsergiu commented 1 year ago

I'm not good with M2, so I apologise if I'm missing something, but from the line, you pointed out, shouldn't we pass there the  $scopeCode?

public function isWorldPayEnable()
    {
        return (bool) $this->_scopeConfig->getValue(
            'worldpay/general_config/enable_worldpay',
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE 
             // it's missing the $scopeCode here, or I'm missing something?
        );
    }

Normally I would expect this function to look like this:


    /**
     * Is WorldPay Enabled or not
     *
     * @return bool
     */
    public function isWorldPayEnable($storeId = null)
    {
        return (bool) $this->_scopeConfig->getValue(
            'worldpay/general_config/enable_worldpay',
            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
             $storeId
        );
    }```