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/messageGetOrderByOrderID.php';
11: require_once 'certumPartnerAPI/messages/messageGetOrderByOrderIDResponse.php';
12:
13: /*
14: <operation name="getOrderByOrderID" parameterOrder="getOrderByOrderID">
15: <input message="tns:PartnerServicePortType_getOrderByOrderID">
16: </input>
17: <output message="tns:PartnerServicePortType_getOrderByOrderIDResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the getOrderByOrderID WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageGetOrderByOrderIDResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationGetOrderByOrderID extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageGetOrderByOrderID
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageGetOrderByOrderIDResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'getOrderByOrderID';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageGetOrderByOrderID();
55: $this->_output = new PartnerAPIMessageGetOrderByOrderIDResponse();
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 PartnerAPIOperationGetOrderByOrderID
65: */
66: public function setOrderID($orderID) {
67: $this->_input->getOrderByOrderID->setOrderID($orderID);
68: return $this;
69: }
70:
71: /**
72: * Sets the 'certificateDetails' option for a request.
73: *
74: * Setting this value is optional.
75: *
76: * @param bool $value
77: * @return PartnerAPIOperationGetOrderByOrderID
78: */
79: public function setCertificateDetails($value = FALSE) {
80: $o = $this->_input->getOrderByOrderID->orderOption;
81: if (is_null($o)) {
82: $o = new PartnerAPITypeOrderOption ();
83: $this->_input->getOrderByOrderID->setOrderOption($o);
84: }
85: $o->setCertificateDetails($value);
86: return $this;
87: }
88:
89: /**
90: * Sets the 'orderDetails' option for a request.
91: *
92: * Setting this value is optional.
93: *
94: * @param bool $value
95: * @return PartnerAPIOperationGetOrderByOrderID
96: */
97: public function setOrderDetails($value = FALSE) {
98: $o = $this->_input->getOrderByOrderID->orderOption;
99: if (is_null($o)) {
100: $o = new PartnerAPITypeOrderOption ();
101: $this->_input->getOrderByOrderID->setOrderOption($o);
102: }
103: $o->setOrderDetails($value);
104: return $this;
105: }
106:
107: /**
108: * Sets the 'orderStatus' option for a request.
109: *
110: * Setting this value is optional.
111: *
112: * @param bool $value
113: * @return PartnerAPIOperationGetOrderByOrderID
114: */
115: public function setOrderStatus($value = FALSE) {
116: $o = $this->_input->getOrderByOrderID->orderOption;
117: if (is_null($o)) {
118: $o = new PartnerAPITypeOrderOption ();
119: $this->_input->getOrderByOrderID->setOrderOption($o);
120: }
121: $o->setOrderStatus($value);
122: return $this;
123: }
124:
125: /**
126: * Returns orders contained in a response.
127: *
128: * This method always returns an array.
129: * If there is no order in the response an empty array is returned.
130: * Otherwise, an array with one or more orders is returned.
131: *
132: * @return PartnerAPITypeOrder[]
133: */
134: public function getOrders() {
135: $orderList = array();
136: $orders = $this->_output->getOrderByOrderIDResponse->orders;
137: if (is_null($orders))
138: return $orderList;
139: $order = $orders->Order;
140: if (is_array($order))
141: foreach ($order as $o)
142: $orderList[] = $o;
143: else
144: $orderList[] = $order;
145: return $orderList;
146: }
147:
148: }
149: