1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: adriano |
5
|
|
|
* Date: 19/10/18 |
6
|
|
|
* Time: 09:03 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace PayGo\Transactions\Contracts\Query; |
10
|
|
|
|
11
|
|
|
use PayGo\Transactions\Constants\SourceConst; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Query |
15
|
|
|
* @package PayGo\Transactions\Contracts\Query |
16
|
|
|
*/ |
17
|
|
|
class Query implements \JsonSerializable |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* TODO: Não implementado nas apis, por enquanto tem apenas o parâmetro "LastUniqueSearchedId" |
21
|
|
|
* |
22
|
|
|
* @var integer |
23
|
|
|
*/ |
24
|
|
|
private $from; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var integer |
28
|
|
|
*/ |
29
|
|
|
private $limit; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var Filters |
33
|
|
|
*/ |
34
|
|
|
private $filters; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var Source |
38
|
|
|
*/ |
39
|
|
|
private $source; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Como padrão ignora retorno do cupom fiscal |
43
|
|
|
* |
44
|
|
|
* @var array |
45
|
|
|
*/ |
46
|
|
|
private $exclude = [SourceConst::FULL_RECEIPT_COPY]; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var array|Sort |
50
|
|
|
*/ |
51
|
|
|
private $sort; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var integer |
55
|
|
|
*/ |
56
|
|
|
private $lastUniqueSearchedId; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int |
60
|
|
|
*/ |
61
|
|
|
public function getFrom() |
62
|
|
|
{ |
63
|
|
|
return $this->from; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param int $from |
68
|
|
|
* @return Query |
69
|
|
|
*/ |
70
|
|
|
public function setFrom($from) |
71
|
|
|
{ |
72
|
|
|
$this->from = $from; |
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return int |
78
|
|
|
*/ |
79
|
|
|
public function getLimit() |
80
|
|
|
{ |
81
|
|
|
return $this->limit; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param int $limit |
86
|
|
|
* @return Query |
87
|
|
|
*/ |
88
|
|
|
public function setLimit($limit) |
89
|
|
|
{ |
90
|
|
|
$this->limit = $limit; |
91
|
|
|
return $this; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return Filters |
96
|
|
|
*/ |
97
|
|
|
public function getFilters() |
98
|
|
|
{ |
99
|
|
|
return $this->filters; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @param Filters $filters |
104
|
|
|
* @return Query |
105
|
|
|
*/ |
106
|
|
|
public function setFilters($filters) |
107
|
|
|
{ |
108
|
|
|
$this->filters = $filters; |
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return Source |
114
|
|
|
*/ |
115
|
|
|
public function getSource() |
116
|
|
|
{ |
117
|
|
|
return $this->source; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param Source $source |
122
|
|
|
* @return Query |
123
|
|
|
*/ |
124
|
|
|
public function setSource($source) |
125
|
|
|
{ |
126
|
|
|
$this->source = $source; |
127
|
|
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return array |
132
|
|
|
*/ |
133
|
|
|
public function getExclude() |
134
|
|
|
{ |
135
|
|
|
return $this->exclude; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param array $exclude |
140
|
|
|
* @return Query |
141
|
|
|
*/ |
142
|
|
|
public function setExclude($exclude) |
143
|
|
|
{ |
144
|
|
|
$this->exclude = $exclude; |
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* @return array|Sort |
150
|
|
|
*/ |
151
|
|
|
public function getSort() |
152
|
|
|
{ |
153
|
|
|
return $this->sort; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @param array|Sort $sort |
158
|
|
|
* @return Query |
159
|
|
|
*/ |
160
|
|
|
public function setSort($sort) |
161
|
|
|
{ |
162
|
|
|
$this->sort = $sort; |
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return int |
168
|
|
|
*/ |
169
|
|
|
public function getLastUniqueSearchedId() |
170
|
|
|
{ |
171
|
|
|
return $this->lastUniqueSearchedId; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param int $lastUniqueSearchedId |
176
|
|
|
* @return Query |
177
|
|
|
*/ |
178
|
|
|
public function setLastUniqueSearchedId($lastUniqueSearchedId) |
179
|
|
|
{ |
180
|
|
|
$this->lastUniqueSearchedId = $lastUniqueSearchedId; |
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* @return array|mixed |
186
|
|
|
*/ |
187
|
|
|
public function jsonSerialize() |
188
|
|
|
{ |
189
|
|
|
return array_filter([ |
190
|
|
|
"From" => $this->from, |
191
|
|
|
"Limit" => $this->limit, |
192
|
|
|
"Source" => $this->source, |
193
|
|
|
"Exclude" => $this->exclude, |
194
|
|
|
"Filters" => $this->filters, |
195
|
|
|
"Sort" => $this->sort, |
196
|
|
|
"LastUniqueSearchedId" => $this->lastUniqueSearchedId, |
197
|
|
|
], function($val) { return !empty($val); }); |
198
|
|
|
} |
199
|
|
|
} |