1 <?php
  2   3   4 
  5 namespace Team3\PayU\Communication\Request\Model;
  6 
  7 use Team3\PayU\Order\Model\Money\Money;
  8 use Team3\PayU\Order\Model\Money\MoneyInterface;
  9 use JMS\Serializer\Annotation as JMS;
 10 
 11  12  13  14  15  16 
 17 class RefundModel implements RefundModelInterface
 18 {
 19      20  21  22 
 23     private $description;
 24 
 25      26  27  28 
 29     private $bankDescription;
 30 
 31      32  33  34  35  36  37  38 
 39     private $amount;
 40 
 41      42  43  44  45 
 46     public function __construct(
 47         $description,
 48         $bankDescription = null,
 49         MoneyInterface $amount = null
 50     ) {
 51         $this->description = $description;
 52         $this->bankDescription = $bankDescription;
 53         $this->amount = $amount;
 54     }
 55 
 56      57  58 
 59     public function getDescription()
 60     {
 61         return $this->description;
 62     }
 63 
 64      65  66  67  68 
 69     public function setDescription($description)
 70     {
 71         $this->description = $description;
 72 
 73         return $this;
 74     }
 75 
 76      77  78 
 79     public function getBankDescription()
 80     {
 81         return $this->bankDescription;
 82     }
 83 
 84      85  86  87  88 
 89     public function setBankDescription($bankDescription)
 90     {
 91         $this->bankDescription = $bankDescription;
 92 
 93         return $this;
 94     }
 95 
 96      97  98 
 99     public function getAmount()
100     {
101         return $this->amount;
102     }
103 
104     105 106 
107     public function getAmountForSerialization()
108     {
109         if ($this->amount instanceof MoneyInterface) {
110             return $this->amount->getValueWithoutSeparation(2);
111         }
112 
113         return $this->amount;
114     }
115 
116     117 118 119 120 
121     public function setAmountFromDeserialization($amount)
122     {
123         $this->amount = new Money($amount / 100);
124 
125         return $this;
126     }
127 }
128