Skip to content

Commit

Permalink
Fixed get currency if the id is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
lucionescu committed Sep 6, 2023
1 parent ba6156d commit 15a64f7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
15 changes: 8 additions & 7 deletions paylike/paylike.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class plgVmPaymentPaylike extends vmPSPlugin {

public $version = '2.2.0';
public $version = '2.2.1';
static $IDS = array();
protected $_isInList = false;
function __construct (& $subject, $config) {
Expand Down Expand Up @@ -118,7 +118,7 @@ function plgVmConfirmedOrder ($cart, $order) {

$currency = $method->payment_currency;
// backward compatibility
if (Version::MAJOR_VERSION < 4) {
if (is_numeric($method->payment_currency)) {
$currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
}

Expand Down Expand Up @@ -369,12 +369,13 @@ function plgVmgetPaymentCurrency ($virtuemart_paymentmethod_id, &$paymentCurrenc
}
$this->getPaymentCurrency ($method);

$paymentCurrencyId = shopFunctions::getCurrencyIDByName($method->payment_currency);

// backward compatibility
if (Version::MAJOR_VERSION < 4) {
if (is_numeric($method->payment_currency)) {
$paymentCurrencyId = $method->payment_currency;
} else {
$paymentCurrencyId = shopFunctions::getCurrencyIDByName($method->payment_currency);
}

return;
}

Expand Down Expand Up @@ -592,7 +593,7 @@ function plgVmOnSelfCallFE( $type, $name, &$render ) {

$currency = $method->payment_currency;
// backward compatibility
if (Version::MAJOR_VERSION < 4) {
if (is_numeric($method->payment_currency)) {
$currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
}

Expand Down Expand Up @@ -657,7 +658,7 @@ function plgVmOnSelfCallFE( $type, $name, &$render ) {

$currency = $method->payment_currency;
// backward compatibility
if (Version::MAJOR_VERSION < 4) {
if (is_numeric($method->payment_currency)) {
$currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
}

Expand Down
2 changes: 1 addition & 1 deletion paylike/paylike.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<authorUrl>http://shop.st42.fr</authorUrl>
<copyright>Copyright (C) 2018 STUDIO42 France. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<version>2.2.0</version>
<version>2.2.1</version>
<description>
<![CDATA[<a href="https://paylike.io" target="_blank">Paylike</a> is a popular
payment provider. ]]>
Expand Down
2 changes: 1 addition & 1 deletion paylike/tmpl/pay_after.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

$currency = $method->payment_currency;
// backward compatibility
if (\Joomla\CMS\Version::MAJOR_VERSION < 4) {
if (is_numeric($method->payment_currency)) {
$currency = shopFunctions::getCurrencyByID($method->payment_currency, 'currency_code_3');
}

Expand Down
11 changes: 9 additions & 2 deletions paylike/tmpl/pay_before_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@ function cancelSubmit() {
<?php } else { ?>

jQuery(document).ready(function() {
var $container = jQuery(Virtuemart.containerSelector),
paymentDone = false;
let $container = '';
let paymentDone = false;

if (Virtuemart.containerSelector) {
$container = jQuery(Virtuemart.containerSelector)
} else {
$container = jQuery('#cart-view')
}

$container.find('#checkoutForm').on('submit',function(e) {
// payment is done, then submit
if(paymentDone === true) return;
Expand Down

0 comments on commit 15a64f7

Please sign in to comment.