|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare( strict_types = 1 ); |
|
4
|
|
|
|
|
5
|
|
|
namespace WMDE\Fundraising\Frontend\DonatingContext\UseCases\AddDonation; |
|
6
|
|
|
|
|
7
|
|
|
use WMDE\Euro\Euro; |
|
8
|
|
|
use WMDE\Fundraising\Frontend\Domain\Model\PersonName; |
|
9
|
|
|
use WMDE\Fundraising\Frontend\PaymentContext\Domain\Model\BankData; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @license GNU GPL v2+ |
|
13
|
|
|
* @author Kai Nissen < [email protected] > |
|
14
|
|
|
* @author Jeroen De Dauw < [email protected] > |
|
15
|
|
|
*/ |
|
16
|
|
|
class AddDonationRequest { |
|
17
|
|
|
|
|
18
|
|
|
private $donorType; |
|
19
|
|
|
private $donorFirstName; |
|
20
|
|
|
private $donorLastName; |
|
21
|
|
|
private $donorSalutation; |
|
22
|
|
|
private $donorTitle; |
|
23
|
|
|
private $donorCompany; |
|
24
|
|
|
private $donorStreetAddress; |
|
25
|
|
|
private $donorPostalCode; |
|
26
|
|
|
private $donorCity; |
|
27
|
|
|
private $donorCountryCode; |
|
28
|
|
|
private $donorEmailAddress; |
|
29
|
|
|
|
|
30
|
|
|
private $optIn = ''; |
|
31
|
|
|
|
|
32
|
|
|
# donation |
|
33
|
|
|
private $amount; |
|
34
|
|
|
private $paymentType = ''; |
|
35
|
|
|
private $interval = 0; |
|
36
|
|
|
|
|
37
|
|
|
# direct debit related |
|
38
|
|
|
private $bankData; |
|
39
|
|
|
|
|
40
|
|
|
# tracking |
|
41
|
|
|
private $tracking = ''; |
|
42
|
|
|
private $source = ''; # TODO: generated from referer |
|
43
|
|
|
private $totalImpressionCount = 0; |
|
44
|
|
|
private $singleBannerImpressionCount = 0; |
|
45
|
|
|
private $color = ''; # TODO: drop this? |
|
46
|
|
|
private $skin = ''; # TODO: drop this? |
|
47
|
|
|
private $layout = ''; # TODO: drop this? |
|
48
|
|
|
|
|
49
|
|
|
public function getOptIn(): string { |
|
50
|
|
|
return $this->optIn; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function setOptIn( string $optIn ) { |
|
54
|
|
|
$this->optIn = $optIn; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getAmount(): Euro { |
|
58
|
|
|
return $this->amount; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setAmount( Euro $amount ) { |
|
62
|
|
|
$this->amount = $amount; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function getPaymentType(): string { |
|
66
|
|
|
return $this->paymentType; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function setPaymentType( string $paymentType ) { |
|
70
|
|
|
$this->paymentType = $paymentType; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getInterval(): int { |
|
74
|
|
|
return $this->interval; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function setInterval( int $interval ) { |
|
78
|
|
|
$this->interval = $interval; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @return BankData|null |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getBankData() { |
|
85
|
|
|
return $this->bankData; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function setBankData( BankData $bankData ) { |
|
89
|
|
|
$this->bankData = $bankData; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function getTracking(): string { |
|
93
|
|
|
return $this->tracking; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function setTracking( string $tracking ) { |
|
97
|
|
|
$this->tracking = $tracking; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getSource(): string { |
|
101
|
|
|
return $this->source; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function setSource( string $source ) { |
|
105
|
|
|
$this->source = $source; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function getTotalImpressionCount(): int { |
|
109
|
|
|
return $this->totalImpressionCount; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function setTotalImpressionCount( int $totalImpressionCount ) { |
|
113
|
|
|
$this->totalImpressionCount = $totalImpressionCount; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
public function getSingleBannerImpressionCount(): int { |
|
117
|
|
|
return $this->singleBannerImpressionCount; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function setSingleBannerImpressionCount( int $singleBannerImpressionCount ) { |
|
121
|
|
|
$this->singleBannerImpressionCount = $singleBannerImpressionCount; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function getColor(): string { |
|
125
|
|
|
return $this->color; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
public function setColor( string $color ) { |
|
129
|
|
|
$this->color = $color; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
public function getSkin(): string { |
|
133
|
|
|
return $this->skin; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
public function setSkin( string $skin ) { |
|
137
|
|
|
$this->skin = $skin; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getLayout(): string { |
|
141
|
|
|
return $this->layout; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
public function setLayout( string $layout ) { |
|
145
|
|
|
$this->layout = $layout; |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
public function getDonorType(): string { |
|
149
|
|
|
return $this->donorType; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
public function setDonorType( string $donorType ) { |
|
153
|
|
|
$this->donorType = $donorType; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
public function getDonorFirstName(): string { |
|
157
|
|
|
return $this->donorFirstName; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
public function setDonorFirstName( string $donorFirstName ) { |
|
161
|
|
|
$this->donorFirstName = $donorFirstName; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
public function getDonorLastName(): string { |
|
165
|
|
|
return $this->donorLastName; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
public function setDonorLastName( string $donorLastName ) { |
|
169
|
|
|
$this->donorLastName = $donorLastName; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
public function getDonorSalutation(): string { |
|
173
|
|
|
return $this->donorSalutation; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
public function setDonorSalutation( string $donorSalutation ) { |
|
177
|
|
|
$this->donorSalutation = $donorSalutation; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
public function getDonorTitle(): string { |
|
181
|
|
|
return $this->donorTitle; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
public function setDonorTitle( string $donorTitle ) { |
|
185
|
|
|
$this->donorTitle = $donorTitle; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
public function getDonorCompany(): string { |
|
189
|
|
|
return $this->donorCompany; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
public function setDonorCompany( string $donorCompany ) { |
|
193
|
|
|
$this->donorCompany = $donorCompany; |
|
194
|
|
|
} |
|
195
|
|
|
|
|
196
|
|
|
public function getDonorStreetAddress(): string { |
|
197
|
|
|
return $this->donorStreetAddress; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
public function setDonorStreetAddress( string $donorStreetAddress ) { |
|
201
|
|
|
$this->donorStreetAddress = $donorStreetAddress; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
public function getDonorPostalCode(): string { |
|
205
|
|
|
return $this->donorPostalCode; |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
public function setDonorPostalCode( string $donorPostalCode ) { |
|
209
|
|
|
$this->donorPostalCode = $donorPostalCode; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getDonorCity(): string { |
|
213
|
|
|
return $this->donorCity; |
|
214
|
|
|
} |
|
215
|
|
|
|
|
216
|
|
|
public function setDonorCity( string $donorCity ) { |
|
217
|
|
|
$this->donorCity = $donorCity; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
public function getDonorCountryCode(): string { |
|
221
|
|
|
return $this->donorCountryCode; |
|
222
|
|
|
} |
|
223
|
|
|
|
|
224
|
|
|
public function setDonorCountryCode( string $donorCountryCode ) { |
|
225
|
|
|
$this->donorCountryCode = $donorCountryCode; |
|
226
|
|
|
} |
|
227
|
|
|
|
|
228
|
|
|
public function getDonorEmailAddress(): string { |
|
229
|
|
|
return $this->donorEmailAddress; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
public function setDonorEmailAddress( string $donorEmailAddress ) { |
|
233
|
|
|
$this->donorEmailAddress = $donorEmailAddress; |
|
234
|
|
|
} |
|
235
|
|
|
|
|
236
|
|
|
public static function getPreferredValue( array $values ) { |
|
237
|
|
|
foreach ( $values as $value ) { |
|
238
|
|
|
if ( $value !== null && $value !== '' ) { |
|
239
|
|
|
return $value; |
|
240
|
|
|
} |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
return ''; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
public static function concatTrackingFromVarCouple( string $campaign, string $keyword ): string { |
|
247
|
|
|
if ( $campaign !== '' ) { |
|
248
|
|
|
return strtolower( implode( '/', array_filter( [ $campaign, $keyword ] ) ) ); |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
return ''; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
public function donorIsAnonymous(): bool { |
|
255
|
|
|
return $this->getDonorType() === PersonName::PERSON_ANONYMOUS; |
|
256
|
|
|
} |
|
257
|
|
|
|
|
258
|
|
|
public function donorIsCompany(): bool { |
|
259
|
|
|
return $this->getDonorType() === PersonName::PERSON_COMPANY; |
|
260
|
|
|
} |
|
261
|
|
|
} |