diff --git a/app/code/Riskified/Decider/Api/Api.php b/app/code/Riskified/Decider/Api/Api.php index 0fd0f55..82254b7 100644 --- a/app/code/Riskified/Decider/Api/Api.php +++ b/app/code/Riskified/Decider/Api/Api.php @@ -28,12 +28,13 @@ public function __construct(Config $apiConfig) public function initSdk($order = null) { + $storeId = (!is_null($order)) ? $order->getStore() : null; + $this->_apiConfig->setStore($storeId); + $authToken = $this->_apiConfig->getAuthToken(); $env = constant($this->_apiConfig->getConfigEnv()); $shopDomain = $this->_apiConfig->getShopDomain(); $this->version = $this->_apiConfig->getExtensionVersion(); - $storeId = (!is_null($order)) ? $order->getStore() : null; - $this->_apiConfig->setStore($storeId); Riskified::init($shopDomain, $authToken, $env, Validations::SKIP); } diff --git a/app/code/Riskified/Decider/Api/Config.php b/app/code/Riskified/Decider/Api/Config.php index 4984a81..187a895 100644 --- a/app/code/Riskified/Decider/Api/Config.php +++ b/app/code/Riskified/Decider/Api/Config.php @@ -1,6 +1,7 @@ _scopeConfig->getValue( 'riskified/riskified/key', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -52,6 +54,7 @@ public function getConfigStatusControlActive() { return $this->_scopeConfig->getValue( 'riskified/riskified/order_status_sync', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -60,6 +63,7 @@ public function getConfigEnv() { return '\Riskified\Common\Env::' . $this->_scopeConfig->getValue( 'riskified/riskified/env', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -73,6 +77,7 @@ public function getConfigEnableAutoInvoice() { return $this->_scopeConfig->getValue( 'riskified/riskified/auto_invoice_enabled', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -81,6 +86,7 @@ public function getConfigAutoInvoiceCaptureCase() { return $this->_scopeConfig->getValue( 'riskified/riskified/auto_invoice_capture_case', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -94,6 +100,7 @@ public function getShopDomain() { return $this->_scopeConfig->getValue( 'riskified/riskified/domain', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -108,6 +115,7 @@ public function getDeclinedState() { return $this->_scopeConfig->getValue( 'riskified/riskified/declined_state', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -117,6 +125,7 @@ public function getDeclinedStatus() $state = $this->getDeclinedState(); return $this->_scopeConfig->getValue( 'riskified/riskified/declined_status_' . $state, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -125,6 +134,7 @@ public function getApprovedState() { return $this->_scopeConfig->getValue( 'riskified/riskified/approved_state', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -134,6 +144,7 @@ public function getApprovedStatus() $state = $this->getApprovedState(); return $this->_scopeConfig->getValue( 'riskified/riskified/approved_status_' . $state, + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -142,6 +153,7 @@ public function isLoggingEnabled() { return (bool)$this->_scopeConfig->getValue( 'riskified/riskified/debug_logs', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -150,6 +162,7 @@ public function isAutoInvoiceEnabled() { return (bool)$this->_scopeConfig->getValue( 'riskified/riskified/auto_invoice_enabled', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -158,6 +171,7 @@ public function getInvoiceCaptureCase() { $captureCase = $this->_scopeConfig->getValue( 'riskified/riskified/auto_invoice_capture_case', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); @@ -177,6 +191,7 @@ public function getCaptureCase() { $captureCase = $this->_scopeConfig->getValue( 'riskified/riskified/auto_invoice_capture_case', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); @@ -209,6 +224,7 @@ public function getDeclineNotificationSender() { return $this->_scopeConfig->getValue( 'riskified/decline_notification/email_identity', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -217,6 +233,7 @@ public function getDeclineNotificationSenderEmail() { return $this->_scopeConfig->getValue( 'trans_email/ident_' . $this->getDeclineNotificationSender() . '/email', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -225,6 +242,7 @@ public function getDeclineNotificationSenderName() { return $this->_scopeConfig->getValue( 'trans_email/ident_' . $this->getDeclineNotificationSender() . '/name', + ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->getStore() ); } @@ -272,6 +290,6 @@ public function setStore($id) */ public function getStore() { - return (!is_null($this->store)) ? $this->store : ScopeInterface::SCOPE_STORES; + return (!is_null($this->store)) ? $this->store : null; } -} \ No newline at end of file +}