Skip to content

Commit

Permalink
Merge pull request #102 from mollie/5.0.4
Browse files Browse the repository at this point in the history
5.0.4
  • Loading branch information
Marvin-Magmodules authored Jan 9, 2019
2 parents 8aa0670 + f15e43e commit 3fc4391
Show file tree
Hide file tree
Showing 108 changed files with 296 additions and 264 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2018, Mollie B.V.
Copyright (c) 2012-2019, Mollie B.V.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Block/Adminhtml/Render/Note.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Block/Loading.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Block/Payment/Form.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Block/Payment/Info/Base.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Block/Payment/Loading.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Helper/Api.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Helper/Autoloader.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
68 changes: 35 additions & 33 deletions app/code/community/Mollie/Mpm/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,39 +27,14 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

class Mollie_Mpm_Helper_Data extends Mage_Core_Helper_Abstract
{

const MIN_API_VERSION = '2.1.0';
const CURRENCIES_WITHOUT_DECIMAL = array('JPY');
const SUPPORTED_LOCAL = array(
'en_US',
'nl_NL',
'nl_BE',
'fr_FR',
'fr_BE',
'de_DE',
'de_AT',
'de_CH',
'es_ES',
'ca_ES',
'pt_PT',
'it_IT',
'nb_NO',
'sv_SE',
'fi_FI',
'da_DK',
'is_IS',
'hu_HU',
'pl_PL',
'lv_LV',
'lt_LT'
);

const XPATH_MODULE_ACTIVE = 'payment/mollie/active';
const XPATH_API_MODUS = 'payment/mollie/type';
const XPATH_LIVE_APIKEY = 'payment/mollie/apikey_live';
Expand Down Expand Up @@ -458,11 +433,7 @@ public function getAmountArray($currency, $value)
*/
public function formatCurrencyValue($value, $currency)
{
$decimalPrecision = 2;
if (in_array($currency, self::CURRENCIES_WITHOUT_DECIMAL)) {
$decimalPrecision = 0;
}

$decimalPrecision = ($currency == 'JPY') ? 0 : 2;
return number_format($value, $decimalPrecision, '.', '');
}

Expand All @@ -480,7 +451,8 @@ public function getLocaleCode($storeId = null, $method = 'payment')

if ($locale == 'store' || (!$locale && $method == 'order')) {
$localeCode = Mage::app()->getLocale()->getLocaleCode();
if (in_array($localeCode, self::SUPPORTED_LOCAL)) {
$supportedLocale = $this->getSupportedLocale();
if (in_array($localeCode, $supportedLocale)){
$locale = $localeCode;
}
}
Expand Down Expand Up @@ -874,4 +846,34 @@ public function getMethodByCode($code)
return $this->mollieMethods[$key];
}
}

/**
* @return array
*/
public function getSupportedLocale()
{
return array(
'en_US',
'nl_NL',
'nl_BE',
'fr_FR',
'fr_BE',
'de_DE',
'de_AT',
'de_CH',
'es_ES',
'ca_ES',
'pt_PT',
'it_IT',
'nb_NO',
'sv_SE',
'fi_FI',
'da_DK',
'is_IS',
'hu_HU',
'pl_PL',
'lv_LV',
'lt_LT'
);
}
}
4 changes: 2 additions & 2 deletions app/code/community/Mollie/Mpm/Helper/Test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2012-2018, Mollie B.V.
* Copyright (c) 2012-2019, Mollie B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -27,7 +27,7 @@
* @category Mollie
* @package Mollie_Mpm
* @author Mollie B.V. ([email protected])
* @copyright Copyright (c) 2012-2018 Mollie B.V. (https://www.mollie.nl)
* @copyright Copyright (c) 2012-2019 Mollie B.V. (https://www.mollie.nl)
* @license http://www.opensource.org/licenses/bsd-license.php BSD-License 2
*/

Expand Down
Loading

0 comments on commit 3fc4391

Please sign in to comment.