Skip to content

Commit

Permalink
Add plugin version to additionalDescription, payu rules default checked
Browse files Browse the repository at this point in the history
  • Loading branch information
regdos committed Nov 28, 2017
1 parent 5b023fb commit 6ecbfee
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/code/PayU/PaymentGateway/Api/PayUConfigInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,12 @@ public function getPaymentMethodsOrder();
* @return bool
*/
public function isCrediCardCurrencyRates();

/**
* Get plugin version
*
* @return string
*/
public function getPluginVersion();

}
10 changes: 9 additions & 1 deletion app/code/PayU/PaymentGateway/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Config implements PayUConfigInterface
/**
* Current Plugin Version
*/
const PLUGIN_VERSION = '1.0';
const PLUGIN_VERSION = '1.0.1';

/**
* @var \OpenPayU_Configuration
Expand Down Expand Up @@ -184,6 +184,14 @@ public function isCrediCardCurrencyRates()
return (bool)$this->gatewayConfig->getValue('currency_rates', $this->storeId);
}

/**
* {@inheritdoc}
*/
public function getPluginVersion()
{
return static::PLUGIN_VERSION;
}

/**
* Check if selected pay method is enable
*
Expand Down
22 changes: 21 additions & 1 deletion app/code/PayU/PaymentGateway/Model/CreateOrderResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace PayU\PaymentGateway\Model;

use Magento\Framework\App\ProductMetadataInterface;
use Magento\Framework\UrlInterface;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Payment\Gateway\Data\OrderAdapterInterface;
Expand Down Expand Up @@ -52,6 +53,11 @@ class CreateOrderResolver implements CreateOrderResolverInterface
*/
private $order;

/**
* @var ProductMetadataInterface
*/
private $metadata;

/**
* @var PayUGetMultiCurrencyPricingInterface
*/
Expand Down Expand Up @@ -84,6 +90,7 @@ class CreateOrderResolver implements CreateOrderResolverInterface
* @param PayUMcpExchangeRateResolverInterface $exchangeRateResolver
* @param PayUConfigInterface $payUConfig
* @param StoreManagerInterface $storeManager
* @param ProductMetadataInterface $metadata
*/
public function __construct(
UrlInterface $urlBuilder,
Expand All @@ -94,7 +101,8 @@ public function __construct(
PayUGetMultiCurrencyPricingInterface $currencyPricing,
PayUMcpExchangeRateResolverInterface $exchangeRateResolver,
PayUConfigInterface $payUConfig,
StoreManagerInterface $storeManager
StoreManagerInterface $storeManager,
ProductMetadataInterface $metadata
) {
$this->urlBuilder = $urlBuilder;
$this->availableLocale = $availableLocale;
Expand All @@ -105,6 +113,7 @@ public function __construct(
$this->exchangeRateResolver = $exchangeRateResolver;
$this->payUConfig = $payUConfig;
$this->store = $storeManager->getStore();
$this->metadata = $metadata;
}

/**
Expand All @@ -122,6 +131,7 @@ public function resolve(
$paymentData = [
'txn_type' => 'A',
'description' => $this->getOrderDescription(),
'additionalDescription' => $this->getAdditionalDescription(),
'customerIp' => $this->order->getRemoteIp(),
'extOrderId' => $this->getExtOrderId(),
'totalAmount' => $this->getFormatAmount($this->order->getGrandTotalAmount()),
Expand Down Expand Up @@ -156,6 +166,16 @@ private function getOrderDescription()
return __('Order %1 from store %2', $this->order->getOrderIncrementId(), $this->urlBuilder->getBaseUrl());
}

/**
* Get additional description for order
*
* @return string
*/
private function getAdditionalDescription()
{
return 'Magento 2 ver ' . $this->metadata->getVersion() . ' / Plugin ver ' . $this->payUConfig->getPluginVersion();
}

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ define(
locale: window.checkoutConfig.payment.payuGateway.locale,
methods: toArray(JSON.parse(window.checkoutConfig.payment.payuGateway.payByLinks)),
payuMethod: ko.observable(false),
payuAgreement: ko.observable(false),
payuAgreement: ko.observable(true),
agreementText: $t('You must accept the "Terms of a single PayU payment transaction"'),
enabledStatus: 'ENABLED'
},
Expand Down

0 comments on commit 6ecbfee

Please sign in to comment.