1: <?php
2: /**
3: * Partner API Library
4: *
5: * @copyright Copyright (c) 2020 Asseco Data Systems SA
6: * @license license.txt
7: */
8:
9: require_once 'operation.php';
10: require_once 'certumPartnerAPI/messages/messageGetOrderState.php';
11: require_once 'certumPartnerAPI/messages/messageGetOrderStateResponse.php';
12:
13: /*
14: <operation name="getOrderState" parameterOrder="getOrderState">
15: <input message="tns:PartnerServicePortType_getOrderState">
16: </input>
17: <output message="tns:PartnerServicePortType_getOrderStateResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the getOrderState WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageGetOrderStateResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationGetOrderState extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageGetOrderState
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageGetOrderStateResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'getOrderState';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageGetOrderState();
55: $this->_output = new PartnerAPIMessageGetOrderStateResponse();
56: }
57:
58: /**
59: * Sets an order ID for the request.
60: *
61: * Setting this value is required.
62: *
63: * @param string $orderID
64: * @return PartnerAPIOperationGetOrderState
65: */
66: public function setOrderID($orderID) {
67: $this->_input->getOrderState->setOrderID($orderID);
68: return $this;
69: }
70:
71: /**
72: * Gets an order status returned in a response.
73: *
74: * @return string
75: */
76: public function getOrderStatus() {
77: return $this->_output->getOrderStateResponse->orderStatus;
78: }
79:
80: /**
81: * Gets last update date returned in a response.
82: *
83: * @return string
84: */
85: public function getLastUpdateDate() {
86: return $this->_output->getOrderStateResponse->lastUpdateDate;
87: }
88:
89: /**
90: * Returns orderVerifications contained in a response.
91: *
92: * This method always returns an array.
93: * If there is no order in the response an empty array is returned.
94: * Otherwise, an array with one or more orders is returned.
95: *
96: * @return PartnerAPITypeOrderVerification[]
97: */
98: public function getOrderVerifications() {
99: $orderVerificationsList = array();
100: $orderVerifications = $this->_output->getOrderStateResponse->verifications;
101: if (is_null($orderVerifications))
102: return $orderVerificationsList;
103: $verification = $orderVerifications->verification;
104: if (is_array($verification))
105: foreach ($verification as $o)
106: $orderVerificationsList[] = $o;
107: else
108: $orderVerificationsList[] = $verification;
109: return $orderVerificationsList;
110: }
111:
112: }
113: