-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathParcel.php
More file actions
189 lines (180 loc) · 4.98 KB
/
Parcel.php
File metadata and controls
189 lines (180 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
namespace Picqer\Carriers\SendCloud;
/**
* Class Parcel
*
* @property string name
* @property string company_name
* @property integer contract
* @property string address
* @property string address_2
* @property string house_number
* @property string city
* @property string postal_code
* @property string telephone
* @property bool requestShipment
* @property string email
* @property array data
* @property array country
* @property array shipment
* @property float weight
* @property string order_number
* @property integer insured_value
* @property string total_order_value_currency
* @property float total_order_value
* @property integer quantity
* @property string shipping_method_checkout_name
* @property string to_post_number
* @property string country_state
* @property integer sender_address
* @property string customs_invoice_nr
* @property integer customs_shipment_type
* @property string external_reference
* @property integer to_service_point
* @property integer total_insured_value
* @property string shipment_uuid
* @property array parcel_items
* @property bool is_return
* @property string length
* @property string width
* @property string height
* @property bool request_label_async
* @property bool apply_shipping_rules
* @property string from_name
* @property string from_company_name
* @property string from_address_1
* @property string from_address_2
* @property string from_house_number
* @property string from_city
* @property string from_postal_code
* @property string from_country
* @property string from_telephone
* @property string from_email
* @property string from_vat_number
* @property string from_eori_number
* @property string from_inbound_vat_number
* @property string from_inbound_eori_number
* @property string from_ioss_number
* @property array address_divided
* @property string date_created
* @property string date_updated
* @property string date_announced
* @property integer id
* @property array label
* @property array status
* @property array documents
* @property string tracking_number
* @property string colli_tracking_number
* @property string colli_uuid
* @property string collo_nr
* @property integer collo_count
* @property string|null awb_tracking_number
* @property integer|null box_number
* @property object customs_declaration
* @property object errors
*
* @package Picqer\Carriers\SendCloud
*/
class Parcel extends Model
{
use Query\Findable;
use Persistance\Storable;
use Persistance\Multiple;
protected $fillable = [
'name',
'company_name',
'contract',
'address',
'address_2',
'house_number',
'city',
'postal_code',
'telephone',
'requestShipment',
'email',
'data',
'country',
'shipment',
'weight',
'order_number',
'insured_value',
'total_order_value_currency',
'total_order_value',
'quantity',
'shipping_method_checkout_name',
'to_post_number',
'country_state',
'sender_address',
'customs_invoice_nr',
'customs_shipment_type',
'external_reference',
'to_service_point',
'total_insured_value',
'shipment_uuid',
'parcel_items',
'is_return',
'length',
'width',
'height',
'request_label_async',
'apply_shipping_rules',
'from_name',
'from_company_name',
'from_address_1',
'from_address_2',
'from_house_number',
'from_city',
'from_postal_code',
'from_country',
'from_telephone',
'from_email',
'from_vat_number',
'from_eori_number',
'from_inbound_vat_number',
'from_inbound_eori_number',
'from_ioss_number',
'address_divided',
'date_created',
'date_updated',
'date_announced',
'id',
'label',
'status',
'documents',
'tracking_number',
'colli_tracking_number',
'colli_uuid',
'collo_nr',
'collo_count',
'awb_tracking_number',
'box_number',
'customs_declaration',
'errors',
];
protected $url = 'parcels';
protected $namespaces = [
'singular' => 'parcel',
'plural' => 'parcels'
];
public function getTrackingUrl(): ?string
{
return $this->tracking_url;
}
public function getShipperName(): ?string
{
return $this->carrier['code'];
}
public function getPrimaryLabelUrl(): string
{
// If multiple documents are supplied, type 'label' is the primary label
if (is_array($this->documents)) {
foreach ($this->documents as $document) {
if ($document['type'] === 'label') {
return $document['link'];
}
}
}
// If new type of documents is not declared, use old url
return $this->label['label_printer'];
}
}