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/messageReissueCertificate.php';
11: require_once 'certumPartnerAPI/messages/messageReissueCertificateResponse.php';
12:
13: /*
14: <operation name="reissueCertificate" parameterOrder="reissueCertificate">
15: <input message="tns:PartnerServicePortType_reissueCertificate">
16: </input>
17: <output message="tns:PartnerServicePortType_reissueCertificateResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the reissueCertificate WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageReissueCertificateResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationReissueCertificate extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageReissueCertificate
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageReissueCertificateResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'reissueCertificate';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageReissueCertificate();
55: $this->_output = new PartnerAPIMessageReissueCertificateResponse();
56: }
57:
58: /**
59: * Sets a serial number for the request.
60: *
61: * Setting this value is optional. However, either a serial number or a certificate in PEM format has to be set.
62: *
63: * @param string $serialNumber
64: * @return PartnerAPIOperationReissueCertificate
65: */
66: public function setSerialNumber($serialNumber) {
67: $this->_input->reissueCertificate->setSerialNumber($serialNumber);
68: return $this;
69: }
70:
71: /**
72: * Sets a certificate in PEM format for the request.
73: *
74: * Setting this value is optional. However, either a serial number or a certificate in PEM format has to be set.
75: *
76: * @param string $X509Cert
77: * @return PartnerAPIOperationReissueCertificate
78: */
79: public function setX509Cert($X509Cert) {
80: $this->_input->reissueCertificate->setX509Cert($X509Cert);
81: return $this;
82: }
83:
84: /**
85: * Sets a hash algorithm for the request.
86: *
87: * Setting this value is optional.
88: *
89: * @param string $hashAlgorithm
90: * @return PartnerAPIOperationReissueCertificate
91: */
92: public function setHashAlgorithm($hashAlgorithm) {
93: $this->_input->reissueCertificate->setHashAlgorithm($hashAlgorithm);
94: return $this;
95: }
96:
97: /**
98: * Sets a CSR for the request.
99: *
100: * Setting this value is optional.
101: *
102: * @param string $CSR
103: * @return PartnerAPIOperationReissueCertificate
104: */
105: public function setCSR($CSR) {
106: $this->_input->reissueCertificate->setCSR($CSR);
107: return $this;
108: }
109:
110: /**
111: * Adds a domain name as a SAN entry in a certificate.
112: *
113: * SAN entries are optional.
114: * If given, the $domain argument must be a correct domain name or an array
115: * of such domain names.
116: *
117: * @param string|string[] $domain
118: * @return PartnerAPIOperationReissueCertificate
119: */
120: public function addSANEntry($domain) {
121: if (!is_array($domain))
122: $domain = array($domain);
123: $SANEntries = $this->_input->reissueCertificate->SANEntries;
124: if (is_null($SANEntries)) {
125: $SANEntries = new PartnerAPITypeSanEntries();
126: $this->_input->reissueCertificate->setSANEntries($SANEntries);
127: }
128: foreach ($domain as $d) {
129: $san = new PartnerAPITypeSanEntry();
130: $san->setDNSName($d);
131: $SANEntries->addSANEntry($san);
132: }
133: return $this;
134: }
135:
136: /**
137: * Sets the approverMethod option for SANApprover.
138: *
139: * This option determines which approve method will be used for domain verification.
140: *
141: * @param string $approverMethod
142: * @return PartnerAPIOperationReissueCertificate
143: */
144: public function setApproverMethod($approverMethod) {
145: $approver = $this->_input->reissueCertificate->SANApprover;
146: if (is_null($approver)) {
147: $approver = new PartnerAPITypeSanApprover();
148: $this->_input->reissueCertificate->setSANApprover($approver);
149: }
150: $approver->setApproverMethod($approverMethod);
151: return $this;
152: }
153:
154: /**
155: * Sets the approverEmail option for SANApprover.
156: *
157: * This option determines where will be sent e-mail with instructions for FILE or DNS approve method.
158: * This method cannot be used with EMAIL approve method.
159: *
160: * @param string $approverEmail
161: * @return PartnerAPIOperationReissueCertificate
162: */
163: public function setApproverEmail($approverEmail) {
164: $approver = $this->_input->reissueCertificate->SANApprover;
165: if (is_null($approver)) {
166: $approver = new PartnerAPITypeSanApprover();
167: $this->_input->reissueCertificate->setSANApprover($approver);
168: }
169: $approver->setApproverEmail($approverEmail);
170: return $this;
171: }
172:
173: /**
174: * Sets the approverEmailPrefix option for SANApprover.
175: *
176: * This option determines which e-mail prefix will be used for EMAIL approve method.
177: * This method cannot be used with FILE or DNS approve method.
178: *
179: * @param string $approverEmailPrefix
180: * @return PartnerAPIOperationReissueCertificate
181: */
182: public function setApproverEmailPrefix($approverEmailPrefix) {
183: $approver = $this->_input->reissueCertificate->SANApprover;
184: if (is_null($approver)) {
185: $approver = new PartnerAPITypeSanApprover();
186: $this->_input->reissueCertificate->setSANApprover($approver);
187: }
188: $approver->setApproverEmailPrefix($approverEmailPrefix);
189: return $this;
190: }
191:
192: /**
193: * Sets the verificationNotificationEnabled option for SANApprover.
194: *
195: * This option determines if verification e-mails for all approvers will be sent or not.
196: *
197: * @param boolean $yes_or_no
198: * @return PartnerAPIOperationReissueCertificate
199: */
200: public function setVerificationNotificationEnabled($yes_or_no) {
201: $approver = $this->_input->reissueCertificate->SANApprover;
202: if (is_null($approver)) {
203: $approver = new PartnerAPITypeSanApprover();
204: $this->_input->reissueCertificate->setSANApprover($approver);
205: }
206: $approver->setVerificationNotificationEnabled($yes_or_no);
207: return $this;
208: }
209:
210: /**
211: * Sets the userAgent for the request
212: *
213: * @param string $userAgent
214: * @return PartnerAPIOperationReissueCertificate
215: */
216: public function setUserAgent($userAgent) {
217: $this->_input->reissueCertificate->setUserAgent($userAgent);
218: return $this;
219: }
220:
221: /**
222: * Returns an order ID contained in a response.
223: *
224: * @return string
225: */
226: public function getOrderID() {
227: return $this->_output->reissueCertificateResponse->orderID;
228: }
229:
230: /**
231: * Returns SANVerification entity containing verification data from a response.
232: *
233: * If there is no verification in the response a NULL is returned.
234: *
235: * @return PartnerAPITypeSanVerification
236: */
237: public function getSANVerification() {
238: return $this->_output->reissueCertificateResponse->SANVerification;
239: }
240:
241: }
242: