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\Response;
  6 
  7 use Team3\PayU\Communication\Request\OrderRetrieveRequest;
  8 use Team3\PayU\Communication\Request\PayURequestInterface;
  9 use Team3\PayU\Communication\Request\Model\RequestStatus;
 10 use Team3\PayU\Order\Model\OrderInterface;
 11 use JMS\Serializer\Annotation as JMS;
 12 
 13 /**
 14  * This class represents response from PayU when asked about order status.
 15  * It is related with {@link OrderRetrieveRequest}
 16  *
 17  * Class OrderRetrieveResponse
 18  * @package Team3\PayU\Communication\Response
 19  */
 20 class OrderRetrieveResponse implements ResponseInterface
 21 {
 22     /**
 23      * @var OrderInterface[]
 24      * @JMS\Type("array<Team3\PayU\Order\Model\Order>")
 25      * @JMS\SerializedName("orders")
 26      */
 27     private $orders;
 28 
 29     /**
 30      * @var RequestStatus
 31      * @JMS\Type("Team3\PayU\Communication\Request\Model\RequestStatus")
 32      * @JMS\SerializedName("status")
 33      */
 34     private $requestStatus;
 35 
 36     /**
 37      * @param PayURequestInterface $payURequest
 38      *
 39      * @return bool
 40      */
 41     public function supports(PayURequestInterface $payURequest)
 42     {
 43         return $payURequest instanceof OrderRetrieveRequest;
 44     }
 45 
 46     /**
 47      * @return OrderInterface[]
 48      */
 49     public function getOrders()
 50     {
 51         return $this->orders;
 52     }
 53 
 54     /**
 55      * @param OrderInterface[] $orders
 56      *
 57      * @return OrderRetrieveResponse
 58      */
 59     public function setOrders(array $orders)
 60     {
 61         $this->orders = $orders;
 62 
 63         return $this;
 64     }
 65 
 66     /**
 67      * @return RequestStatus
 68      */
 69     public function getRequestStatus()
 70     {
 71         return $this->requestStatus;
 72     }
 73 
 74     /**
 75      * @param RequestStatus $requestStatus
 76      *
 77      * @return OrderRetrieveResponse
 78      */
 79     public function setRequestStatus($requestStatus)
 80     {
 81         $this->requestStatus = $requestStatus;
 82 
 83         return $this;
 84     }
 85 
 86     /**
 87      * @return int
 88      */
 89     public function getOrdersCount()
 90     {
 91         return count($this->orders);
 92     }
 93 
 94     /**
 95      * @return OrderInterface
 96      * @throws NoOrdersInResponseException
 97      */
 98     public function getFirstOrder()
 99     {
100         if (0 === $this->getOrdersCount()) {
101             throw new NoOrdersInResponseException(
102                 'There is no order in OrderRetrieveResponse.'
103             );
104         }
105 
106         return $this->orders[0];
107     }
108 }
109 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen