Skip to content

Commit

Permalink
Cart rules included
Browse files Browse the repository at this point in the history
  • Loading branch information
agnagna committed Aug 12, 2014
1 parent e6b5369 commit 592ea64
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.4
* Cart rules included

## 2.0.3
* Prestashop 1.4.4 compatibility fixed

Expand Down
2 changes: 1 addition & 1 deletion payu/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>payu</name>
<displayName><![CDATA[PayU]]></displayName>
<version><![CDATA[2.0.3]]></version>
<version><![CDATA[2.0.4]]></version>
<description><![CDATA[Accepts payments by PayU]]></description>
<author><![CDATA[PayU]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
41 changes: 25 additions & 16 deletions payu/payu.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ public function __construct()
{
$this->name = 'payu';
$this->tab = 'payments_gateways';
$this->version = '2.0.3';
$this->version = '2.0.4';
$this->author = 'PayU';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.4.4', 'max' => '1.6');
$this->ps_versions_compliancy = array('min' => '1.4.0', 'max' => '1.6');

$this->currencies = true;
$this->currencies_mode = 'radio';
Expand Down Expand Up @@ -1254,20 +1254,29 @@ public function orderCreateRequest()

$cart_products = $this->cart->getProducts();

foreach ($cart_products as $product)
{

$price_wt = $this->toAmount($product['price_wt']);

$total += $this->toAmount($product['total_wt']);

$items['products']['products'][] = array (
'quantity' => (int)$product['quantity'],
'name' => $product['name'],
'unitPrice' => $price_wt
);

}
//discounts and cart rules
if($this->cart->getCartRules()){
$items['products']['products'][] = array (
'quantity' => 1,
'name' => 'Order id '.$this->cart->id,
'unitPrice' => $this->toAmount($this->cart->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING))
);
}else{
foreach ($cart_products as $product)
{

$price_wt = $this->toAmount($product['price_wt']);

$total += $this->toAmount($product['total_wt']);

$items['products']['products'][] = array (
'quantity' => (int)$product['quantity'],
'name' => $product['name'],
'unitPrice' => $price_wt
);

}
};

// Wrapping fees
$wrapping_fees_tax_inc = $wrapping_fees = 0;
Expand Down

0 comments on commit 592ea64

Please sign in to comment.