|
1
|
|
|
<?php |
|
2
|
|
|
namespace Kerox\Messenger\Message\Attachment\Template; |
|
3
|
|
|
|
|
4
|
|
|
use Kerox\Messenger\Message\Attachment\Template; |
|
5
|
|
|
|
|
6
|
|
|
class AirlineCheckIn extends AbstractAirline |
|
7
|
|
|
{ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* @var string |
|
11
|
|
|
*/ |
|
12
|
|
|
protected $introMessage; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
protected $pnrNumber; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var \Kerox\Messenger\Message\Attachment\Template\Airline\FlightInfo[] |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $flightInfo; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $checkinUrl; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* AirlineCheckIn constructor. |
|
31
|
|
|
* |
|
32
|
|
|
* @param string $introMessage |
|
33
|
|
|
* @param string $locale |
|
34
|
|
|
* @param string $pnrNumber |
|
35
|
|
|
* @param array $flightInfo |
|
36
|
|
|
* @param string $checkinUrl |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct(string $introMessage, |
|
39
|
|
|
string $locale, |
|
40
|
|
|
string $pnrNumber, |
|
41
|
|
|
array $flightInfo, |
|
42
|
|
|
string $checkinUrl |
|
43
|
|
|
) { |
|
44
|
|
|
parent::__construct($locale); |
|
45
|
|
|
|
|
46
|
|
|
$this->introMessage = $introMessage; |
|
47
|
|
|
$this->pnrNumber = $pnrNumber; |
|
48
|
|
|
$this->flightInfo = $flightInfo; |
|
49
|
|
|
$this->checkinUrl = $checkinUrl; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @return array |
|
54
|
|
|
*/ |
|
55
|
|
|
public function jsonSerialize(): array |
|
56
|
|
|
{ |
|
57
|
|
|
$payload = [ |
|
58
|
|
|
'template_type' => Template::TYPE_AIRLINE_CHECKIN, |
|
59
|
|
|
'intro_message' => $this->introMessage, |
|
60
|
|
|
'locale' => $this->locale, |
|
61
|
|
|
'theme_color' => $this->themeColor, |
|
62
|
|
|
'pnr_number' => $this->pnrNumber, |
|
63
|
|
|
'flight_info' => $this->flightInfo, |
|
64
|
|
|
'checkin_url' => $this->checkinUrl, |
|
65
|
|
|
]; |
|
66
|
|
|
|
|
67
|
|
|
$json = parent::jsonSerialize(); |
|
68
|
|
|
$json += [ |
|
69
|
|
|
'payload' => array_filter($payload), |
|
70
|
|
|
]; |
|
71
|
|
|
|
|
72
|
|
|
return $json; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|