1
|
|
|
<?php |
2
|
|
|
namespace Loevgaard\AltaPay\Response\Partial\Transaction; |
3
|
|
|
|
4
|
|
|
use Loevgaard\AltaPay\Response\Partial\PartialResponse; |
5
|
|
|
use Loevgaard\AltaPay\Response\Partial\Transaction\CustomerInfo\BillingAddress; |
6
|
|
|
use Loevgaard\AltaPay\Response\Partial\Transaction\CustomerInfo\CountryOfOrigin; |
7
|
|
|
|
8
|
|
|
class CustomerInfo extends PartialResponse |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var string |
12
|
|
|
*/ |
13
|
|
|
private $userAgent; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string |
17
|
|
|
*/ |
18
|
|
|
private $ipAddress; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $email; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $username; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
private $customerPhone; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
private $organisationNumber; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var CountryOfOrigin |
42
|
|
|
*/ |
43
|
|
|
private $countryOfOrigin; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var BillingAddress |
47
|
|
|
*/ |
48
|
|
|
private $billingAddress; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
private $shippingAddress; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
private $registeredAddress; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function getUserAgent() : string |
64
|
|
|
{ |
65
|
|
|
return $this->userAgent; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return string |
70
|
|
|
*/ |
71
|
|
|
public function getIpAddress() : string |
72
|
|
|
{ |
73
|
|
|
return $this->ipAddress; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getEmail() : string |
80
|
|
|
{ |
81
|
|
|
return $this->email; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return string |
86
|
|
|
*/ |
87
|
|
|
public function getUsername() : string |
88
|
|
|
{ |
89
|
|
|
return $this->username; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string |
94
|
|
|
*/ |
95
|
|
|
public function getCustomerPhone() : string |
96
|
|
|
{ |
97
|
|
|
return $this->customerPhone; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function getOrganisationNumber() : string |
104
|
|
|
{ |
105
|
|
|
return $this->organisationNumber; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @return CountryOfOrigin |
110
|
|
|
*/ |
111
|
|
|
public function getCountryOfOrigin() : CountryOfOrigin |
112
|
|
|
{ |
113
|
|
|
return $this->countryOfOrigin; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @return BillingAddress |
118
|
|
|
*/ |
119
|
|
|
public function getBillingAddress() : BillingAddress |
120
|
|
|
{ |
121
|
|
|
return $this->billingAddress; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public function getShippingAddress() : string |
128
|
|
|
{ |
129
|
|
|
return $this->shippingAddress; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @return string |
134
|
|
|
*/ |
135
|
|
|
public function getRegisteredAddress() : string |
136
|
|
|
{ |
137
|
|
|
return $this->registeredAddress; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
protected function init() |
141
|
|
|
{ |
142
|
|
|
$this->userAgent = (string)$this->xmlDoc->UserAgent; |
143
|
|
|
$this->ipAddress = (string)$this->xmlDoc->IpAddress; |
144
|
|
|
$this->email = (string)$this->xmlDoc->Email; |
145
|
|
|
$this->username = (string)$this->xmlDoc->Username; |
146
|
|
|
$this->customerPhone = (string)$this->xmlDoc->CustomerPhone; |
147
|
|
|
$this->organisationNumber = (string)$this->xmlDoc->OrganisationNumber; |
148
|
|
|
|
149
|
|
|
// @todo these two properties should probably have their own objects, |
150
|
|
|
// but I am awaiting a response from Altapay regarding the possible contents of these |
151
|
|
|
// since the documentation does not say anything about it: |
152
|
|
|
// https://testgateway.altapaysecure.com/merchant/help/Merchant_API#API_captureReservation |
153
|
|
|
$this->shippingAddress = (string)$this->xmlDoc->ShippingAddress; |
154
|
|
|
$this->registeredAddress = (string)$this->xmlDoc->RegisteredAddress; |
155
|
|
|
|
156
|
|
|
// populating country of origin object |
157
|
|
|
$this->countryOfOrigin = new CountryOfOrigin($this->getOriginalResponse(), $this->xmlDoc->CountryOfOrigin); |
158
|
|
|
|
159
|
|
|
// populating billing address object |
160
|
|
|
$this->billingAddress = new BillingAddress($this->getOriginalResponse(), $this->xmlDoc->BillingAddress); |
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|