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\Order\Model\ShippingMethods;
  6 
  7 use Team3\PayU\Order\Model\IsFilledTrait;
  8 use Team3\PayU\Order\Model\Money\Money;
  9 use Team3\PayU\Order\Model\Money\MoneyInterface;
 10 use JMS\Serializer\Annotation as JMS;
 11 use Symfony\Component\Validator\Constraints as Assert;
 12 
 13 /**
 14  * Class ShippingMethod
 15  * @package Team3\PayU\Order\Model\ShippingMethods
 16  * @JMS\AccessorOrder("alphabetical")
 17  */
 18 class ShippingMethod implements ShippingMethodInterface
 19 {
 20     use IsFilledTrait;
 21 
 22     /**
 23      * @var string
 24      * @JMS\Type("string")
 25      * @Assert\Country()
 26      * @Assert\NotBlank()
 27      */
 28     protected $country;
 29 
 30     /**
 31      * @var MoneyInterface
 32      * @JMS\Accessor(
 33      *                     getter="getPriceForSerialization",
 34      *                     setter="setPriceFromDeserialization"
 35      *                     )
 36      * @JMS\Type("integer")
 37      * @Assert\Type(type="object")
 38      * @Assert\Valid
 39      */
 40     protected $price;
 41 
 42     /**
 43      * @var string
 44      * @JMS\Type("string")
 45      * @Assert\NotNull
 46      */
 47     protected $name;
 48 
 49     /**
 50      * @return string
 51      */
 52     public function getCountry()
 53     {
 54         return $this->country;
 55     }
 56 
 57     /**
 58      * @param string $country
 59      *
 60      * @return ShippingMethod
 61      */
 62     public function setCountry($country)
 63     {
 64         $this->country = $country;
 65 
 66         return $this;
 67     }
 68 
 69     /**
 70      * @return string
 71      */
 72     public function getName()
 73     {
 74         return $this->name;
 75     }
 76 
 77     /**
 78      * @param string $name
 79      *
 80      * @return ShippingMethod
 81      */
 82     public function setName($name)
 83     {
 84         $this->name = $name;
 85 
 86         return $this;
 87     }
 88 
 89     /**
 90      * @return MoneyInterface
 91      */
 92     public function getPrice()
 93     {
 94         return $this->price;
 95     }
 96 
 97     /**
 98      * @return int
 99      */
100     public function getPriceForSerialization()
101     {
102         return $this->price->getValueWithoutSeparation(2);
103     }
104 
105     /**
106      * @param MoneyInterface $price
107      *
108      * @return ShippingMethod
109      */
110     public function setPrice(MoneyInterface $price)
111     {
112         $this->price = $price;
113 
114         return $this;
115     }
116 
117     /**
118      * @param int $price
119      *
120      * @return $this
121      */
122     public function setPriceFromDeserialization($price)
123     {
124         $this->price = new Money($price / 100);
125 
126         return $this;
127     }
128 }
129 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen