PayU integration by Krzysztof Gzocha
  • Namespace
  • Class

Namespaces

  • Team3
    • PayU
      • Annotation
      • Communication
        • CurlRequestBuilder
        • HttpStatusParser
        • Notification
        • Process
          • NotificationProcess
          • ResponseDeserializer
        • Request
          • Model
        • Response
          • Model
        • Sender
      • Configuration
        • Credentials
      • Order
        • Autocomplete
          • Strategy
        • Model
          • Buyer
          • Money
          • Products
          • ShippingMethods
          • Traits
        • Transformer
          • UserOrder
            • Strategy
              • Product
              • ShippingMethod
      • PropertyExtractor
        • Reader
      • Serializer
      • SignatureCalculator
        • Encoder
          • Algorithms
          • Strategy
        • ParametersSorter
        • Validator
      • ValidatorBuilder

Classes

  • Team3\PayU\ValidatorBuilder\ValidatorBuilder

Interfaces

  • Team3\PayU\ValidatorBuilder\ValidatorBuilderInterface
  1 <?php
  2 /**
  3  * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
  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  * Class RefundModel
 13  * @package Team3\PayU\Communication\Request
 14  * @JMS\AccessorOrder("alphabetical")
 15  * @JMS\AccessType("public_method")
 16  */
 17 class RefundModel implements RefundModelInterface
 18 {
 19     /**
 20      * @var string
 21      * @JMS\Type("string")
 22      */
 23     private $description;
 24 
 25     /**
 26      * @var string
 27      * @JMS\Type("string")
 28      */
 29     private $bankDescription;
 30 
 31     /**
 32      * @var MoneyInterface|null
 33      * @JMS\Type("integer")
 34      * @JMS\Accessor(
 35      *     getter="getAmountForSerialization",
 36      *     setter="setAmountFromDeserialization"
 37      * )
 38      */
 39     private $amount;
 40 
 41     /**
 42      * @param string              $description
 43      * @param string|null         $bankDescription
 44      * @param MoneyInterface|null $amount
 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      * @return string
 58      */
 59     public function getDescription()
 60     {
 61         return $this->description;
 62     }
 63 
 64     /**
 65      * @param string $description
 66      *
 67      * @return RefundModelInterface
 68      */
 69     public function setDescription($description)
 70     {
 71         $this->description = $description;
 72 
 73         return $this;
 74     }
 75 
 76     /**
 77      * @return string|null
 78      */
 79     public function getBankDescription()
 80     {
 81         return $this->bankDescription;
 82     }
 83 
 84     /**
 85      * @param string $bankDescription
 86      *
 87      * @return RefundModel
 88      */
 89     public function setBankDescription($bankDescription)
 90     {
 91         $this->bankDescription = $bankDescription;
 92 
 93         return $this;
 94     }
 95 
 96     /**
 97      * @return MoneyInterface|null
 98      */
 99     public function getAmount()
100     {
101         return $this->amount;
102     }
103 
104     /**
105      * @return int|null
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      * @param int $amount
118      *
119      * @return RefundModelInterface
120      */
121     public function setAmountFromDeserialization($amount)
122     {
123         $this->amount = new Money($amount / 100);
124 
125         return $this;
126     }
127 }
128 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen