Skip to content

Commit

Permalink
Fixes jsonToArray() check
Browse files Browse the repository at this point in the history
Fixes EshopCommunity namespace issue
  • Loading branch information
mariolorenz committed Jan 17, 2025
1 parent cf39db1 commit e2f10b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/Controller/Admin/OrderArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\EshopCommunity\Core\Request;
use OxidSolutionCatalysts\AmazonPay\Core\Config;
use OxidSolutionCatalysts\AmazonPay\Core\Constants;
use OxidSolutionCatalysts\AmazonPay\Core\Logger;
Expand Down Expand Up @@ -40,10 +39,9 @@ private function refundAmazon()
if (!$config->automatedRefundActivated()) {
return;
}
$request = new Request();
// get article id
/** @var string $sOrderArtId */
$sOrderArtId = $request->getRequestParameter('sArtID') ?: '';
$sOrderArtId = Registry::getRequest()->getRequestParameter('sArtID') ?: '';
$sOrderId = $this->getEditObjectId() ?: '';

$oOrderArticle = oxNew(\OxidEsales\Eshop\Application\Model\OrderArticle::class);
Expand Down
12 changes: 10 additions & 2 deletions src/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ public function updateAmazonPayOrderStatus(string $amazonPayStatus, array $data
case "AMZ_AUTH_AND_CAPT_FAILED":
$remark = 'AmazonPay: ERROR';
if (!empty($data['result']['response'])) {
$response = PhpHelper::jsonToArray($data['result']['response']);
if (is_string($data['result']['response'])) {
$response = PhpHelper::jsonToArray($data['result']['response']);
} else {
$response = $data['result']['response'];
}
$remark .= ' (' . $response['reasonCode'] . ')';
}

Expand Down Expand Up @@ -191,7 +195,11 @@ public function updateAmazonPayOrderStatus(string $amazonPayStatus, array $data
case "AMZ_AUTH_OR_CAPT_DECLINED":
$remark = 'AmazonPay: Auth or Capture Declined';
if (!empty($data['result']['response'])) {
$response = PhpHelper::jsonToArray($data['result']['response']);
if (is_string($data['result']['response'])){
$response = PhpHelper::jsonToArray($data['result']['response']);
} else {
$response = $data['result']['response'];
}
$remark .= ' (' . $response['reasonCode'] . ')';
}
$this->setFieldData('oxtransstatus', 'NOT_FINISHED');
Expand Down

0 comments on commit e2f10b5

Please sign in to comment.