Skip to content

Commit

Permalink
fixed - marketplace-eqp
Browse files Browse the repository at this point in the history
  • Loading branch information
duongdiep212 committed Dec 20, 2018
1 parent 9faf61c commit 5111a62
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 62 deletions.
3 changes: 1 addition & 2 deletions Block/Payment/Method/Cash.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ public function getMethodTitle()
}
return $title;
}

}
}
4 changes: 1 addition & 3 deletions Block/Payment/Method/Cod.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,4 @@ public function getMethodTitle()
}
return $title;
}


}
}
3 changes: 1 addition & 2 deletions Block/Payment/Method/CreditCard/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ public function getMethodTitle()
{
return $this->getCreditCardMethodTitle();
}

}
}
8 changes: 3 additions & 5 deletions Block/Payment/Method/CreditCard/CustomPayment1.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
*/
namespace Magestore\Payment\Block\Payment\Method\CreditCard;


/**
* class \Magestore\Payment\Block\Payment\Method\Cc\Info\Cp1
*
*
* CP1 for POS info block
* Methods:
* _construct
* _prepareSpecificInformation
* getMethodTitle
*
*
* @category Magestore
* @package Magestore\Payment\Block\Payment\Method\Cc\Info
* @module Webpos
Expand All @@ -30,5 +29,4 @@ public function getMethodTitle()
{
return $this->getCustomPayment1MethodTitle();
}

}
}
8 changes: 3 additions & 5 deletions Block/Payment/Method/CreditCard/CustomPayment2.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
*/
namespace Magestore\Payment\Block\Payment\Method\CreditCard;


/**
* class \Magestore\Payment\Block\Payment\Method\Cc\Info\Cp2
*
*
* CP2 for POS info block
* Methods:
* _construct
* _prepareSpecificInformation
* getMethodTitle
*
*
* @category Magestore
* @package Magestore\Payment\Block\Payment\Method\Cc\Info
* @module Webpos
Expand All @@ -30,5 +29,4 @@ public function getMethodTitle()
{
return $this->getCustomPayment2MethodTitle();
}

}
}
32 changes: 15 additions & 17 deletions Block/Payment/Method/MultiPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,34 @@ public function getMethodTitle()
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getSpecificInformation(){
public function getSpecificInformation()
{
$specificInformation = [];
$actualTotalPaid = 0;
foreach ($this->getOrderPaymentMethods() as $paymentMethod){
foreach ($this->getOrderPaymentMethods() as $paymentMethod) {
$actualTotalPaid += $paymentMethod->getData('base_amount_paid');
$specificInformation[] = array(
$specificInformation[] = [
'label' => $paymentMethod->getData('title'),
'value' => $this->_helperPricing->currency($paymentMethod->getData('base_amount_paid'), true, false),
'reference_number' => $paymentMethod->getData('reference_number'),
'card_type' => $paymentMethod->getData('card_type')
);
];
}
$orderId = $this->getInfo()->getData('parent_id');
$baseTotalPaid = 0;
if($this->_coreRegistry->registry('current_order')){
if ($this->_coreRegistry->registry('current_order')) {
$baseTotalPaid = $this->_coreRegistry->registry('current_order')->getBaseTotalPaid();
}else{
try{
} else {
try {
$baseTotalPaid = $this->_orderRepository->get($orderId)->getBaseTotalPaid();
}catch (\Exception $e){

} catch (\Exception $e) {
}
}
if($baseTotalPaid !== 0){
if($actualTotalPaid < $baseTotalPaid){
array_push($specificInformation,[
if ($baseTotalPaid !== 0) {
if ($actualTotalPaid < $baseTotalPaid) {
array_push($specificInformation, [
'label' => __('Other'),
'value' => $this->_helperPricing->currency($baseTotalPaid - $actualTotalPaid , true, false),
'value' => $this->_helperPricing->currency($baseTotalPaid - $actualTotalPaid, true, false),
]);
}
}
Expand All @@ -136,9 +136,7 @@ public function getOrderPaymentMethods()
$orderId = $this->getInfo()->getData('parent_id');
$payments = $this->orderPaymentCollectionFactory->create()
->addFieldToFilter('order_id', $orderId)
->addFieldToFilter('type', \Magestore\Webpos\Api\Data\Payment\PaymentInterface::ORDER_TYPE)
;
->addFieldToFilter('type', \Magestore\Webpos\Api\Data\Payment\PaymentInterface::ORDER_TYPE);
return $payments;
}

}
}
7 changes: 3 additions & 4 deletions Block/Payment/Method/ReferencePaymentAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function _prepareSpecificInformation($transport = null)
if (null !== $this->_paymentSpecificInformation) {
return $this->_paymentSpecificInformation;
}
$data = array();
$data = [];
$orderId = $this->getInfo()->getData('parent_id');
$code = $this->getInfo()->getData('method');
$amount = $this->getPaymentAmount($orderId, $code);
Expand All @@ -79,10 +79,9 @@ public function getPaymentAmount($orderId, $code)
{
$payments = $this->orderPaymentCollection
->addFieldToFilter('order_id', $orderId)
->addFieldToFilter('method', $code)
;
->addFieldToFilter('method', $code);
$amount = 0;
if($payments->getSize() > 0){
if ($payments->getSize() > 0) {
$payment = $payments->getFirstItem();
$amount = $payment->getRealAmount();
}
Expand Down
8 changes: 4 additions & 4 deletions Model/Payment/AbstractMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
{
$routeName = $this->request->getRouteName();
$settingEnabled = $this->isEnabledSetting();
if ($routeName == "webpos"&& $settingEnabled == true){
if ($routeName == "webpos" && $settingEnabled == true) {
return true;
}else{
} else {
return false;
}
}
Expand All @@ -83,7 +83,8 @@ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
* @return bool
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function isEnabledSetting(){
public function isEnabledSetting()
{
return ($this->_scopeConfig->getValue($this->enabledPath, \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && $this->isAllowOnWebPOS($this->getCode()));
}

Expand All @@ -105,5 +106,4 @@ public function isAllowOnWebPOS($code)
}
return true;
}

}
4 changes: 2 additions & 2 deletions Model/Payment/Method/Cash.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

/**
* class \Magestore\Payment\Model\Payment\Method\Cash
*
*
* Web POS Cash payment method model
* Methods:
* isAvailable
*
*
* @category Magestore
* @package Magestore_Payment
* @module Payment
Expand Down
6 changes: 3 additions & 3 deletions Model/Payment/Method/Cod.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

/**
* class \Magestore\Payment\Model\Payment\Method\Cod
*
*
* Web POS Cash on delivery (Pay later) payment method model
* Methods:
* assignData
* isAvailable
*
*
* @category Magestore
* @package Magestore_Webpos
* @module Webpos
Expand All @@ -35,4 +35,4 @@ class Cod extends \Magestore\Payment\Model\Payment\AbstractMethod
* @var string
*/
protected $_formBlockType = 'Magestore\Payment\Block\Payment\Method\Cod';
}
}
6 changes: 3 additions & 3 deletions Model/Payment/Method/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

/**
* class \Magestore\Payment\Model\Payment\Method\CreditCard
*
*
* Web POS Credit Card payment method model
* Methods:
* assignData
* isAvailable
*
*
* @category Magestore
* @package Magestore_Webpos
* @module Webpos
Expand All @@ -36,4 +36,4 @@ class CreditCard extends \Magestore\Payment\Model\Payment\AbstractMethod
* @var string
*/
protected $_formBlockType = 'Magestore\Payment\Block\Payment\Method\CreditCard\CreditCard';
}
}
6 changes: 3 additions & 3 deletions Model/Payment/Method/MultiPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

/**
* class \Magestore\Payment\Model\Payment\Method\MultiPayment
*
*
* Web POS partial payment method model
* Methods:
* assignData
* isAvailable
*
*
* @category Magestore
* @package Magestore_Webpos
* @module Webpos
Expand All @@ -36,4 +36,4 @@ class MultiPayment extends \Magestore\Payment\Model\Payment\AbstractMethod
* @var string
*/
protected $_infoBlockType = 'Magestore\Payment\Block\Payment\Method\MultiPayment';
}
}
2 changes: 1 addition & 1 deletion registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Magestore_Payment',
__DIR__
);
);
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@
-->
<?php
$specificInfo = $block->getSpecificInformation();
if ($specificInfo):
if ($specificInfo) :
?>
<table class="data-table admin__table-secondary">
<?php foreach ($specificInfo as $item): ?>
<?php foreach ($specificInfo as $item) : ?>
<tr>
<th>
<?php echo $block->escapeHtml($item['label']) ?>
<?php if (isset($item['card_type'])):?>
<?php if (isset($item['card_type'])) :?>
<?php echo ' - ' . $block->escapeHtml($item['card_type'])?>
<?php endif; ?>
</th>
<td style='padding-left:10px;font-weight:bold;'>
<?php /* @noEscape */ echo $block->escapeHtml($item['value']) ?>
<?php if (isset($item['reference_number'])):?>

<?php if (isset($item['reference_number'])) :?>
<tr>
<th style="padding-left: 50px; font-size: 12px"><i>Reference No</i></th>
<td><?php echo $item['reference_number'];?></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
$specificInfo = $block->getSpecificInformation();
?>
<dl class="payment-method">
<?php if ($specificInfo):?>
<?php if ($specificInfo) :?>
<dd class="content">
<table class="data table">
<?php foreach ($specificInfo as $item):?>
<?php foreach ($specificInfo as $item) :?>
<tr>
<th scope="row"><?= $block->escapeHtml($item['label']) ?></th>
<td>
<?= /* @noEscape */ $item['value'] ?>
</td>
</tr>
<?php if ($item['reference_number']):?>
<?php if ($item['reference_number']) :?>
<tr>
<th style="padding-left: 10px; font-size: 12px"><i><?= __('Reference No')?></i></th>
<td><?= $item['reference_number'] ?></td>
Expand Down

0 comments on commit 5111a62

Please sign in to comment.