-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from michielgerritsen/1.8.0-merged
1.8.0 merged
- Loading branch information
Showing
64 changed files
with
2,245 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Block\PaymentFee\Sales; | ||
|
||
use Magento\Framework\DataObject; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Sales\Block\Adminhtml\Order\Creditmemo\Totals; | ||
|
||
class Creditmemo extends Template | ||
{ | ||
public function initTotals() | ||
{ | ||
/** @var Totals $parentBlock */ | ||
$parentBlock = $this->getParentBlock(); | ||
$creditmemo = $parentBlock->getCreditmemo(); | ||
|
||
if (!(int)$creditmemo->getBaseMolliePaymentFee()) { | ||
return; | ||
} | ||
|
||
$total = new DataObject([ | ||
'code' => 'mollie_payment_fee', | ||
'value' => $creditmemo->getMolliePaymentFee() + $creditmemo->getMolliePaymentFeeTax(), | ||
'label' => __('Payment Fee'), | ||
]); | ||
|
||
$parentBlock->addTotalBefore($total, 'tax'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Block\PaymentFee\Sales; | ||
|
||
use Magento\Framework\DataObject; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Sales\Block\Adminhtml\Order\Creditmemo\Totals; | ||
use Mollie\Payment\Service\Order\Creditmemo as CreditmemoService; | ||
|
||
class CreditmemoNew extends Template | ||
{ | ||
/** | ||
* @var CreditmemoService | ||
*/ | ||
private $creditmemoService; | ||
|
||
public function __construct( | ||
Template\Context $context, | ||
CreditmemoService $creditmemoService, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
|
||
$this->creditmemoService = $creditmemoService; | ||
} | ||
|
||
public function initTotals() | ||
{ | ||
/** @var Totals $parentBlock */ | ||
$parentBlock = $this->getParentBlock(); | ||
$order = $parentBlock->getOrder(); | ||
$creditmemo = $parentBlock->getCreditmemo(); | ||
|
||
if (!($order->getMolliePaymentFee() + $order->getMolliePaymentFeeTax())) { | ||
return; | ||
} | ||
|
||
if (!$this->creditmemoService->isFullOrLastPartialCreditmemo($creditmemo)) { | ||
return; | ||
} | ||
|
||
$total = new DataObject([ | ||
'code' => 'mollie_payment_fee', | ||
'value' => $order->getMolliePaymentFee() + $order->getMolliePaymentFeeTax(), | ||
'label' => __('Payment Fee'), | ||
]); | ||
|
||
$parentBlock->addTotalBefore($total, 'tax'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Block\PaymentFee\Sales; | ||
|
||
use Magento\Framework\DataObject; | ||
use Magento\Framework\View\Element\Template; | ||
use Magento\Sales\Block\Adminhtml\Order\Totals; | ||
|
||
class Order extends Template | ||
{ | ||
public function initTotals() | ||
{ | ||
/** @var Totals $parentBlock */ | ||
$parentBlock = $this->getParentBlock(); | ||
$order = $parentBlock->getOrder(); | ||
|
||
if (!($order->getMolliePaymentFee() + $order->getMolliePaymentFeeTax())) { | ||
return; | ||
} | ||
|
||
$total = new DataObject([ | ||
'code' => 'mollie_payment_fee', | ||
'value' => $order->getMolliePaymentFee() + $order->getMolliePaymentFeeTax(), | ||
'label' => __('Payment Fee'), | ||
]); | ||
|
||
$parentBlock->addTotalBefore($total, 'tax'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
class Config | ||
{ | ||
const XML_PATH_STATUS_PENDING_BANKTRANSFER = 'payment/mollie_methods_banktransfer/order_status_pending'; | ||
const XML_PATH_STATUS_NEW_PAYMENT_LINK = 'payment/mollie_methods_paymentlink/order_status_new'; | ||
const PAYMENT_KLARNAPAYLATER_PAYMENT_SURCHARGE = 'payment/mollie_methods_klarnapaylater/payment_surcharge'; | ||
const PAYMENT_KLARNAPAYLATER_PAYMENT_SURCHARGE_TAX_CLASS = 'payment/mollie_methods_klarnapaylater/payment_surcharge_tax_class'; | ||
const PAYMENT_KLARNASLICEIT_PAYMENT_SURCHARGE = 'payment/mollie_methods_klarnasliceit/payment_surcharge'; | ||
const PAYMENT_KLARNASLICEIT_PAYMENT_SURCHARGE_TAX_CLASS = 'payment/mollie_methods_klarnasliceit/payment_surcharge_tax_class'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $config; | ||
|
||
public function __construct( | ||
ScopeConfigInterface $config | ||
) { | ||
$this->config = $config; | ||
} | ||
|
||
/** | ||
* @param $path | ||
* @param $storeId | ||
* @return string | ||
*/ | ||
private function getPath($path, $storeId) | ||
{ | ||
return $this->config->getValue($path, ScopeInterface::SCOPE_STORE, $storeId); | ||
} | ||
|
||
public function statusPendingBanktransfer($storeId = null) | ||
{ | ||
return $this->config->getValue( | ||
static::XML_PATH_STATUS_PENDING_BANKTRANSFER, | ||
ScopeInterface::SCOPE_STORE, | ||
$storeId | ||
); | ||
} | ||
|
||
public function statusNewPaymentLink($storeId = null) | ||
{ | ||
return $this->config->getValue( | ||
static::XML_PATH_STATUS_NEW_PAYMENT_LINK, | ||
ScopeInterface::SCOPE_STORE, | ||
$storeId | ||
); | ||
} | ||
|
||
/** | ||
* @param int|null $storeId | ||
* @return string | ||
*/ | ||
public function klarnaPaylaterPaymentSurcharge($storeId = null) | ||
{ | ||
return $this->getPath(static::PAYMENT_KLARNAPAYLATER_PAYMENT_SURCHARGE, $storeId); | ||
} | ||
|
||
/** | ||
* @param int|null $storeId | ||
* @return string | ||
*/ | ||
public function klarnaPaylaterPaymentSurchargeTaxClass($storeId = null) | ||
{ | ||
return $this->getPath(static::PAYMENT_KLARNAPAYLATER_PAYMENT_SURCHARGE_TAX_CLASS, $storeId); | ||
} | ||
|
||
/** | ||
* @param int|null $storeId | ||
* @return string | ||
*/ | ||
public function klarnaSliceitPaymentSurcharge($storeId = null) | ||
{ | ||
return $this->getPath(static::PAYMENT_KLARNASLICEIT_PAYMENT_SURCHARGE, $storeId); | ||
} | ||
|
||
/** | ||
* @param int|null $storeId | ||
* @return string | ||
*/ | ||
public function klarnaSliceitPaymentSurchargeTaxClass($storeId = null) | ||
{ | ||
return $this->getPath(static::PAYMENT_KLARNASLICEIT_PAYMENT_SURCHARGE_TAX_CLASS, $storeId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.