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
|
8 |
|
public function __construct(DocRefundProcessRefundOptions $options) |
76
|
|
|
{ |
77
|
8 |
|
if (!empty($options->statusIndicators)) { |
78
|
2 |
|
$this->actionDetails = new ActionDetails($options->statusIndicators); |
79
|
2 |
|
} |
80
|
|
|
|
81
|
8 |
|
if ($this->checkAnyNotEmpty($options->printer, $options->printerType)) { |
82
|
1 |
|
$this->printerReference = new PrinterReference($options->printer, $options->printerType); |
83
|
1 |
|
} |
84
|
|
|
|
85
|
8 |
|
$this->loadRefundedItinerary($options->refundedItinerary); |
86
|
|
|
|
87
|
8 |
|
$this->loadEmailFax( |
88
|
8 |
|
$options->refundNoticesEmailAddresses, |
89
|
8 |
|
$options->refundNoticesFaxes, |
90
|
8 |
|
$options->sendNotificationToEmailInAPE, |
91
|
8 |
|
$options->sendNotificationToFaxInAPF |
92
|
8 |
|
); |
93
|
8 |
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param RefundItinOpt[] $refundedItinerary |
97
|
|
|
*/ |
98
|
8 |
|
protected function loadRefundedItinerary($refundedItinerary) |
99
|
|
|
{ |
100
|
8 |
|
foreach ($refundedItinerary as $itin) { |
101
|
1 |
|
$this->refundedItinerary[] = new RefundedItinerary($itin); |
102
|
8 |
|
} |
103
|
8 |
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @param string[] $refundNoticesEmailAddresses |
107
|
|
|
* @param array $refundNoticesFaxes |
108
|
|
|
* @param bool $sendNotificationToEmailInAPE |
109
|
|
|
* @param bool $sendNotificationToFaxInAPF |
110
|
|
|
*/ |
111
|
8 |
|
protected function loadEmailFax( |
112
|
|
|
$refundNoticesEmailAddresses, |
113
|
|
|
$refundNoticesFaxes, |
114
|
|
|
$sendNotificationToEmailInAPE, |
115
|
|
|
$sendNotificationToFaxInAPF |
116
|
|
|
) { |
117
|
8 |
|
if ($sendNotificationToEmailInAPE) { |
118
|
1 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
119
|
|
|
PhoneFaxEmailAddress::TYPE_E_MAIL_ADDRESS_FROM_APE |
120
|
1 |
|
); |
121
|
1 |
|
} |
122
|
|
|
|
123
|
8 |
|
if ($sendNotificationToFaxInAPF) { |
124
|
1 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
125
|
|
|
PhoneFaxEmailAddress::TYPE_FAX_NUMBER_FROM_APF |
126
|
1 |
|
); |
127
|
1 |
|
} |
128
|
|
|
|
129
|
8 |
|
foreach ($refundNoticesEmailAddresses as $emailAddress) { |
130
|
1 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
131
|
1 |
|
PhoneFaxEmailAddress::TYPE_E_MAIL_ADDRESS, |
132
|
|
|
$emailAddress |
133
|
1 |
|
); |
134
|
8 |
|
} |
135
|
|
|
|
136
|
8 |
|
foreach ($refundNoticesFaxes as $number => $areaCode) { |
137
|
1 |
|
$this->phoneFaxEmailAddress[] = new PhoneFaxEmailAddress( |
138
|
1 |
|
PhoneFaxEmailAddress::TYPE_FAX_NUMBER, |
139
|
1 |
|
null, |
140
|
1 |
|
$number, |
141
|
|
|
$areaCode |
142
|
1 |
|
); |
143
|
8 |
|
} |
144
|
8 |
|
} |
145
|
|
|
} |
146
|
|
|
|