|
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\Fop; |
|
24
|
|
|
|
|
25
|
|
|
use Amadeus\Client\RequestOptions\FopCreateFopOptions; |
|
26
|
|
|
use Amadeus\Client\Struct\BaseWsMessage; |
|
27
|
|
|
use Amadeus\Client\Struct\Fop\CreateFormOfPayment\BestEffort; |
|
28
|
|
|
use Amadeus\Client\Struct\Fop\CreateFormOfPayment\FopGroup14; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* FOP_CreateFormOfPayment message structure version 15 and up |
|
32
|
|
|
* |
|
33
|
|
|
* @package Amadeus\Client\Struct\Fop |
|
34
|
|
|
* @author Dieter Devlieghere <[email protected]> |
|
35
|
|
|
*/ |
|
36
|
|
|
class CreateFormOfPayment extends BaseWsMessage |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* @var TransactionContext |
|
40
|
|
|
*/ |
|
41
|
|
|
public $transactionContext; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var BestEffort[] |
|
45
|
|
|
*/ |
|
46
|
|
|
public $bestEffort = []; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var ReservationControlInformation |
|
50
|
|
|
*/ |
|
51
|
|
|
public $reservationControlInformation; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var FopGroup[] |
|
55
|
|
|
*/ |
|
56
|
|
|
public $fopGroup = []; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* FOP_CreateFormOfPayment constructor. |
|
60
|
|
|
* |
|
61
|
|
|
* @param FopCreateFopOptions $options |
|
62
|
|
|
*/ |
|
63
|
64 |
|
public function __construct(FopCreateFopOptions $options) |
|
64
|
|
|
{ |
|
65
|
64 |
|
if ($this->checkAnyNotEmpty($options->transactionCode, $options->obFeeCalculation)) { |
|
66
|
56 |
|
$this->transactionContext = new TransactionContext( |
|
67
|
56 |
|
$options->transactionCode, |
|
68
|
56 |
|
$options->obFeeCalculation |
|
69
|
28 |
|
); |
|
70
|
28 |
|
} |
|
71
|
|
|
|
|
72
|
64 |
|
if ($this->checkAllNotEmpty($options->bestEffortAction, $options->bestEffortIndicator)) { |
|
73
|
4 |
|
$this->bestEffort[] = new BestEffort($options->bestEffortIndicator, $options->bestEffortAction); |
|
74
|
2 |
|
} |
|
75
|
|
|
|
|
76
|
64 |
|
$this->loadFopGroup($options); |
|
77
|
64 |
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Load fopGroup |
|
81
|
|
|
* |
|
82
|
|
|
* @param FopCreateFopOptions $options |
|
83
|
|
|
*/ |
|
84
|
64 |
|
protected function loadFopGroup(FopCreateFopOptions $options) |
|
85
|
|
|
{ |
|
86
|
64 |
|
foreach ($options->fopGroup as $group) { |
|
87
|
64 |
|
if ($this instanceof CreateFormOfPayment14) { |
|
88
|
8 |
|
$this->fopGroup[] = new FopGroup14($group); |
|
89
|
4 |
|
} else { |
|
90
|
60 |
|
$this->fopGroup[] = new FopGroup($group); |
|
91
|
|
|
} |
|
92
|
32 |
|
} |
|
93
|
64 |
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|