<?php
class ModelTotaldescontoporpagamento extends Model {
	public function getTotal(&$total_data, &$total, &$taxes) {
	
	  if(isset($this->session->data['payment_method'])){
	  
	    $paymentmethod = $this->session->data['payment_method'];		

		$valor = $this->config->get('descontopagamento_' . $paymentmethod['code']);
		
		if(($valor) && ($valor > 0) && ($valor != '')){
		   $percent = $valor;
		   $valor = ($valor/100) * $this->cart->getSubTotal();
		
			$total_data[] = array(
				'code'       => 'descontoporpagamento',
				'title'      => 'Desconto Pagamento(' . $percent . '%)',
				'text'       => $this->currency->format(-$valor),
				'value'      => -$valor,
				'sort_order' => 0
			);
			
			$total -= $valor;
		}
	  
	  }
		
	}
	
	public function confirm($order_info, $order_total) {
	
	}	
}
?>