|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* amadeus-ws-client |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright 2015 Amadeus Benelux NV |
|
6
|
|
|
* |
|
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
8
|
|
|
* you may not use this file except in compliance with the License. |
|
9
|
|
|
* You may obtain a copy of the License at |
|
10
|
|
|
* |
|
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
12
|
|
|
* |
|
13
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16
|
|
|
* See the License for the specific language governing permissions and |
|
17
|
|
|
* limitations under the License. |
|
18
|
|
|
* |
|
19
|
|
|
* @package Amadeus |
|
20
|
|
|
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace Amadeus\Client\Struct\DocRefund; |
|
24
|
|
|
|
|
25
|
|
|
use Amadeus\Client\RequestOptions\DocRefund\RefundItinOpt; |
|
26
|
|
|
use Amadeus\Client\RequestOptions\DocRefundProcessRefundOptions; |
|
27
|
|
|
use Amadeus\Client\Struct\BaseWsMessage; |
|
28
|
|
|
use Amadeus\Client\Struct\DocRefund\ProcessRefund\PhoneFaxEmailAddress; |
|
29
|
|
|
use Amadeus\Client\Struct\DocRefund\ProcessRefund\PrinterReference; |
|
30
|
|
|
use Amadeus\Client\Struct\DocRefund\UpdateRefund\RefundedItinerary; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* ProcessRefund |
|
34
|
|
|
* |
|
35
|
|
|
* @package Amadeus\Client\Struct\DocRefund |
|
36
|
|
|
* @author Dieter Devlieghere <[email protected]> |
|
37
|
|
|
*/ |
|
38
|
|
|
class ProcessRefund extends BaseWsMessage |
|
39
|
|
|
{ |
|
40
|
|
|
/** |
|
41
|
|
|
* @var ActionDetails |
|
42
|
|
|
*/ |
|
43
|
|
|
public $actionDetails; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var mixed |
|
47
|
|
|
*/ |
|
48
|
|
|
public $dummysegment; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var PrinterReference |
|
52
|
|
|
*/ |
|
53
|
|
|
public $printerReference; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @var mixed |
|
57
|
|
|
*/ |
|
58
|
|
|
public $targetStockProvider; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @var RefundedItinerary[] |
|
62
|
|
|
*/ |
|
63
|
|
|
public $refundedItinerary; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @var PhoneFaxEmailAddress[] |
|
67
|
|
|
*/ |
|
68
|
|
|
public $phoneFaxEmailAddress; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* ProcessRefund constructor. |
|
72
|
|
|
* |
|
73
|
|
|
* @param DocRefundProcessRefundOptions $options |
|
74
|
|
|
*/ |
|
75
|
40 |
|
public function __construct(DocRefundProcessRefundOptions $options) |
|
76
|
|
|
{ |
|
77
|
40 |
|
if (!empty($options->statusIndicators)) { |
|
78
|
10 |
|
$this->actionDetails = new ActionDetails($options->statusIndicators); |
|
79
|
4 |
|
} |
|
80
|
|
|
|
|
81
|
40 |
|
if ($this->checkAnyNotEmpty($options->printer, $options->printerType)) { |
|
82
|
5 |
|
$this->printerReference = new PrinterReference($options->printer, $options->printerType); |
|
83
|
2 |
|
} |
|
84
|
|
|
|
|
85
|
40 |
|
$this->loadRefundedItinerary($options->refundedItinerary); |
|
86
|
|
|
|
|
87
|
40 |
|
$this->loadEmailFax( |
|
88
|
40 |
|
$options->refundNoticesEmailAddresses, |
|
89
|
40 |
|
$options->refundNoticesFaxes, |
|
90
|
40 |
|
$options->sendNotificationToEmailInAPE, |
|
91
|
40 |
|
$options->sendNotificationToFaxInAPF |
|
92
|
16 |
|
); |
|
93
|
40 |
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @param RefundItinOpt[] $refundedItinerary |
|
97
|
|
|
*/ |
|
98
|
40 |
|
protected function loadRefundedItinerary($refundedItinerary) |
|
99
|
|
|
{ |
|
100
|
40 |
|
foreach ($refundedItinerary as $itin) { |
|
101
|
5 |
|
$this->refundedItinerary[] = new RefundedItinerary($itin); |
|
102
|
16 |
|
} |
|
103
|
40 |
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @param string[] $refundNoticesEmailAddresses |
|
107
|
|
|
* @param array $refundNoticesFaxes |
|
108
|
|
|
* @param bool $sendNotificationToEmailInAPE |
|
109
|
|
|
* @param bool $sendNotificationToFaxInAPF |
|
110
|
|
|
*/ |
|
111
|
40 |
|
protected function loadEmailFax( |
|
112
|
|
|
$refundNoticesEmailAddresses, |
|
113
|
|
|
$refundNoticesFaxes, |
|
114
|
|
|
$sendNotificationToEmailInAPE, |
|
115
|
|
|
$sendNotificationToFaxInAPF |
|
116
|
|
|
) { |
|
117
|
40 |
|
if ($sendNotificationToEmailInAPE) { |
|
118
|
5 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
|
119
|
3 |
|
PhoneFaxEmailAddress::TYPE_E_MAIL_ADDRESS_FROM_APE |
|
120
|
2 |
|
); |
|
121
|
2 |
|
} |
|
122
|
|
|
|
|
123
|
40 |
|
if ($sendNotificationToFaxInAPF) { |
|
124
|
5 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
|
125
|
3 |
|
PhoneFaxEmailAddress::TYPE_FAX_NUMBER_FROM_APF |
|
126
|
2 |
|
); |
|
127
|
2 |
|
} |
|
128
|
|
|
|
|
129
|
40 |
|
foreach ($refundNoticesEmailAddresses as $emailAddress) { |
|
130
|
5 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
|
131
|
5 |
|
PhoneFaxEmailAddress::TYPE_E_MAIL_ADDRESS, |
|
132
|
2 |
|
$emailAddress |
|
133
|
2 |
|
); |
|
134
|
16 |
|
} |
|
135
|
|
|
|
|
136
|
40 |
|
foreach ($refundNoticesFaxes as $number => $areaCode) { |
|
137
|
5 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
|
138
|
5 |
|
PhoneFaxEmailAddress::TYPE_FAX_NUMBER, |
|
139
|
5 |
|
null, |
|
140
|
4 |
|
$number, |
|
141
|
2 |
|
$areaCode |
|
142
|
2 |
|
); |
|
143
|
16 |
|
} |
|
144
|
40 |
|
} |
|
145
|
|
|
} |
|
146
|
|
|
|