Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
20 / 20
CRAP
100.00% covered (success)
100.00%
34 / 34
RefundModel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
20 / 20
21
100.00% covered (success)
100.00%
34 / 34
 setCurrencyInAmount()
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
7 / 7
 isPending()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 isCanceled()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 isFinalized()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getRefundId()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setRefundId($refundId)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getExtRefundId()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setExtRefundId($extRefundId)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getAmount()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setAmount($amount)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getCurrencyCode()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setCurrencyCode($currencyCode)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getDescription()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setDescription($description)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getCreationDateTime()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setCreationDateTime($creationDateTime)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getStatus()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setStatus($status)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getStatusDateTime()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setStatusDateTime($statusDateTime)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
/**
 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 */
namespace Team3\PayU\Communication\Response\Model;
use JMS\Serializer\Annotation as JMS;
use Team3\PayU\Order\Model\Money\Money;
use Team3\PayU\Order\Model\Money\MoneyInterface;
/**
 * Class RefundModel
 * @package Team3\PayU\Communication\Response\Model
 * @JMS\AccessorOrder("alphabetical")
 * @JMS\AccessType("public_methods")
 */
class RefundModel implements RefundModelInterface
{
    /**
     * @var string
     * @JMS\Type("string")
     */
    private $refundId;
    /**
     * @var string
     * @JMS\Type("string")
     */
    private $extRefundId;
    /**
     * @var MoneyInterface
     * @JMS\Type("integer")
     */
    private $amount;
    /**
     * @var string
     * @JMS\Type("string")
     */
    private $currencyCode;
    /**
     * @var string
     * @JMS\Type("string")
     */
    private $description;
    /**
     * @var \DateTime
     * @JMS\Type("string")
     */
    private $creationDateTime;
    /**
     * @var string
     * @JMS\Type("string")
     */
    private $status;
    /**
     * @var \DateTime
     * @JMS\Type("string")
     */
    private $statusDateTime;
    /**
     * @JMS\PostDeserialize()
     */
    public function setCurrencyInAmount()
    {
        if (null === $this->currencyCode) {
            return;
        }
        $this->amount = new Money(
            $this->getAmount()->getValue(),
            $this->currencyCode
        );
    }
    /**
     * @return bool
     */
    public function isPending()
    {
        return self::STATUS_PENDING === $this->status;
    }
    /**
     * @return bool
     */
    public function isCanceled()
    {
        return self::STATUS_CANCELED === $this->status;
    }
    /**
     * @return bool
     */
    public function isFinalized()
    {
        return self::STATUS_FINALIZED === $this->status;
    }
    /**
     * @return string
     */
    public function getRefundId()
    {
        return $this->refundId;
    }
    /**
     * @param string $refundId
     *
     * @return RefundModel
     */
    public function setRefundId($refundId)
    {
        $this->refundId = $refundId;
        return $this;
    }
    /**
     * @return string
     */
    public function getExtRefundId()
    {
        return $this->extRefundId;
    }
    /**
     * @param string $extRefundId
     *
     * @return RefundModel
     */
    public function setExtRefundId($extRefundId)
    {
        $this->extRefundId = $extRefundId;
        return $this;
    }
    /**
     * @return MoneyInterface
     */
    public function getAmount()
    {
        return $this->amount;
    }
    /**
     * @param int $amount
     *
     * @return $this
     */
    public function setAmount($amount)
    {
        $this->amount = new Money($amount / 100);
        return $this;
    }
    /**
     * @return string
     */
    public function getCurrencyCode()
    {
        return $this->currencyCode;
    }
    /**
     * @param string $currencyCode
     *
     * @return RefundModel
     */
    public function setCurrencyCode($currencyCode)
    {
        $this->currencyCode = $currencyCode;
        return $this;
    }
    /**
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * @param string $description
     *
     * @return RefundModel
     */
    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }
    /**
     * @return \DateTime
     */
    public function getCreationDateTime()
    {
        return $this->creationDateTime;
    }
    /**
     * @param string $creationDateTime
     *
     * @return RefundModel
     */
    public function setCreationDateTime($creationDateTime)
    {
        $this->creationDateTime = new \DateTime($creationDateTime);
        return $this;
    }
    /**
     * @return string
     */
    public function getStatus()
    {
        return $this->status;
    }
    /**
     * @param string $status
     *
     * @return RefundModel
     */
    public function setStatus($status)
    {
        $this->status = $status;
        return $this;
    }
    /**
     * @return \DateTime
     */
    public function getStatusDateTime()
    {
        return $this->statusDateTime;
    }
    /**
     * @param string $statusDateTime
     *
     * @return RefundModel
     */
    public function setStatusDateTime($statusDateTime)
    {
        $this->statusDateTime = new \DateTime($statusDateTime);
        return $this;
    }
}