|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Copyright © Eduard Sukharev |
|
4
|
|
|
* |
|
5
|
|
|
* For a license agreement, see the LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
namespace Ups\Entity; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Based on UPS Developer Guide, dated: 13 Jul 2015 |
|
13
|
|
|
* @author Eduard Sukharev <[email protected]> |
|
14
|
|
|
*/ |
|
15
|
|
|
class ShipmentRequestLabelSpecification |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* Required. |
|
19
|
|
|
* Label print method code that the labels are to be generated. For EPL2 formatted labels use EPL, for SPL formatted |
|
20
|
|
|
* labels use SPL, for ZPL formatted labels use ZPL, for STAR printer formatted labels use STARPL and for image |
|
21
|
|
|
* formats use GIF. |
|
22
|
|
|
* |
|
23
|
|
|
* @var string |
|
24
|
|
|
*/ |
|
25
|
|
|
private $printMethodCode; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Optional. |
|
29
|
|
|
* Label Specification Code description |
|
30
|
|
|
* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
private $printMethodDescription; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Optional. |
|
37
|
|
|
* Browser HTTPUserAgent String. This is the preferred way of identifying GIF image type to be generated |
|
38
|
|
|
* |
|
39
|
|
|
* @var string |
|
40
|
|
|
*/ |
|
41
|
|
|
private $httpUserAgent; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Required for EPL2, ZPL, STARPL and SPL labels. |
|
45
|
|
|
* Height of the label image. For IN, use whole inches. Only valid value is 4. |
|
46
|
|
|
* Label Image will only scale up to 4 X 6, even when requesting 4 X 8. |
|
47
|
|
|
* |
|
48
|
|
|
* @var string |
|
49
|
|
|
*/ |
|
50
|
|
|
private $stockSizeHeight; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Required for EPL2, ZPL, STARPL and SPL labels. |
|
54
|
|
|
* Height of the label image. For IN, use whole inches. Only valid values are 6 or 8. |
|
55
|
|
|
* Label Image will only scale up to 4 X 6, even when requesting 4 X 8. |
|
56
|
|
|
* |
|
57
|
|
|
* @var string |
|
58
|
|
|
*/ |
|
59
|
|
|
private $stockSizeWidth; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Required if $printMethodCode = GIF. |
|
63
|
|
|
* Code type that the label image is to be generated in. |
|
64
|
|
|
* Valid values are GIF or PNG. Only GIF is supported on the remote server. |
|
65
|
|
|
* |
|
66
|
|
|
* @var string |
|
67
|
|
|
*/ |
|
68
|
|
|
private $imageFormatCode; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Optional. |
|
72
|
|
|
* Description of the label image format code. |
|
73
|
|
|
* |
|
74
|
|
|
* @var string |
|
75
|
|
|
*/ |
|
76
|
|
|
private $imageFormatDescription; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Optional. |
|
80
|
|
|
* For Exchange Forward Shipment, Valid values are: |
|
81
|
|
|
* 01 - EXCHANGE-LIKE ITEM ONLY. |
|
82
|
|
|
* 02 - EXCHANGE-DRIVER INSTRUCTIONS INSIDE |
|
83
|
|
|
* By default label will have Exchange Routing instruction Text as EXCHANGE-LIKE ITEM ONLY |
|
84
|
|
|
* |
|
85
|
|
|
* @var string |
|
86
|
|
|
*/ |
|
87
|
|
|
private $instructionCode; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Optional. |
|
91
|
|
|
* Description of the label Instruction code. |
|
92
|
|
|
* |
|
93
|
|
|
* @var string |
|
94
|
|
|
*/ |
|
95
|
|
|
private $instructionDescription; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Optional. |
|
99
|
|
|
* Language character set expected on label. Valid values are: |
|
100
|
|
|
* dan = Danish (Latin-1) |
|
101
|
|
|
* nld = Dutch (Latin-1) |
|
102
|
|
|
* fin = Finnish (Latin-1) |
|
103
|
|
|
* fra = French (Latin-1) |
|
104
|
|
|
* deu = German (Latin-1) |
|
105
|
|
|
* itl = Italian (Latin-1) |
|
106
|
|
|
* nor = Norwegian (Latin-1) |
|
107
|
|
|
* pol = Polish (Latin-2) |
|
108
|
|
|
* por = Poruguese (Latin-1) |
|
109
|
|
|
* spa = Spanish (Latin-1) |
|
110
|
|
|
* swe = Swedish (Latin-1) |
|
111
|
|
|
* ces = Czech (Latin-2) |
|
112
|
|
|
* hun = Hungarian (Latin-2) |
|
113
|
|
|
* slk = Slovak (Latin-2) |
|
114
|
|
|
* rus = Russian (Cyrillic) |
|
115
|
|
|
* tur = Turkish (Latin-5) |
|
116
|
|
|
* ron = Romanian (Latin-2) |
|
117
|
|
|
* bul = Bulgarian (Latin-2) |
|
118
|
|
|
* est = Estonian (Latin-2) |
|
119
|
|
|
* ell = Greek (Latin-2) |
|
120
|
|
|
* lav = Latvian (Latin-2) |
|
121
|
|
|
* |
|
122
|
|
|
*/ |
|
123
|
|
|
private $characterSet; |
|
124
|
|
|
|
|
125
|
|
|
const PRINT_METHOD_CODE_EPL = 'EPL'; |
|
126
|
|
|
const PRINT_METHOD_CODE_SPL = 'SPL'; |
|
127
|
|
|
const PRINT_METHOD_CODE_ZPL = 'ZPL'; |
|
128
|
|
|
const PRINT_METHOD_CODE_STARPL = 'STARPL'; |
|
129
|
|
|
const PRINT_METHOD_CODE_GIF = 'GIF'; |
|
130
|
|
|
|
|
131
|
|
|
const IMG_FORMAT_CODE_GIF = 'GIF'; |
|
132
|
|
|
const IMG_FORMAT_CODE_PNG = 'PNG'; |
|
133
|
|
|
|
|
134
|
|
|
const INSTRUCTION_CODE_EXCHANGE_LIKE_ITEM_ONLY = '01'; |
|
135
|
|
|
const INSTRUCTION_CODE_EXCHANGE_DRIVER_INSTRUCTIONS_INSIDE = '02'; |
|
136
|
|
|
|
|
137
|
|
|
const CHARACTER_SET_DANISH = 'dan'; |
|
138
|
|
|
const CHARACTER_SET_DUTCH = 'nld'; |
|
139
|
|
|
const CHARACTER_SET_FINNISH = 'fin'; |
|
140
|
|
|
const CHARACTER_SET_FRENCH = 'fra'; |
|
141
|
|
|
const CHARACTER_SET_GERMAN = 'deu'; |
|
142
|
|
|
const CHARACTER_SET_ITALIAN = 'itl'; |
|
143
|
|
|
const CHARACTER_SET_NORWEGIAN = 'nor'; |
|
144
|
|
|
const CHARACTER_SET_POLISH = 'pol'; |
|
145
|
|
|
const CHARACTER_SET_PORUGUESE = 'por'; |
|
146
|
|
|
const CHARACTER_SET_SPANISH = 'spa'; |
|
147
|
|
|
const CHARACTER_SET_SWEDISH = 'swe'; |
|
148
|
|
|
const CHARACTER_SET_CZECH = 'ces'; |
|
149
|
|
|
const CHARACTER_SET_HUNGARIAN = 'hun'; |
|
150
|
|
|
const CHARACTER_SET_SLOVAK = 'slk'; |
|
151
|
|
|
const CHARACTER_SET_RUSSIAN = 'rus'; |
|
152
|
|
|
const CHARACTER_SET_TURKISH = 'tur'; |
|
153
|
|
|
const CHARACTER_SET_ROMANIAN = 'ron'; |
|
154
|
|
|
const CHARACTER_SET_BULGARIAN = 'bul'; |
|
155
|
|
|
const CHARACTER_SET_ESTONIAN = 'est'; |
|
156
|
|
|
const CHARACTER_SET_GREEK = 'ell'; |
|
157
|
|
|
const RACTER_SET_LATVIAN = 'lav'; |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* @param string $printMethodCode |
|
161
|
|
|
*/ |
|
162
|
|
|
public function __construct($printMethodCode) |
|
163
|
|
|
{ |
|
164
|
|
|
$this->printMethodCode = $printMethodCode; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
/** |
|
168
|
|
|
* @return string |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getPrintMethodCode() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->printMethodCode; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* @return string |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getPrintMethodDescription() |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->printMethodDescription; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* @param string $printMethodDescription |
|
185
|
|
|
* @return ShipmentRequestLabelSpecification |
|
186
|
|
|
*/ |
|
187
|
|
|
public function setPrintMethodDescription($printMethodDescription) |
|
188
|
|
|
{ |
|
189
|
|
|
$this->printMethodDescription = $printMethodDescription; |
|
190
|
|
|
|
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @return string |
|
196
|
|
|
*/ |
|
197
|
|
|
public function getHttpUserAgent() |
|
198
|
|
|
{ |
|
199
|
|
|
return $this->httpUserAgent; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @param string $httpUserAgent |
|
204
|
|
|
* @return ShipmentRequestLabelSpecification |
|
205
|
|
|
*/ |
|
206
|
|
|
public function setHttpUserAgent($httpUserAgent) |
|
207
|
|
|
{ |
|
208
|
|
|
$this->httpUserAgent = $httpUserAgent; |
|
209
|
|
|
|
|
210
|
|
|
return $this; |
|
211
|
|
|
} |
|
212
|
|
|
|
|
213
|
|
|
/** |
|
214
|
|
|
* @return string |
|
215
|
|
|
*/ |
|
216
|
|
|
public function getStockSizeHeight() |
|
217
|
|
|
{ |
|
218
|
|
|
return $this->stockSizeHeight; |
|
219
|
|
|
} |
|
220
|
|
|
|
|
221
|
|
|
/** |
|
222
|
|
|
* @param string $stockSizeHeight |
|
223
|
|
|
* @return ShipmentRequestLabelSpecification |
|
224
|
|
|
*/ |
|
225
|
|
|
public function setStockSizeHeight($stockSizeHeight) |
|
226
|
|
|
{ |
|
227
|
|
|
$this->stockSizeHeight = $stockSizeHeight; |
|
228
|
|
|
|
|
229
|
|
|
return $this; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* @return string |
|
234
|
|
|
*/ |
|
235
|
|
|
public function getStockSizeWidth() |
|
236
|
|
|
{ |
|
237
|
|
|
return $this->stockSizeWidth; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* @param string $stockSizeWidth |
|
242
|
|
|
* @return ShipmentRequestLabelSpecification |
|
243
|
|
|
*/ |
|
244
|
|
|
public function setStockSizeWidth($stockSizeWidth) |
|
245
|
|
|
{ |
|
246
|
|
|
$this->stockSizeWidth = $stockSizeWidth; |
|
247
|
|
|
|
|
248
|
|
|
return $this; |
|
249
|
|
|
} |
|
250
|
|
|
|
|
251
|
|
|
/** |
|
252
|
|
|
* @return string |
|
253
|
|
|
*/ |
|
254
|
|
|
public function getImageFormatCode() |
|
255
|
|
|
{ |
|
256
|
|
|
return $this->imageFormatCode; |
|
257
|
|
|
} |
|
258
|
|
|
|
|
259
|
|
|
/** |
|
260
|
|
|
* @param string $imageFormatCode |
|
261
|
|
|
* @return ShipmentRequestLabelSpecification |
|
262
|
|
|
*/ |
|
263
|
|
|
public function setImageFormatCode($imageFormatCode) |
|
264
|
|
|
{ |
|
265
|
|
|
$this->imageFormatCode = $imageFormatCode; |
|
266
|
|
|
|
|
267
|
|
|
return $this; |
|
268
|
|
|
} |
|
269
|
|
|
|
|
270
|
|
|
/** |
|
271
|
|
|
* @return string |
|
272
|
|
|
*/ |
|
273
|
|
|
public function getImageFormatDescription() |
|
274
|
|
|
{ |
|
275
|
|
|
return $this->imageFormatDescription; |
|
276
|
|
|
} |
|
277
|
|
|
|
|
278
|
|
|
/** |
|
279
|
|
|
* @param string $imageFormatDescription |
|
280
|
|
|
* @return ShipmentRequestLabelSpecification |
|
281
|
|
|
*/ |
|
282
|
|
|
public function setImageFormatDescription($imageFormatDescription) |
|
283
|
|
|
{ |
|
284
|
|
|
$this->imageFormatDescription = $imageFormatDescription; |
|
285
|
|
|
|
|
286
|
|
|
return $this; |
|
287
|
|
|
} |
|
288
|
|
|
|
|
289
|
|
|
/** |
|
290
|
|
|
* @return string |
|
291
|
|
|
*/ |
|
292
|
|
|
public function getInstructionCode() |
|
293
|
|
|
{ |
|
294
|
|
|
return $this->instructionCode; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @param string $instructionCode |
|
299
|
|
|
* @return ShipmentRequestLabelSpecification |
|
300
|
|
|
*/ |
|
301
|
|
|
public function setInstructionCode($instructionCode) |
|
302
|
|
|
{ |
|
303
|
|
|
$this->instructionCode = $instructionCode; |
|
304
|
|
|
|
|
305
|
|
|
return $this; |
|
306
|
|
|
} |
|
307
|
|
|
|
|
308
|
|
|
/** |
|
309
|
|
|
* @return string |
|
310
|
|
|
*/ |
|
311
|
|
|
public function getInstructionDescription() |
|
312
|
|
|
{ |
|
313
|
|
|
return $this->instructionDescription; |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
/** |
|
317
|
|
|
* @param string $instructionDescription |
|
318
|
|
|
* @return ShipmentRequestLabelSpecification |
|
319
|
|
|
*/ |
|
320
|
|
|
public function setInstructionDescription($instructionDescription) |
|
321
|
|
|
{ |
|
322
|
|
|
$this->instructionDescription = $instructionDescription; |
|
323
|
|
|
|
|
324
|
|
|
return $this; |
|
325
|
|
|
} |
|
326
|
|
|
|
|
327
|
|
|
/** |
|
328
|
|
|
* @return string |
|
329
|
|
|
*/ |
|
330
|
|
|
public function getCharacterSet() |
|
331
|
|
|
{ |
|
332
|
|
|
return $this->characterSet; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* |
|
337
|
|
|
* @param string $characterSet |
|
338
|
|
|
* @return ShipmentRequestLabelSpecification |
|
339
|
|
|
*/ |
|
340
|
|
|
public function setCharacterSet($characterSet) |
|
341
|
|
|
{ |
|
342
|
|
|
$this->characterSet = $characterSet; |
|
343
|
|
|
return $this; |
|
344
|
|
|
} |
|
345
|
|
|
} |
|
346
|
|
|
|