<?php



/**

 * Price.class [TIPO]

 * Descricao

 * @copyright (c) year, Welton Thierree TagPage

 */

class Price {



    private $Percent;

    private $Valor;

    private $Parcelas;

    private $Data;

    private $Result;

    private $Error;



    public function __construct() {

        $this->Percent = DESCONTO_BOLETO;

    }



    public function desBoleto($valor) {

        $this->valor = $valor;

        

        $this->Data['valor'] = ($this->Valor / 100 * $this->Percent);

        $this->Result = true;

        $this->Error = ['Sucesso', WS_ACCEPT];

    }

    

    public function parcelas($valor){

        $this->Valor = $valor;

        

        if($this->Valor > 300):

            $parcela = 10;

        elseif($this->Valor >= 200):

            $parcela = 6;

        elseif($this->Valor >= 150):

            $parcela = 5;

        elseif($this->Valor >= 100):

            $parcela = 4;

        elseif($this->Valor >= 70):

            $parcela = 3;

        elseif($this->Valor >= 40):

            $parcela = 2;

        else:

            $parcela = 1;

        endif;

        

        $this->Parcelas = $parcela;

                

        for ($i = 1; $i <= $parcela; $i++) {

            $this->Result[$i]['parcela'] = $i;

            $this->Result[$i]['valor'] = $this->Valor/$i;

        }

    }

        

    function getParcelas() {

        return $this->Parcelas;

    }

    

    public function getResult() {

        return $this->Result;

    }



}

