Skip to content

Commit

Permalink
PHP7.3 functions are deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozgen Cetinkaya committed Oct 28, 2024
1 parent 77f403a commit f315383
Show file tree
Hide file tree
Showing 118 changed files with 738 additions and 587 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ execute below command in your magento installation directory
`composer require amazonpaymentservices/module-fort`

## Configuration and User Guide
You can download the archive [file](/magento2-aps-2.6.2.zip) of the plugin and install it to Magento. Detailed guide is included in the repository [here](/Magento%20Extension%20User%20Guide_v1.1.pdf).
You can download the archive [file](/magento2-aps-2.6.3.zip) of the plugin and install it to Magento. Detailed guide is included in the repository [here](/Magento%20Extension%20User%20Guide_v1.1.pdf).


## Payment Options
Expand Down Expand Up @@ -45,6 +45,7 @@ You can download the archive [file](/magento2-aps-2.6.2.zip) of the plugin and i

| Plugin Version | Release Notes |
| :---: | :--- |
| 2.6.3 | * Fix - PHP7.3 functions are deprecated. PHP8.2 support is introduced. |
| 2.6.2 | * Fix - Additional columns are moved out from sales order to individual table <br/> * New - Configuration is added for order deletion when transactions are failed. <br/> * Fix - Refund amounts are not calculated, taken from Magento default function |
| 2.6.1 | * Fix - Webhook, Check status common internal function to cancel failed orders are updated with order getState method |
| 2.6.0 | * New - Benefit and OmanNet are added as a new payment options |
Expand Down
Binary file removed magento2-aps-2.6.2.zip
Binary file not shown.
Binary file added magento2-aps-2.6.3.zip
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Cron Command
* php version 7.3.*
* php version 8.2.*
*
* @category Amazonpaymentservices
* @package Amazonpaymentservices_Fort
Expand All @@ -15,7 +15,7 @@

/**
* Cron Command
* php version 7.3.*
* php version 8.2.*
*
* @author Amazonpaymentservices <[email protected]>
* @license GNU / GPL v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Host To Host Url
* php version 7.3.*
* php version 8.2.*
*
* @category Amazonpaymentservices
* @package Amazonpaymentservices_Fort
Expand All @@ -15,7 +15,7 @@

/**
* Host To Host Url
* php version 7.3.*
* php version 8.2.*
*
* @author Amazonpaymentservices <[email protected]>
* @license GNU / GPL v3
Expand Down
15 changes: 11 additions & 4 deletions magento2-aps/Amazonpaymentservices/Fort/Block/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@

use Magento\Catalog\Block\ShortcutInterface;
use Magento\Checkout\Model\Session;
use Magento\Directory\Model\Country;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Framework\Registry;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Magento\Payment\Model\MethodInterface;
use Amazonpaymentservices\Fort\Helper\Data as apsHelper;
use Amazonpaymentservices\Fort\Helper\Aps as aps;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
* Class Button
Expand Down Expand Up @@ -88,6 +91,12 @@ class Button extends Template implements ShortcutInterface
* @param ResolverInterface $localeResolver
* @param Session $checkoutSession
* @param MethodInterface $payment
* @param apsHelper $apsHelper
* @param aps $aps
* @param StoreManagerInterface $storeManager
* @param ScopeConfigInterface $scopeConfig
* @param Registry $frameworkRegistry
* @param Country $countryFactory
* @param array $data
*/
public function __construct(
Expand Down Expand Up @@ -207,11 +216,10 @@ public function getStoreName()

public function getCountryCode()
{
$country = $this->_scopeConfig->getValue(
return $this->_scopeConfig->getValue(
self::COUNTRY_CODE_PATH,
ScopeInterface::SCOPE_WEBSITES
);
return $country;
}

public function getAppleCancelUrl()
Expand All @@ -221,8 +229,7 @@ public function getAppleCancelUrl()

public function getCurrentProduct()
{
$product = $this->_frameworkRegistry->registry('current_product');
return $product;
return $this->_frameworkRegistry->registry('current_product');
}

public function getCurrenctCurrencyCode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ public function getExpDate()
*/
public function getIconUrl()
{
$type = $this->getTokenDetails()['type'];

return $type;
return $this->getTokenDetails()['type'];
}

/**
Expand Down
13 changes: 6 additions & 7 deletions magento2-aps/Amazonpaymentservices/Fort/Block/Info.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Before Order Place Observer
* php version 7.3.*
* php version 8.2.*
*
* @category Amazonpaymentservices
* @package Amazonpaymentservices_Fort
Expand All @@ -18,7 +18,7 @@

/**
* Block Info
* php version 7.3.*
* php version 8.2.*
*
* @author Amazonpaymentservices <[email protected]>
* @license GNU / GPL v3
Expand Down Expand Up @@ -46,10 +46,9 @@ protected function getLabel($field)
*/
protected function getValueView($field, $value)
{
switch ($field) {
case FraudHandler::FRAUD_MSG_LIST:
return implode('; ', $value);
}
return parent::getValueView($field, $value);
return match ($field) {
FraudHandler::FRAUD_MSG_LIST => implode('; ', $value),
default => parent::getValueView($field, $value),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Amazonpaymentservices\Fort\Block\Subscription;

use \Magento\Framework\App\ObjectManager;
use Magento\Framework\App\ObjectManager;

class CheckoutAdditionalInfo extends \Magento\Framework\View\Element\Template
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
namespace Amazonpaymentservices\Fort\Block\Subscription;

use \Magento\Framework\App\ObjectManager;
use \Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Sales\Model\ResourceModel\Order\CollectionFactoryInterface;

class SubscriptionList extends \Magento\Framework\View\Element\Template
{
Expand All @@ -13,6 +13,7 @@ class SubscriptionList extends \Magento\Framework\View\Element\Template
private $orderCollectionFactory;
protected $_helper;
protected $_countryFactory;
protected $order;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
Expand Down Expand Up @@ -87,9 +88,7 @@ public function getSubscriptionOrderDetail($orderIncrementId)
}

$query = $connection->select()->from(['table'=>'aps_subscriptions'])->where('table.id IN(?)', $subOrderIds);
$subscriptionOrder = $this->_helper->fetchAllQuery($query);

return $subscriptionOrder;
return $this->_helper->fetchAllQuery($query);
}

public function getRelatedOrders($orderIncrementId)
Expand All @@ -100,15 +99,13 @@ public function getRelatedOrders($orderIncrementId)
$subOrderDetail = $this->_helper->fetchAllQuery($query);

if (!empty($subOrderDetail)) {
$parentID = [];
$parentIds = [];
foreach ($subOrderDetail as $subOrder) {
$parentIds[] = $subOrder['aps_subscription_id'];
}

$query = $connection->select()->from(['table'=>'aps_subscription_orders'])->where('table.aps_subscription_id IN(?)', $parentIds)->order(['table.created_at DESC']);
$subOrderDetails = $this->_helper->fetchAllQuery($query);

return $subOrderDetails;
return $this->_helper->fetchAllQuery($query);
} else {
return [];
}
Expand All @@ -117,89 +114,56 @@ public function getRelatedOrders($orderIncrementId)
public function getSubscriptionItemDetail($subOrderId)
{
$connection = $this->getConnection();
$subscriptionOrder = null;

$query = $connection->select()->from(['table'=>'aps_subscriptions'])->where('table.id=?', $subOrderId);
$subscriptionOrder = $this->_helper->fetchAllQuery($query);

return $subscriptionOrder;
return $this->_helper->fetchAllQuery($query);
}

public function getRelatedItems($subOrderId)
{
$connection = $this->getConnection();
$subOrderDetails = null;

$query = $connection->select()->from(['table'=>'aps_subscription_orders'])->where('table.aps_subscription_id=?', $subOrderId)->order(['table.created_at DESC']);
$subOrderDetails = $this->_helper->fetchAllQuery($query);

return $subOrderDetails;
return $this->_helper->fetchAllQuery($query);
}

public function getOrder($orderId)
{
$order = ObjectManager::getInstance()->get('Magento\Sales\Api\Data\OrderInterface');
$this->order = $order;
$order = $this->order->load($orderId); // pass your order id here
return $order;
return $this->order->load($orderId);
}

public function getBillingAddress($orderId)
{
$order = $this->getOrder($orderId);
$billingAddress = $order->getBillingAddress()->getData();
return $billingAddress;
return $order->getBillingAddress()->getData();
}

public function getShippingAddress($orderId)
{
$order = $this->getOrder($orderId);
$shippingAddress = $order->getShippingAddress()->getData();
return $shippingAddress;
return $order->getShippingAddress()->getData();
}

public function getPaymentMethod($orderId)
{
$order = $this->getOrder($orderId);
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
$methodTitle = $method->getTitle();
return $methodTitle;
return $method->getTitle();
}

public function fetchAllQuery($query)
{
$queryResponse = $this->_helper->fetchAllQuery($query);
return $queryResponse;
return $this->_helper->fetchAllQuery($query);
}

public function fetchGetParams()
{
$urlParams = $this->getRequest()->getParams();
return $urlParams;
return $this->getRequest()->getParams();
}

// protected function _prepareLayout()
// {
// parent::_prepareLayout();
// if ($this->getOrders()) {
// $pager = $this->getLayout()->createBlock(
// \Magento\Theme\Block\Html\Pager::class,
// 'sales.order.history.pager'
// )->setCollection(
// $this->getOrders()
// );
// $this->setChild('pager', $pager);
// $this->getOrders()->load();
// }
// return $this;
// }

// public function getPagerHtml()
// {
// return $this->getChildHtml('pager');
// }

public function getViewUrl($orderId)
{
return $this->getUrl('apsfort/subscription/view', ['order_id' => $orderId]);
Expand Down
12 changes: 4 additions & 8 deletions magento2-aps/Amazonpaymentservices/Fort/Block/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,21 @@ public function getKnetParmeters()
{
$payment = $this->order->getPayment();
$data = $payment->getAdditionalData();
$knetData = json_decode($data, true);
return $knetData;
return json_decode($data, true);
}

public function getValuParmeters()
{
$payment = $this->order->getPayment();
$data = $payment->getAdditionalData();
$valuData = json_decode($data, true);
return $valuData;
return json_decode($data, true);
}

public function getOmanNetParmeters()
{
$payment = $this->order->getPayment();
$data = $payment->getAdditionalData();
$OmanNetData = json_decode($data, true);
return $OmanNetData;
return json_decode($data, true);
}

public function getOrderNumber()
Expand All @@ -98,8 +95,7 @@ public function getBenefitParmeters()
{
$payment = $this->order->getPayment();
$data = $payment->getAdditionalData();
$benefitData = json_decode($data, true);
return $benefitData;
return json_decode($data, true);
}
public function getCacheLifetime()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Amazonpaymentservices\Fort\Controller\Adminhtml\Payment;

use Amazonpaymentservices\Fort\Model\PaymentcaptureFactory;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
Expand All @@ -16,11 +17,12 @@ class Capture extends Action
* @var Data
*/
protected $helper;

/**
* @param Context $context
* @param JsonFactory $resultJsonFactory
* @param Data $helper
* @param PaymentcaptureFactory $paymentCaptureFactory
*/
public function __construct(
Context $context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Subscription extends \Magento\Backend\App\Action

/**
* @param Context $context
* @param Data $helper
* @param ResourceConnection $connect
* @param \Amazonpaymentservices\Fort\Helper\Data $helper
* @param \Magento\Framework\App\ResourceConnection $connect
*/
public function __construct(
Context $context,
Expand Down
Loading

0 comments on commit f315383

Please sign in to comment.