Skip to content

Commit

Permalink
Merge pull request #45 from PayEx/develop
Browse files Browse the repository at this point in the history
Updates for version 3.0.3
  • Loading branch information
aait authored Aug 17, 2016
2 parents c630634 + a36a599 commit af35b43
Show file tree
Hide file tree
Showing 69 changed files with 2,464 additions and 314 deletions.
74 changes: 74 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
language: php
sudo: false

php:
#- 5.3
- 5.4
- 5.5
- 5.6

env:
- MAGENTO_VERSION="1.7.0.2"
- MAGENTO_VERSION="1.8.1.0"
- MAGENTO_VERSION="1.9.2.4"

matrix:
fast_finish: true
allow_failures:
- php: 5.6
exclude:
# Newer Magento versions uses newer PHP versions
- php: 5.3
env: MAGENTO_VERSION="1.9.2.4"

# Old Magento Versions are not officially supported to run with PHP 5.5+
- php: 5.5
env: MAGENTO_VERSION="1.7.0.2"
- php: 5.6
env: MAGENTO_VERSION="1.7.0.2"

install:
- git submodule update --init --recursive
- composer require firegento/magento ~$MAGENTO_VERSION
- cp phpunit.xml ./vendor/firegento/magento
- cd ./vendor/firegento/magento
- cp ./app/etc/local.xml.template ./app/etc/local.xml
- sed -i -e 's/{{date}}/Thu, 14 Jul 2016 10:03:10 +0000/g' ./app/etc/local.xml
- sed -i -e 's/{{key}}/8532ecf375979bf5658401d2b7ca2040/g' ./app/etc/local.xml
- sed -i -e 's/{{db_prefix}}//g' ./app/etc/local.xml
- sed -i -e 's/{{db_host}}/localhost/g' ./app/etc/local.xml
- sed -i -e 's/{{db_user}}/travis/g' ./app/etc/local.xml
- sed -i -e 's/{{db_pass}}//g' ./app/etc/local.xml
- sed -i -e 's/{{db_name}}/magento_test/g' ./app/etc/local.xml
- sed -i -e 's/{{db_init_statemants}}/SET NAMES utf8/g' ./app/etc/local.xml
- sed -i -e 's/{{db_model}}/mysql4/g' ./app/etc/local.xml
- sed -i -e 's/{{db_pdo_type}}//g' ./app/etc/local.xml
- sed -i -e 's/{{db_type}}/pdo_mysql/g' ./app/etc/local.xml
- sed -i -e 's/{{session_save}}/files/g' ./app/etc/local.xml
- sed -i -e 's/{{admin_frontname}}/admin/g' ./app/etc/local.xml
- wget https://raw.githubusercontent.com/colinmollenhour/modman/master/modman
- chmod +x ./modman
- ./modman init
- ./modman clone https://github.com/EcomDev/EcomDev_PHPUnit.git
- sed -i -e 's/<allow_same_db>0/<allow_same_db>1/g' ./app/etc/local.xml.phpunit
- ./modman link $(readlink -f ./../../../)
- wget https://files.magerun.net/n98-magerun.phar
- chmod +x ./n98-magerun.phar
- wget http://magento7.aait.nu/magento_test.sql
- mysql -e 'create database `magento_test`;'
- mysql -utravis -Dmagento_test < ./magento_test.sql
- ./n98-magerun.phar sys:setup:run
- ./n98-magerun.phar cache:clean
- ./n98-magerun.phar index:reindex:all
- cd shell
- php ./ecomdev-phpunit.php -a magento-config --db-name travis --base-url http://magetest7.local/
- cd ..

script:
- phpunit

notifications:
email:
recipients:
- [email protected]
on_failure: always
12 changes: 12 additions & 0 deletions PayEx_Payments/Changelog_payex.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Version 3.0.3
* Improvements of Social Security Number addon
* Improvements of Payment Fee feature
* Option: Perform validation of SSN before checkout
* Option: Discount calculation mode
* Option: Credit Check for Invoice method
* Removed unnecessary info that is presented to end user
* AutoPay frontend changes
* PartPayment fixes
* More descriptions for error codes
* Added Unit Tests

Version 3.0.2
* Social Security Number: Use secure base URL
* Added Missing Block: payex/invoice_totals_fee
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,61 @@ class PayEx_Payments_Block_Checkout_Fee extends Mage_Checkout_Block_Total_Defaul
'payex_partpayment',
'payex_invoice'
);

/**
* Get Payment Fee Incl Tax
* @return mixed
*/
public function getPayExFeeIncludeTax()
{
return $this->getTotal()->getAddress()->getPayexPaymentFee() + $this->getTotal()->getAddress()->getPayexPaymentFeeTax();
}

/**
* Get Payment Fee Excl Tax
* @return mixed
*/
public function getPayExFeeExcludeTax()
{
return $this->getTotal()->getAddress()->getPayexPaymentFee();
}

/**
* Check if display cart prices fee included and excluded tax
* @return mixed
*/
public function displayCartPayExFeeBoth()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displayCartPayExFeeBoth($this->getStore());
}

/**
* Check if display cart prices fee included tax
* @return mixed
*/
public function displayCartPayExFeeInclTax()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displayCartPayExFeeInclTax($this->getStore());
}

/**
* Get Payment fee
* @return float
* Get "Exclude Tax" Label
* @return mixed
*/
public function getPaymentFee()
public function getExcludeTaxLabel()
{
$paymentMethod = Mage::app()->getFrontController()->getRequest()->getParam('payment');
$paymentMethod = Mage::app()->getStore()->isAdmin() && isset($paymentMethod['method']) ? $paymentMethod['method'] : null;
if (!in_array($paymentMethod, self::$_allowed_methods) && (!count($this->getQuote()->getPaymentsCollection()) || !$this->getQuote()->getPayment()->hasMethodInstance())) {
return $this;
}

$paymentMethod = $this->getQuote()->getPayment()->getMethodInstance();
if (!in_array($paymentMethod->getCode(), self::$_allowed_methods)) {
return $this;
}

$price = (float) $paymentMethod->getConfigData('paymentfee');
$tax_class = $paymentMethod->getConfigData('paymentfee_tax_class');
$fee = Mage::helper('payex/fee')->getPaymentFeePrice($price, $tax_class);
return $fee;
return Mage::helper('tax')->getIncExcTaxLabel(false);
}

/**
* Get Quote
* @return Mage_Sales_Model_Quote
* Get "Include Tax" Label
* @return mixed
*/
public function getQuote()
public function getIncludeTaxLabel()
{
return Mage::getModel('checkout/cart')->getQuote();
return Mage::helper('tax')->getIncExcTaxLabel(true);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

class PayEx_Payments_Block_Creditmemo_Totals_Fee extends Mage_Adminhtml_Block_Template
{
public function initTotals()
{
$parent = $this->getParentBlock();
if ($parent->getSource()->getBasePayexPaymentFee() > 0) {
if ($this->displaySalesPayExFeeBoth()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)'));
$total->setValue($parent->getSource()->getPayexPaymentFee() + $parent->getSource()->getPayexPaymentFeeTax());
$total->setBaseValue($parent->getSource()->getBasePayexPaymentFee() + $parent->getSource()->getBasePayexPaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'shipping');

$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)'));
$total->setValue($parent->getSource()->getPayexPaymentFee());
$total->setBaseValue($parent->getSource()->getBasePayexPaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'payex_payment_fee_with_tax');
} elseif ($this->displaySalesPayExFeeInclTax()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($parent->getSource()->getPayexPaymentFee() + $parent->getSource()->getPayexPaymentFeeTax());
$total->setBaseValue($parent->getSource()->getBasePayexPaymentFee() + $parent->getSource()->getBasePayexPaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'shipping');
} else {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($parent->getSource()->getPayexPaymentFee());
$total->setBaseValue($parent->getSource()->getBasePayexPaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'shipping');
}
}

return $this;
}

/**
* Check if display cart prices fee included and excluded tax
* @return mixed
*/
public function displaySalesPayExFeeBoth()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeBoth($this->getParentBlock()->getSource()->getStoreId());
}

/**
* Check if display cart prices fee included tax
* @return mixed
*/
public function displaySalesPayExFeeInclTax()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeInclTax($this->getParentBlock()->getSource()->getStoreId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,58 @@ public function initTotals()
return $this;
}

if ($invoice->getOrder()->getBasePayexPaymentFeeTax()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)'));
$total->setValue($invoice->getOrder()->getPayexPaymentFee() + $invoice->getOrder()->getPayexPaymentFeeTax());
$total->setBaseValue($invoice->getOrder()->getPayexBasePaymentFee() + $invoice->getOrder()->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'tax');
}
if ($invoice->getBasePayexPaymentFeeTax() > 0) {
if ($this->displaySalesPayExFeeBoth()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)'));
$total->setValue($invoice->getPayexPaymentFee() + $invoice->getPayexPaymentFeeTax());
$total->setBaseValue($invoice->getPayexBasePaymentFee() + $invoice->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'tax');

if ($invoice->getOrder()->getBasePayexPaymentFee()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)'));
$total->setValue($invoice->getOrder()->getPayexPaymentFee());
$total->setBaseValue($invoice->getOrder()->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'payex_payment_fee_with_tax');
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)'));
$total->setValue($invoice->getPayexPaymentFee());
$total->setBaseValue($invoice->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'payex_payment_fee_with_tax');
} elseif ($this->displaySalesPayExFeeInclTax()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($invoice->getPayexPaymentFee() + $invoice->getPayexPaymentFeeTax());
$total->setBaseValue($invoice->getPayexBasePaymentFee() + $invoice->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'tax');
} else {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($invoice->getPayexPaymentFee());
$total->setBaseValue($invoice->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'tax');
}
}

return $this;
}

/**
* Check if display cart prices fee included and excluded tax
* @return mixed
*/
public function displaySalesPayExFeeBoth()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeBoth($this->getParentBlock()->getInvoice()->getStoreId());
}

/**
* Check if display cart prices fee included tax
* @return mixed
*/
public function displaySalesPayExFeeInclTax()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeInclTax($this->getParentBlock()->getInvoice()->getStoreId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,58 @@ public function initTotals()
return $this;
}

if ($parent->getOrder()->getBasePayexPaymentFeeTax()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)'));
$total->setValue($parent->getOrder()->getPayexPaymentFee() + $parent->getOrder()->getPayexPaymentFeeTax());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee() + $parent->getOrder()->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'tax');
}
if ($parent->getOrder()->getBasePayexPaymentFee() > 0) {
if ($this->displaySalesPayExFeeBoth()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)'));
$total->setValue($parent->getOrder()->getPayexPaymentFee() + $parent->getOrder()->getPayexPaymentFeeTax());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee() + $parent->getOrder()->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'grand_total');

if ($parent->getOrder()->getBasePayexPaymentFee()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)'));
$total->setValue($parent->getOrder()->getPayexPaymentFee());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'payex_payment_fee_with_tax');
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)'));
$total->setValue($parent->getOrder()->getPayexPaymentFee());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'payex_payment_fee_with_tax');
} elseif ($this->displaySalesPayExFeeInclTax()) {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($parent->getOrder()->getPayexPaymentFee() + $parent->getOrder()->getPayexPaymentFeeTax());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee() + $parent->getOrder()->getPayexBasePaymentFeeTax());
$total->setCode('payex_payment_fee_with_tax');
$parent->addTotalBefore($total, 'grand_total');
} else {
$total = new Varien_Object();
$total->setLabel(Mage::helper('payex')->__('Payment fee'));
$total->setValue($parent->getOrder()->getPayexPaymentFee());
$total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee());
$total->setCode('payex_payment_fee');
$parent->addTotalBefore($total, 'grand_total');
}
}

return $this;
}

/**
* Check if display cart prices fee included and excluded tax
* @return mixed
*/
public function displaySalesPayExFeeBoth()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeBoth($this->getParentBlock()->getOrder()->getStore());
}

/**
* Check if display cart prices fee included tax
* @return mixed
*/
public function displaySalesPayExFeeInclTax()
{
$config = Mage::getSingleton('payex/fee_config');
return $config->displaySalesPayExFeeInclTax($this->getParentBlock()->getOrder()->getStore());
}
}
Loading

0 comments on commit af35b43

Please sign in to comment.