From 7c614722a458ada7ffe5c5c15c5b5fa98b391e80 Mon Sep 17 00:00:00 2001 From: taehyunlim Date: Mon, 25 Oct 2021 22:46:52 -0700 Subject: [PATCH] access store id from order when available --- Gateway/Http/TransferFactory.php | 3 ++- Gateway/Request/CaptureRequest.php | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gateway/Http/TransferFactory.php b/Gateway/Http/TransferFactory.php index fefd4c89..db345e19 100644 --- a/Gateway/Http/TransferFactory.php +++ b/Gateway/Http/TransferFactory.php @@ -35,7 +35,8 @@ class TransferFactory extends AbstractTransferFactory public function create(array $request) { $method = isset($request['method']) ? $request['method'] : ClientService::POST; - $storeId = $this->getStoreId(); + // Admin actions will include store id in the request + $storeId = isset($request['storeId']) ? $request['storeId'] : $this->getStoreId(); return $this->transferBuilder ->setMethod($method) ->setHeaders(['Content-Type' => 'application/json']) diff --git a/Gateway/Request/CaptureRequest.php b/Gateway/Request/CaptureRequest.php index 082e15b2..2990a187 100644 --- a/Gateway/Request/CaptureRequest.php +++ b/Gateway/Request/CaptureRequest.php @@ -46,9 +46,7 @@ public function build(array $buildSubject) $transactionId = $payment->getAdditionalInformation(self::TRANSACTION_ID) ?: $payment->getAdditionalInformation(self::CHARGE_ID); $order = $payment->getOrder(); - if($order) { - $storeId = $this->_storeManager->getStore()->getId(); - } + $storeId = isset($order) ? $order->getStoreId() : $this->_storeManager->getStore()->getId(); if (!$storeId) { $storeId = null; }