NotificationPayload::getCancellationDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Appvise\AppStoreNotifications\Model;
4
5
use Illuminate\Http\Request;
6
7
class NotificationPayload
8
{
9
    private $environment;
10
    private $notificationType;
11
    private $password;
12
    private $cancellationDate;
13
    private $cancellationDatePst;
14
    private $cancellationDateMs;
15
    private $webOrderLineItemId;
16
    private $latestReceipt;
17
    private $latestReceiptInfo;
18
    private $latestExpiredReceipt;
19
    private $latestExpiredReceiptInfo;
20
    private $autoRenewStatus;
21
    private $autoRenewProductId;
22
    private $autoRenewStatusChangeDate;
23
    private $autoRenewStatusChangeDatePst;
24
    private $autoRenewStatusChangeDateMs;
25
    private $pendingRenewalInfo;
26
27
    public function __construct()
28
    {
29
    }
30
31
    public static function createFromRequest(Request $request)
32
    {
33
        $instance = new self();
34
        $instance->environment = $request->input('environment');
35
        $instance->password = $request->input('password');
36
        $instance->notificationType = $request->input('notification_type');
37
        $instance->cancellationDate = $request->input('cancellation_date');
38
        $instance->cancellationDatePst = $request->input('cancellation_date_pst');
39
        $instance->cancellationDateMs = $request->input('cancellation_date_ms');
40
        $instance->webOrderLineItemId = $request->input('web_order_line_item_id');
41
        $instance->latestReceipt = $request->input('latest_receipt');
42
        $instance->latestReceiptInfo = Receipt::createFromArray($request->input('latest_receipt_info'));
43
        $instance->latestExpiredReceipt = $request->input('latest_expired_receipt');
44
        if ($request->has('latest_expired_receipt_info')) {
45
            $instance->latestExpiredReceiptInfo = Receipt::createFromArray($request->input('latest_expired_receipt_info'));
46
        } else {
47
            $instance->latestExpiredReceiptInfo = null;
48
        }
49
        $instance->autoRenewStatus = $request->input('auto_renew_status');
50
        $instance->autoRenewProductId = $request->input('auto_renew_product_id');
51
        $instance->autoRenewStatusChangeDate = $request->input('auto_renew_status_change_date');
52
        $instance->autoRenewStatusChangeDatePst = $request->input('auto_renew_status_change_date_pst');
53
        $instance->autoRenewStatusChangeDateMs = $request->input('auto_renew_status_change_date_ms');
54
        if ($request->has('pending_renewal_info')) {
55
            foreach ($request->input('pending_renewal_info') as $pendingRenewalInfo) {
56
                $instance->pendingRenewalInfo[] = RenewalInfo::createFromRequest($pendingRenewalInfo);
57
            }
58
        } else {
59
            $instance->pendingRenewalInfo = null;
60
        }
61
62
        return $instance;
63
    }
64
65
    /**
66
     * Get the value of environment.
67
     */
68
    public function getEnvironment()
69
    {
70
        return $this->environment;
71
    }
72
73
    /**
74
     * Get the value of notificationType.
75
     */
76
    public function getNotificationType()
77
    {
78
        return $this->notificationType;
79
    }
80
81
    /**
82
     * Get the value of pendingRenewalInfo.
83
     */
84
    public function getPendingRenewalInfo()
85
    {
86
        return $this->pendingRenewalInfo;
87
    }
88
89
    /**
90
     * Get the value of autoRenewStatusChangeDateMs.
91
     */
92
    public function getAutoRenewStatusChangeDateMs()
93
    {
94
        return $this->autoRenewStatusChangeDateMs;
95
    }
96
97
    /**
98
     * Get the value of autoRenewStatusChangeDatePst.
99
     */
100
    public function getAutoRenewStatusChangeDatePst()
101
    {
102
        return $this->autoRenewStatusChangeDatePst;
103
    }
104
105
    /**
106
     * Get the value of autoRenewStatusChangeDate.
107
     */
108
    public function getAutoRenewStatusChangeDate()
109
    {
110
        return $this->autoRenewStatusChangeDate;
111
    }
112
113
    /**
114
     * Get the value of autoRenewProductId.
115
     */
116
    public function getAutoRenewProductId()
117
    {
118
        return $this->autoRenewProductId;
119
    }
120
121
    /**
122
     * Get the value of autoRenewStatus.
123
     */
124
    public function getAutoRenewStatus()
125
    {
126
        return $this->autoRenewStatus;
127
    }
128
129
    /**
130
     * Get the value of latestExpiredReceiptInfo.
131
     */
132
    public function getLatestExpiredReceiptInfo()
133
    {
134
        return $this->latestExpiredReceiptInfo;
135
    }
136
137
    /**
138
     * Get the value of latestExpiredReceipt.
139
     */
140
    public function getLatestExpiredReceipt()
141
    {
142
        return $this->latestExpiredReceipt;
143
    }
144
145
    /**
146
     * Get the value of latestReceiptInfo.
147
     */
148
    public function getLatestReceiptInfo()
149
    {
150
        return $this->latestReceiptInfo;
151
    }
152
153
    /**
154
     * Get the value of latestReceipt.
155
     */
156
    public function getLatestReceipt()
157
    {
158
        return $this->latestReceipt;
159
    }
160
161
    /**
162
     * Get the value of webOrderLineItemId.
163
     */
164
    public function getWebOrderLineItemId()
165
    {
166
        return $this->webOrderLineItemId;
167
    }
168
169
    /**
170
     * Get the value of cancellationDateMs.
171
     */
172
    public function getCancellationDateMs()
173
    {
174
        return $this->cancellationDateMs;
175
    }
176
177
    /**
178
     * Get the value of cancellationDatePst.
179
     */
180
    public function getCancellationDatePst()
181
    {
182
        return $this->cancellationDatePst;
183
    }
184
185
    /**
186
     * Get the value of cancellationDate.
187
     */
188
    public function getCancellationDate()
189
    {
190
        return $this->cancellationDate;
191
    }
192
193
    /**
194
     * Get the value of password.
195
     */
196
    public function getPassword()
197
    {
198
        return $this->password;
199
    }
200
}
201