Completed
Push — fopcreatefop ( a94315...34e835 )
by Dieter
16:06
created

PaymentData::__construct()   C

Complexity

Conditions 7
Paths 64

Size

Total Lines 29
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 24
CRAP Score 7

Importance

Changes 0
Metric Value
dl 0
loc 29
c 0
b 0
f 0
ccs 24
cts 24
cp 1
rs 6.7272
cc 7
eloc 15
nc 64
nop 6
crap 7
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\Fop\FraudScreeningOptions;
26
use Amadeus\Client\RequestOptions\Fop\InstallmentsInfo;
27
use Amadeus\Client\RequestOptions\Fop\PayId;
28
use Amadeus\Client\RequestOptions\Fop\Payment;
29
30
/**
31
 * PaymentData
32
 *
33
 * @package Amadeus\Client\Struct\Fop
34
 * @author Dieter Devlieghere <[email protected]>
35
 */
36
class PaymentData
37
{
38
    /**
39
     * @var MerchantInformation
40
     */
41
    public $merchantInformation;
42
43
    /**
44
     * @var MonetaryInformation[]
45
     */
46
    public $monetaryInformation = [];
47
48
    /**
49
     * @var CurrenciesRatesGroup[]
50
     */
51
    public $currenciesRatesGroup = [];
52
53
    /**
54
     * @var SliderConversion
55
     */
56
    public $sliderConversion;
57
58
    /**
59
     * @var PaymentId[]
60
     */
61
    public $paymentId = [];
62
63
    /**
64
     * @var ExtendedPaymentInfo
65
     */
66
    public $extendedPaymentInfo;
67
68
    /**
69
     * @var TransactionDateTime
70
     */
71
    public $transactionDateTime;
72
73
    /**
74
     * @var ExpirationPeriod
75
     */
76
    public $expirationPeriod;
77
78
    /**
79
     * @var DistributionChannelInformation
80
     */
81
    public $distributionChannelInformation;
82
83
    /**
84
     * @var PurchaseDescription
85
     */
86
    public $purchaseDescription;
87
88
    /**
89
     * @var Association[]
90
     */
91
    public $association = [];
92
93
    /**
94
     * @var FraudScreeningData
95
     */
96
    public $fraudScreeningData;
97
98
    /**
99
     * @var PaymentDataMap[]
100
     */
101
    public $paymentDataMap = [];
102
103
    /**
104
     * PaymentData constructor.
105
     *
106
     * @param string|null $payMerchant
107
     * @param \DateTime|null $transactionDate
108
     * @param Payment[] $payments
109
     * @param InstallmentsInfo|null $installmentsInfo
110
     * @param FraudScreeningOptions|null $fraudScreening
111
     * @param PayId[] $payIds
112
     */
113 10
    public function __construct($payMerchant, $transactionDate, $payments, $installmentsInfo, $fraudScreening, $payIds)
114 1
    {
115 10
        if (!empty($payMerchant)) {
116 10
            $this->merchantInformation = new MerchantInformation($payMerchant);
117 10
        }
118
119 10
        if (!empty($transactionDate)) {
120 1
            $this->transactionDateTime = new TransactionDateTime(null, $transactionDate);
121 1
        }
122
123 10
        if (!empty($payments)) {
124 5
            $this->monetaryInformation[] = new MonetaryInformation($payments);
125 5
        }
126
127 10
        if (!empty($installmentsInfo)) {
128 2
            $this->extendedPaymentInfo = new ExtendedPaymentInfo($installmentsInfo);
129 2
        }
130
131 10
        if (!empty($fraudScreening)) {
132 1
            $this->fraudScreeningData = new FraudScreeningData($fraudScreening);
133 1
        }
134
135 10
        foreach ($payIds as $payId) {
136 1
            $this->paymentId[] = new PaymentId(
137 1
                $payId->id,
138 1
                $payId->type
139 1
            );
140 10
        }
141 10
    }
142
}
143