Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
woutse committed Jan 9, 2023
2 parents 04db675 + 0c80635 commit 8c635e9
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
25 changes: 20 additions & 5 deletions paynlpaymentmethods/paynlpaymentmethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,11 @@ private function getPaymentMethods($cart = null)
]);

if ($bShowLogo) {
$objPaymentMethod->setLogo($this->_path . 'views/images/' . $paymentMethod->brand_id . '.png');
$objPaymentMethod->setLogo($this->_path . 'views/images/' . $paymentMethod->brand_id . '.png');

if (!empty($paymentMethod->external_logo)) {
$objPaymentMethod->setLogo($paymentMethod->external_logo);
}
}

$strDescription = empty($paymentMethod->description) ? null : $paymentMethod->description;
Expand Down Expand Up @@ -716,10 +720,14 @@ public function processPayment($transactionId, &$message = null)
$amountPaid = in_array(round($cartTotalPrice, 2), $arrPayAmounts) ? $cartTotalPrice : null;

if (is_null($amountPaid)) {
$amountPaid = in_array(round($cart->getOrderTotal(), 2), $arrPayAmounts) ? $cart->getOrderTotal() : null;
if (in_array(round($cart->getOrderTotal(), 2), $arrPayAmounts)) {
$amountPaid = $cart->getOrderTotal();
} elseif (in_array(round($cart->getOrderTotal(false), 2), $arrPayAmounts)) {
$amountPaid = $cart->getOrderTotal(false);
}
}

$this->payLog('processPayment (order)', 'getOrderTotal: ' . $cart->getOrderTotal() . '. cartTotalPrice: ' . $cartTotalPrice . ' - ' . print_r($arrPayAmounts, true), $cartId, $transactionId);
$this->payLog('processPayment (order)', 'getOrderTotal: ' . $cart->getOrderTotal() . ' getOrderTotal(false): ' . $cart->getOrderTotal(false) . '. cartTotalPrice: ' . $cartTotalPrice . ' - ' . print_r($arrPayAmounts, true), $cartId, $transactionId);

if ($orderId) {

Expand Down Expand Up @@ -1707,6 +1715,11 @@ private function getPaymentMethodsCombined()
$changed = true;
}

if (!isset($paymentmethod->external_logo)) {
$paymentmethod->external_logo = '';
$changed = true;
}

foreach ($languages as $language) {
$key_name = 'name_' . $language['iso_code'];
if (!isset($paymentmethod->$key_name)) {
Expand Down Expand Up @@ -1741,7 +1754,8 @@ private function getPaymentMethodsCombined()
'allowed_carriers' => [],
'fee_percentage' => false,
'fee_value' => '',
'customer_type' => 'both'
'customer_type' => 'both',
'external_logo' => ''
];

foreach ($languages as $language) {
Expand Down Expand Up @@ -1778,7 +1792,8 @@ public function renderPaymentMethodsForm()
'available_carriers' => $this->getCarriers(),
'image_url' => $this->_path . 'views/images/',
'languages' => Language::getLanguages(true),
'paymentmethods' => (array) $this->getPaymentMethodsCombined()
'paymentmethods' => (array) $this->getPaymentMethodsCombined(),
'showExternalLogoList' => [PaymentMethod::METHOD_GIVACARD]
));

return $this->display(__FILE__, 'admin_paymentmethods.tpl');
Expand Down
1 change: 1 addition & 0 deletions paynlpaymentmethods/src/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class PaymentMethod
const METHOD_SOFORT = 556;
const METHOD_INSTORE = 1729;
const METHOD_INSTORE_PROFILE_ID = 1633;
const METHOD_GIVACARD = 1657;

/**
* @param null $transactionId
Expand Down
6 changes: 4 additions & 2 deletions paynlpaymentmethods/views/css/PAY_checkout.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
.PAYNL.payment-option img {
.payment-option img {
margin-top: 0px;
float: left;
margin-right: 10px;
width: 50px;
cursor: pointer;
position: relative;
top: -15px;
width: 50px;
height: 50px;
object-fit: contain;
}

.payment-options form.paynl {
Expand Down
12 changes: 12 additions & 0 deletions paynlpaymentmethods/views/templates/hook/admin_paymentmethods.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@
</p>
</div>
</div>

{if in_array($paymentmethod->id,$showExternalLogoList)}
<div class="form-group">
<label class="control-label col-lg-3 align-right">{l s='External logo' mod='paynlpaymentmethods'}</label>
<div class="col-lg-9">
<input type="text" value="{$paymentmethod->external_logo}" name="external_logo">
<p class="help-block">
{l s='URL to a different logo to be used in the checkout' mod='paynlpaymentmethods'}
</p>
</div>
</div>
{/if}
</div>
</div>
</form>
Expand Down

0 comments on commit 8c635e9

Please sign in to comment.