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/messageValidateOrderParameters.php';
11: require_once 'certumPartnerAPI/messages/messageValidateOrderParametersResponse.php';
12:
13: /*
14: <operation name="validateOrderParameters" parameterOrder="validateOrderParameters">
15: <input message="tns:PartnerServicePortType_validateOrderParameters">
16: </input>
17: <output message="tns:PartnerServicePortType_validateOrderParametersResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the validateOrderParameters WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageValidateOrderParametersResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationValidateOrderParameters extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageValidateOrderParameters
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageValidateOrderParametersResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'validateOrderParameters';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageValidateOrderParameters();
55: $this->_output = new PartnerAPIMessageValidateOrderParametersResponse();
56: }
57:
58: /**
59: * Sets a CSR for the request.
60: *
61: * Setting this value is required.
62: *
63: * @param string $csr
64: * @return PartnerAPIOperationValidateOrderParameters
65: */
66: public function setCSR($csr) {
67: $this->_input->validateOrderParameters->orderParameters->setCSR($csr);
68: return $this;
69: }
70:
71: /**
72: * Sets a customer name.
73: *
74: * Setting this value is required.
75: *
76: * @param string $customer
77: * @return PartnerAPIOperationValidateOrderParameters
78: */
79: public function setCustomer($customer) {
80: $this->_input->validateOrderParameters->orderParameters->setCustomer($customer);
81: return $this;
82: }
83:
84: /**
85: * Sets a language to be used for e-mails.
86: *
87: * Default is 'pl'. Also acceptable are 'en' and 'ru'.
88: *
89: * @param string $lang
90: * @return PartnerAPIOperationValidateOrderParameters
91: */
92: public function setLanguage($lang) {
93: $this->_input->validateOrderParameters->orderParameters->setLanguage($lang);
94: return $this;
95: }
96:
97: /**
98: * Sets an order identificator.
99: *
100: * If not set it will be generated automatically by the system.
101: * This identificator have to be unique and it is used to refer to the request.
102: *
103: * @param string $id
104: * @return PartnerAPIOperationValidateOrderParameters
105: */
106: public function setOrderID($id) {
107: $this->_input->validateOrderParameters->orderParameters->setOrderID($id);
108: return $this;
109: }
110:
111: /**
112: * Sets a three-letter product code.
113: *
114: * Setting this value is required.
115: *
116: * @param string $code
117: * @return PartnerAPIOperationValidateOrderParameters
118: */
119: public function setProductCode($code) {
120: $this->_input->validateOrderParameters->orderParameters->setProductCode($code);
121: return $this;
122: }
123:
124: /**
125: * Sets a string identifying web browser and operating system.
126: *
127: * @param string $userAgent
128: * @return PartnerAPIOperationValidateOrderParameters
129: */
130: public function setUserAgent($userAgent) {
131: $this->_input->validateOrderParameters->orderParameters->setUserAgent($userAgent);
132: return $this;
133: }
134:
135: /**
136: * Sets a hash algorithm for a certificate.
137: *
138: * @param string $hashAlgorithm
139: * @return PartnerAPIOperationValidateOrderParameters
140: */
141: public function setHashAlgorithm($hashAlgorithm) {
142: $this->_input->validateOrderParameters->orderParameters->setHashAlgorithm($hashAlgorithm);
143: return $this;
144: }
145:
146: /**
147: * Sets an email for a SSL certificate.
148: *
149: * @param string $email
150: * @return PartnerAPIOperationValidateOrderParameters
151: */
152: public function setEmail($email) {
153: $this->_input->validateOrderParameters->orderParameters->setEmail($email);
154: return $this;
155: }
156:
157: /**
158: * Sets all the contact data of a requestor.
159: *
160: * All arguments are required apart from the last which can be NULL.
161: *
162: * @param string $firstName
163: * @param string $lastName
164: * @param string $email
165: * @param string $phone
166: * @return PartnerAPIOperationValidateOrderParameters
167: */
168: public function setRequestorInfo($firstName, $lastName, $email, $phone) {
169: $ri = $this->_input->validateOrderParameters->requestorInfo;
170: $ri->setFirstName($firstName)->setLastName($lastName)
171: ->setEmail($email)->setPhone($phone);
172: return $this;
173: }
174:
175: /**
176: * Sets an organization information.
177: *
178: * It is not required to set organization information but if you need or have to set it
179: * all the arguments are required.
180: *
181: * @param string $taxNumber The tax identification number
182: * @return PartnerAPIOperationValidateOrderParameters
183: */
184: public function setOrganizationInfo($name, $taxNumber) {
185: $oi = new PartnerAPITypeOrganizationInfo();
186: $oi->setTaxIdentificationNumber($taxNumber);
187: $this->_input->validateOrderParameters->setOrganizationInfo($oi);
188: return $this;
189: }
190:
191:
192: /**
193: * Sets an overrided CSR commonName.
194: *
195: * It is not required to set this but if you need to override a commonName from CSR
196: * then you have to change this as same as SAN entries and approvers.
197: *
198: * @param string $commonName The commonName to override CN given in CSR
199: * @return PartnerAPIOperationValidateOrderParameters
200: */
201: public function setCommonName($commonName) {
202: $this->_input->validateOrderParameters->orderParameters->setCommonName($commonName);
203: return $this;
204: }
205:
206: /**
207: * Sets an overrided CSR organization.
208: *
209: * It is not required to set this but if you need to override a organization from CSR
210: * use this method.
211: *
212: * @param string $organization The organization to override O given in CSR
213: * @return PartnerAPIOperationValidateOrderParameters
214: */
215: public function setOrganization($organization) {
216: $this->_input->validateOrderParameters->orderParameters->setOrganization($organization);
217: return $this;
218: }
219:
220: /**
221: * Sets an overrided CSR organizational unit.
222: *
223: * It is not required to set this but if you need to override a organizational unit from CSR
224: * use this method.
225: *
226: * @param string $organizationalUnit The Organizational Unit to override OU given in CSR
227: * @return PartnerAPIOperationValidateOrderParameters
228: */
229: public function setOrganizationalUnit($organizationalUnit) {
230: $this->_input->validateOrderParameters->orderParameters->setOrganizationalUnit($organizationalUnit);
231: return $this;
232: }
233:
234: /**
235: * Sets an overrided CSR locality.
236: *
237: * It is not required to set this but if you need to override a locality from CSR
238: * use this method.
239: *
240: * @param string $locality The locality to override L given in CSR
241: * @return PartnerAPIOperationValidateOrderParameters
242: */
243: public function setLocality($locality) {
244: $this->_input->validateOrderParameters->orderParameters->setLocality($locality);
245: return $this;
246: }
247:
248: /**
249: * Sets an overrided CSR country.
250: *
251: * It is not required to set this but if you need to override a country from CSR
252: * use this method.
253: *
254: * @param string $country The country to override C given in CSR
255: * @return PartnerAPIOperationValidateOrderParameters
256: */
257: public function setCountry($country) {
258: $this->_input->validateOrderParameters->orderParameters->setCountry($country);
259: return $this;
260: }
261:
262: /**
263: * Sets an overrided CSR state.
264: *
265: * It is not required to set this but if you need to override a state from CSR
266: * use this method.
267: *
268: * @param string $state The state to override state given in CSR
269: * @return PartnerAPIOperationValidateOrderParameters
270: */
271: public function setState($state) {
272: $this->_input->validateOrderParameters->orderParameters->setState($state);
273: return $this;
274: }
275:
276: /**
277: * Sets an overrided CSR serialNumber.
278: *
279: * It is not required to set this but if you need to override a serialNumber from CSR
280: * use this method.
281: *
282: * @param string $serialNumber The serialNumber to override serialNumber given in CSR
283: * @return PartnerAPIOperationValidateOrderParameters
284: */
285: public function setSerialNumber($serialNumber) {
286: $this->_input->validateOrderParameters->orderParameters->setSerialNumber($serialNumber);
287: return $this;
288: }
289:
290: /**
291: * Sets an overrided CSR businessCategory.
292: *
293: * It is not required to set this but if you need to override a businessCategory from CSR
294: * use this method.
295: *
296: * @param string $businessCategory The businessCategory to override businessCategory given in CSR
297: * @return PartnerAPIOperationValidateOrderParameters
298: */
299: public function setBusinessCategory($businessCategory) {
300: $this->_input->validateOrderParameters->orderParameters->setBusinessCategory($businessCategory);
301: return $this;
302: }
303:
304: /**
305: * Sets an overrided CSR streetAddress.
306: *
307: * It is not required to set this but if you need to override a streetAddress from CSR
308: * use this method.
309: *
310: * @param string $streetAddress The streetAddress to override streetAddress given in CSR
311: * @return PartnerAPIOperationValidateOrderParameters
312: */
313: public function setStreetAddress($streetAddress) {
314: $this->_input->validateOrderParameters->orderParameters->setStreetAddress($streetAddress);
315: return $this;
316: }
317:
318: /**
319: * Sets an overrided CSR postalCode.
320: *
321: * It is not required to set this but if you need to override a postalCode from CSR
322: * use this method.
323: *
324: * @param string $postalCode The postalCode to override postalCode given in CSR
325: * @return PartnerAPIOperationValidateOrderParameters
326: */
327: public function setPostalCode($postalCode) {
328: $this->_input->validateOrderParameters->orderParameters->setPostalCode($postalCode);
329: return $this;
330: }
331:
332: /**
333: * Sets an overrided CSR joiln.
334: *
335: * It is not required to set this but if you need to override a joiln from CSR
336: * use this method.
337: *
338: * @param string $joiln The joiln to override joiln given in CSR
339: * @return PartnerAPIOperationValidateOrderParameters
340: */
341: public function setJoiln($joiln) {
342: $this->_input->validateOrderParameters->orderParameters->setJoiln($joiln);
343: return $this;
344: }
345:
346: /**
347: * Sets an overrided CSR joisopn.
348: *
349: * It is not required to set this but if you need to override a joisopn from CSR
350: * use this method.
351: *
352: * @param string $joisopn The joisopn to override joisopn given in CSR
353: * @return PartnerAPIOperationValidateOrderParameters
354: */
355: public function setJoisopn($joisopn) {
356: $this->_input->validateOrderParameters->orderParameters->setJoisopn($joisopn);
357: return $this;
358: }
359:
360: /**
361: * Sets an overrided CSR joisocn.
362: *
363: * It is not required to set this but if you need to override a joisocn from CSR
364: * use this method.
365: *
366: * @param string $joisocn The joisocn to override joisocn given in CSR
367: * @return PartnerAPIOperationValidateOrderParameters
368: */
369: public function setJoisocn($joisocn) {
370: $this->_input->validateOrderParameters->orderParameters->setJoisocn($joisocn);
371: return $this;
372: }
373:
374: /**
375: * Adds a domain name as a SAN entry in a certificate.
376: *
377: * SAN entries are optional.
378: * If given, the $domain argument must be a correct domain name or an array
379: * of such domain names.
380: *
381: * @param string|string[] $domain
382: * @return PartnerAPIOperationValidateOrderParameters
383: */
384: public function addSANEntry($domain) {
385: if (! is_array($domain))
386: $domain = array($domain);
387: $SANEntries = $this->_input->validateOrderParameters->SANEntries;
388: if (is_null($SANEntries)) {
389: $SANEntries = new PartnerAPITypeSanEntries();
390: $this->_input->validateOrderParameters->setSANEntries($SANEntries);
391: }
392: foreach ($domain as $d) {
393: $san = new PartnerAPITypeSanEntry();
394: $san->setDNSName($d);
395: $SANEntries->addSANEntry($san);
396: }
397: return $this;
398: }
399:
400: /**
401: * Sets the approverMethod option for SANApprover.
402: *
403: * This option determines which approve method will be used for domain verification.
404: *
405: * @param string $approverMethod
406: * @return PartnerAPIOperationValidateOrderParameters
407: */
408: public function setApproverMethod($approverMethod) {
409: $approver = $this->_input->validateOrderParameters->SANApprover;
410: if (is_null($approver)) {
411: $approver = new PartnerAPITypeSanApprover();
412: $this->_input->validateOrderParameters->setSANApprover($approver);
413: }
414: $approver->setApproverMethod($approverMethod);
415: return $this;
416: }
417:
418: /**
419: * Sets the approverEmail option for SANApprover.
420: *
421: * This option determines where will be sent e-mail with instructions for FILE or DNS approve method.
422: * This method cannot be used with EMAIL approve method.
423: *
424: * @param string $approverEmail
425: * @return PartnerAPIOperationValidateOrderParameters
426: */
427: public function setApproverEmail($approverEmail) {
428: $approver = $this->_input->validateOrderParameters->SANApprover;
429: if (is_null($approver)) {
430: $approver = new PartnerAPITypeSanApprover();
431: $this->_input->validateOrderParameters->setSANApprover($approver);
432: }
433: $approver->setApproverEmail($approverEmail);
434: return $this;
435: }
436:
437: /**
438: * Sets the approverEmailPrefix option for SANApprover.
439: *
440: * This option determines which e-mail prefix will be used for EMAIL approve method.
441: * This method cannot be used with FILE or DNS approve method.
442: *
443: * @param string $approverEmailPrefix
444: * @return PartnerAPIOperationValidateOrderParameters
445: */
446: public function setApproverEmailPrefix($approverEmailPrefix) {
447: $approver = $this->_input->validateOrderParameters->SANApprover;
448: if (is_null($approver)) {
449: $approver = new PartnerAPITypeSanApprover();
450: $this->_input->validateOrderParameters->setSANApprover($approver);
451: }
452: $approver->setApproverEmailPrefix($approverEmailPrefix);
453: return $this;
454: }
455:
456:
457: /**
458: * Sets the verificationNotificationEnabled option for SANApprover.
459: *
460: * This option determines if verification e-mails for all approvers will be sent or not.
461: *
462: * @param boolean $yes_or_no
463: * @return PartnerAPIOperationValidateOrderParameters
464: */
465: public function setVerificationNotificationEnabled($yes_or_no) {
466: $approver = $this->_input->validateOrderParameters->SANApprover;
467: if (is_null($approver)) {
468: $approver = new PartnerAPITypeSanApprover();
469: $this->_input->validateOrderParameters->setSANApprover($approver);
470: }
471: $approver->setVerificationNotificationEnabled($yes_or_no);
472: return $this;
473: }
474:
475: /**
476: * Gets parsed CSR returned as a response.
477: *
478: * The returned value can be an object of PartnerAPITypeParsedCsr class
479: * or null.
480: *
481: * @return PartnerAPITypeParsedCsr
482: */
483: public function getParsedCSR() {
484: return $this->_output->validateOrderParametersResponse->ParsedCSR;
485: }
486:
487: /**
488: * Prepares an object representing the quick order operation.
489: *
490: * This method is intended to improve coding and to avoid passing the same data twice.
491: * A new object of type PartnerAPIOperationQuickOrder is created
492: * and set up with the data set for validation in
493: * the PartnerAPIOperationValidateOrderParameters object.
494: * It means, all the data which have been set are copied to a new
495: * quick order object.
496: *
497: * @return PartnerAPIOperationQuickOrder
498: */
499: public function prepareQuickOrderOperation() {
500: require_once 'certumPartnerAPI/operations/operationQuickOrder.php';
501: $op = new PartnerAPIOperationQuickOrder();
502: $op->setService($this->_service);
503: $p = $this->_input->validateOrderParameters->orderParameters;
504: $op->setCSR($p->CSR)->setCustomer($p->customer)->setLanguage($p->language)
505: ->setOrderID($p->orderID)->setUserAgent($p->userAgent)->setProductCode($p->productCode);
506: $r = $this->_input->validateOrderParameters->requestorInfo;
507: $op->setRequestorInfo($r->firstName, $r->lastName, $r->email, $r->phone);
508: $o = $this->_input->validateOrderParameters->organizationInfo;
509: if (! is_null($o))
510: $op->setOrganizationInfo($o->taxIdentificationNumber);
511: $a = $this->_input->validateOrderParameters->SANApprover;
512: if (!is_null($a)) {
513: $op->setApproverMethod($a->approverMethod);
514: $op->setApproverEmail($a->approverEmail);
515: $op->setApproverEmailPrefix($a->approverEmailPrefix);
516: $op->setVerificationNotificationEnabled($a->verificationNotificationEnabled);
517: }
518: $s = $this->_input->validateOrderParameters->SANEntries;
519: if (! is_null($s)) {
520: if (is_array($s->SANEntry))
521: foreach ($s->SANEntry as $san)
522: $op->addSANEntry($san->DNSName);
523: else
524: $op->addSANEntry($s->SANEntry->DNSName);
525: }
526: return $op;
527: }
528: }
529: