karrio-cli 2025.5rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- karrio_cli/__init__.py +0 -0
- karrio_cli/__main__.py +105 -0
- karrio_cli/ai/README.md +335 -0
- karrio_cli/ai/__init__.py +0 -0
- karrio_cli/ai/commands.py +102 -0
- karrio_cli/ai/karrio_ai/__init__.py +1 -0
- karrio_cli/ai/karrio_ai/agent.py +972 -0
- karrio_cli/ai/karrio_ai/architecture/INTEGRATION_AGENT_PROMPT.md +497 -0
- karrio_cli/ai/karrio_ai/architecture/MAPPING_AGENT_PROMPT.md +355 -0
- karrio_cli/ai/karrio_ai/architecture/REAL_WORLD_TESTING.md +305 -0
- karrio_cli/ai/karrio_ai/architecture/SCHEMA_AGENT_PROMPT.md +183 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_AGENT_PROMPT.md +448 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_GUIDE.md +271 -0
- karrio_cli/ai/karrio_ai/enhanced_tools.py +943 -0
- karrio_cli/ai/karrio_ai/rag_system.py +503 -0
- karrio_cli/ai/karrio_ai/tests/test_agent.py +350 -0
- karrio_cli/ai/karrio_ai/tests/test_real_integration.py +360 -0
- karrio_cli/ai/karrio_ai/tests/test_real_world_scenarios.py +513 -0
- karrio_cli/commands/__init__.py +0 -0
- karrio_cli/commands/codegen.py +336 -0
- karrio_cli/commands/login.py +139 -0
- karrio_cli/commands/plugins.py +168 -0
- karrio_cli/commands/sdk.py +870 -0
- karrio_cli/common/queries.py +101 -0
- karrio_cli/common/utils.py +368 -0
- karrio_cli/resources/__init__.py +0 -0
- karrio_cli/resources/carriers.py +91 -0
- karrio_cli/resources/connections.py +207 -0
- karrio_cli/resources/events.py +151 -0
- karrio_cli/resources/logs.py +151 -0
- karrio_cli/resources/orders.py +144 -0
- karrio_cli/resources/shipments.py +210 -0
- karrio_cli/resources/trackers.py +287 -0
- karrio_cli/templates/__init__.py +9 -0
- karrio_cli/templates/__pycache__/__init__.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/__init__.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-312.pyc +0 -0
- karrio_cli/templates/address.py +308 -0
- karrio_cli/templates/docs.py +150 -0
- karrio_cli/templates/documents.py +428 -0
- karrio_cli/templates/manifest.py +396 -0
- karrio_cli/templates/pickup.py +839 -0
- karrio_cli/templates/rates.py +638 -0
- karrio_cli/templates/sdk.py +947 -0
- karrio_cli/templates/shipments.py +892 -0
- karrio_cli/templates/tracking.py +437 -0
- karrio_cli-2025.5rc3.dist-info/METADATA +165 -0
- karrio_cli-2025.5rc3.dist-info/RECORD +68 -0
- karrio_cli-2025.5rc3.dist-info/WHEEL +5 -0
- karrio_cli-2025.5rc3.dist-info/entry_points.txt +2 -0
- karrio_cli-2025.5rc3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,396 @@
|
|
1
|
+
from jinja2 import Template
|
2
|
+
|
3
|
+
PROVIDER_MANIFEST_TEMPLATE = Template(
|
4
|
+
'''"""Karrio {{name}} manifest API implementation."""
|
5
|
+
|
6
|
+
# IMPLEMENTATION INSTRUCTIONS:
|
7
|
+
# 1. Uncomment the imports when the schema types are generated
|
8
|
+
# 2. Import the specific request and response types you need
|
9
|
+
# 3. Create a request instance with the appropriate request type
|
10
|
+
# 4. Extract manifest details from the response
|
11
|
+
|
12
|
+
import typing
|
13
|
+
import base64
|
14
|
+
import karrio.lib as lib
|
15
|
+
import karrio.core.models as models
|
16
|
+
import karrio.providers.{{id}}.error as error
|
17
|
+
import karrio.providers.{{id}}.utils as provider_utils
|
18
|
+
import karrio.providers.{{id}}.units as provider_units
|
19
|
+
|
20
|
+
|
21
|
+
def parse_manifest_response(
|
22
|
+
_response: lib.Deserializable[{% if is_xml_api %}lib.Element{% else %}dict{% endif %}],
|
23
|
+
settings: provider_utils.Settings,
|
24
|
+
) -> typing.Tuple[models.ManifestDetails, typing.List[models.Message]]:
|
25
|
+
"""
|
26
|
+
Parse manifest response from carrier API
|
27
|
+
|
28
|
+
_response: The carrier response to deserialize
|
29
|
+
settings: The carrier connection settings
|
30
|
+
|
31
|
+
Returns a tuple with (ManifestDetails, List[Message])
|
32
|
+
"""
|
33
|
+
response = _response.deserialize()
|
34
|
+
messages = error.parse_error_response(response, settings)
|
35
|
+
details = _extract_details(response, settings)
|
36
|
+
|
37
|
+
return details, messages
|
38
|
+
|
39
|
+
|
40
|
+
def _extract_details(
|
41
|
+
data: {% if is_xml_api %}lib.Element{% else %}dict{% endif %},
|
42
|
+
settings: provider_utils.Settings,
|
43
|
+
) -> models.ManifestDetails:
|
44
|
+
"""
|
45
|
+
Extract manifest details from carrier response data
|
46
|
+
|
47
|
+
data: The carrier-specific manifest response data
|
48
|
+
settings: The carrier connection settings
|
49
|
+
|
50
|
+
Returns a ManifestDetails object with the manifest information
|
51
|
+
"""
|
52
|
+
{% if is_xml_api %}
|
53
|
+
# Example implementation for XML response:
|
54
|
+
# Extract manifest ID and document from the response
|
55
|
+
# manifest_id = lib.find_element("manifest-id", data, first=True).text
|
56
|
+
# manifest_content = lib.find_element("manifest-document", data, first=True).text
|
57
|
+
# shipments = []
|
58
|
+
# for shipment_elem in lib.find_element("shipment", data):
|
59
|
+
# shipments.append(lib.find_element("tracking-number", shipment_elem, first=True).text)
|
60
|
+
|
61
|
+
# For development, return sample data
|
62
|
+
manifest_id = "MAN123456"
|
63
|
+
manifest_content = "base64_encoded_manifest_pdf"
|
64
|
+
shipments = ["TRACK123456", "TRACK789012"]
|
65
|
+
{% else %}
|
66
|
+
# Example implementation for JSON response:
|
67
|
+
# manifest_id = data.get("manifestId", "")
|
68
|
+
# manifest_content = data.get("manifestDocument", "")
|
69
|
+
# shipments = []
|
70
|
+
# for shipment in data.get("shipments", []):
|
71
|
+
# shipments.append(shipment.get("trackingNumber", ""))
|
72
|
+
|
73
|
+
# For development, return sample data
|
74
|
+
manifest_id = "MAN123456"
|
75
|
+
manifest_content = "base64_encoded_manifest_pdf"
|
76
|
+
shipments = ["TRACK123456", "TRACK789012"]
|
77
|
+
{% endif %}
|
78
|
+
|
79
|
+
return models.ManifestDetails(
|
80
|
+
carrier_id=settings.carrier_id,
|
81
|
+
carrier_name=settings.carrier_name,
|
82
|
+
manifest_id=manifest_id,
|
83
|
+
shipments=shipments,
|
84
|
+
doc=models.ManifestDocument(manifest=manifest_content),
|
85
|
+
meta=dict(
|
86
|
+
# Additional carrier-specific metadata
|
87
|
+
created_at="2023-07-01T12:00:00Z",
|
88
|
+
submission_id="SUB123456"
|
89
|
+
),
|
90
|
+
)
|
91
|
+
|
92
|
+
|
93
|
+
def manifest_request(
|
94
|
+
payload: models.ManifestRequest,
|
95
|
+
settings: provider_utils.Settings,
|
96
|
+
) -> lib.Serializable:
|
97
|
+
"""
|
98
|
+
Create a manifest request for the carrier API
|
99
|
+
|
100
|
+
payload: The standardized ManifestRequest from karrio
|
101
|
+
settings: The carrier connection settings
|
102
|
+
|
103
|
+
Returns a Serializable object that can be sent to the carrier API
|
104
|
+
"""
|
105
|
+
# Extract tracking numbers (shipments) to be included in the manifest
|
106
|
+
tracking_numbers = payload.shipments
|
107
|
+
|
108
|
+
{% if is_xml_api %}
|
109
|
+
# Example implementation for XML manifest request:
|
110
|
+
# import karrio.schemas.{{id}}.manifest_request as {{id}}_req
|
111
|
+
#
|
112
|
+
# shipment_list = []
|
113
|
+
# for tracking_number in tracking_numbers:
|
114
|
+
# shipment_list.append({{id}}_req.Shipment(
|
115
|
+
# tracking_number=tracking_number
|
116
|
+
# ))
|
117
|
+
#
|
118
|
+
# request = {{id}}_req.ManifestRequest(
|
119
|
+
# account_number=settings.account_number,
|
120
|
+
# close_date=payload.close_date or lib.today(),
|
121
|
+
# shipments=shipment_list
|
122
|
+
# )
|
123
|
+
#
|
124
|
+
# return lib.Serializable(
|
125
|
+
# request,
|
126
|
+
# lambda _: lib.to_xml(
|
127
|
+
# _,
|
128
|
+
# name_="ManifestRequest",
|
129
|
+
# namespacedef_='xmlns="http://{{id}}.com/schema/manifest"'
|
130
|
+
# )
|
131
|
+
# )
|
132
|
+
|
133
|
+
# For development, return a simple XML request
|
134
|
+
close_date = payload.close_date or lib.today()
|
135
|
+
shipments_xml = ""
|
136
|
+
for tracking_number in tracking_numbers:
|
137
|
+
shipments_xml += f" <shipment>\n <tracking-number>{tracking_number}</tracking-number>\n </shipment>\n"
|
138
|
+
|
139
|
+
request = f"""<?xml version="1.0"?>
|
140
|
+
<manifest-request>
|
141
|
+
<account-number>{settings.account_number}</account-number>
|
142
|
+
<close-date>{close_date}</close-date>
|
143
|
+
<shipments>
|
144
|
+
{shipments_xml} </shipments>
|
145
|
+
</manifest-request>"""
|
146
|
+
|
147
|
+
return lib.Serializable(request, lambda r: r)
|
148
|
+
{% else %}
|
149
|
+
# Example implementation for JSON manifest request:
|
150
|
+
# import karrio.schemas.{{id}}.manifest_request as {{id}}_req
|
151
|
+
#
|
152
|
+
# shipment_list = []
|
153
|
+
# for tracking_number in tracking_numbers:
|
154
|
+
# shipment_list.append({
|
155
|
+
# "trackingNumber": tracking_number
|
156
|
+
# })
|
157
|
+
#
|
158
|
+
# request = {{id}}_req.ManifestRequestType(
|
159
|
+
# accountNumber=settings.account_number,
|
160
|
+
# closeDate=payload.close_date or lib.today(),
|
161
|
+
# shipments=shipment_list
|
162
|
+
# )
|
163
|
+
#
|
164
|
+
# return lib.Serializable(request, lib.to_dict)
|
165
|
+
|
166
|
+
# For development, return a simple JSON request
|
167
|
+
shipment_list = []
|
168
|
+
for tracking_number in tracking_numbers:
|
169
|
+
shipment_list.append({
|
170
|
+
"trackingNumber": tracking_number
|
171
|
+
})
|
172
|
+
|
173
|
+
request = {
|
174
|
+
"accountNumber": settings.account_number,
|
175
|
+
"closeDate": str(payload.close_date or lib.today()),
|
176
|
+
"shipments": shipment_list
|
177
|
+
}
|
178
|
+
|
179
|
+
return lib.Serializable(request, lib.to_dict)
|
180
|
+
{% endif %}
|
181
|
+
'''
|
182
|
+
)
|
183
|
+
|
184
|
+
# XML schema templates for manifest operations
|
185
|
+
XML_SCHEMA_MANIFEST_REQUEST_TEMPLATE = Template("""<?xml version="1.0"?>
|
186
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://{{id}}.com/ws/manifest-request" xmlns="http://{{id}}.com/ws/manifest-request" elementFormDefault="qualified">
|
187
|
+
<xsd:element name="manifest-request">
|
188
|
+
<xsd:complexType>
|
189
|
+
<xsd:all>
|
190
|
+
<xsd:element name="account-number" type="xsd:string" minOccurs="0" />
|
191
|
+
<xsd:element name="close-date" type="xsd:date" />
|
192
|
+
<xsd:element name="shipments">
|
193
|
+
<xsd:complexType>
|
194
|
+
<xsd:sequence>
|
195
|
+
<xsd:element name="shipment" maxOccurs="unbounded">
|
196
|
+
<xsd:complexType>
|
197
|
+
<xsd:all>
|
198
|
+
<xsd:element name="tracking-number" type="xsd:string" />
|
199
|
+
</xsd:all>
|
200
|
+
</xsd:complexType>
|
201
|
+
</xsd:element>
|
202
|
+
</xsd:sequence>
|
203
|
+
</xsd:complexType>
|
204
|
+
</xsd:element>
|
205
|
+
</xsd:all>
|
206
|
+
</xsd:complexType>
|
207
|
+
</xsd:element>
|
208
|
+
</xsd:schema>
|
209
|
+
"""
|
210
|
+
)
|
211
|
+
|
212
|
+
XML_SCHEMA_MANIFEST_RESPONSE_TEMPLATE = Template(
|
213
|
+
"""<?xml version="1.0"?>
|
214
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://{{id}}.com/ws/manifest-response" xmlns="http://{{id}}.com/ws/manifest-response" elementFormDefault="qualified">
|
215
|
+
<xsd:element name="manifest-response">
|
216
|
+
<xsd:complexType>
|
217
|
+
<xsd:all>
|
218
|
+
<xsd:element name="manifest-id" type="xsd:string" />
|
219
|
+
<xsd:element name="manifest-url" type="xsd:string" minOccurs="0" />
|
220
|
+
<xsd:element name="manifest-document" type="xsd:base64Binary" minOccurs="0" />
|
221
|
+
<xsd:element name="status" type="xsd:string" />
|
222
|
+
<xsd:element name="shipment-count" type="xsd:integer" minOccurs="0" />
|
223
|
+
<xsd:element name="creation-date" type="xsd:dateTime" minOccurs="0" />
|
224
|
+
</xsd:all>
|
225
|
+
</xsd:complexType>
|
226
|
+
</xsd:element>
|
227
|
+
</xsd:schema>
|
228
|
+
"""
|
229
|
+
)
|
230
|
+
|
231
|
+
# JSON schema templates for manifest operations
|
232
|
+
JSON_SCHEMA_MANIFEST_REQUEST_TEMPLATE = Template(
|
233
|
+
"""{
|
234
|
+
"manifestRequest": {
|
235
|
+
"accountNumber": "123456",
|
236
|
+
"closeDate": "2023-06-01",
|
237
|
+
"shipments": [
|
238
|
+
{
|
239
|
+
"trackingNumber": "1Z12345E0205271688"
|
240
|
+
},
|
241
|
+
{
|
242
|
+
"trackingNumber": "1Z12345E0205271689"
|
243
|
+
}
|
244
|
+
]
|
245
|
+
}
|
246
|
+
}
|
247
|
+
"""
|
248
|
+
)
|
249
|
+
|
250
|
+
JSON_SCHEMA_MANIFEST_RESPONSE_TEMPLATE = Template(
|
251
|
+
"""{
|
252
|
+
"manifestResponse": {
|
253
|
+
"manifestId": "MAN123456",
|
254
|
+
"manifestUrl": "https://example.com/manifest/MAN123456",
|
255
|
+
"manifestData": "base64_encoded_manifest_data",
|
256
|
+
"status": "completed",
|
257
|
+
"shipmentCount": 2,
|
258
|
+
"creationDate": "2023-06-01T15:30:00Z"
|
259
|
+
}
|
260
|
+
}
|
261
|
+
"""
|
262
|
+
)
|
263
|
+
|
264
|
+
TEST_MANIFEST_TEMPLATE = Template('''"""{{name}} carrier manifest tests."""
|
265
|
+
|
266
|
+
import unittest
|
267
|
+
from unittest.mock import patch, ANY
|
268
|
+
from .fixture import gateway
|
269
|
+
import logging
|
270
|
+
import karrio.sdk as karrio
|
271
|
+
import karrio.lib as lib
|
272
|
+
import karrio.core.models as models
|
273
|
+
|
274
|
+
logger = logging.getLogger(__name__)
|
275
|
+
|
276
|
+
class Test{{compact_name}}Manifest(unittest.TestCase):
|
277
|
+
def setUp(self):
|
278
|
+
self.maxDiff = None
|
279
|
+
self.ManifestRequest = models.ManifestRequest(
|
280
|
+
shipments=["SHIP123456", "SHIP789012"]
|
281
|
+
)
|
282
|
+
|
283
|
+
def test_create_manifest_request(self):
|
284
|
+
request = gateway.mapper.create_manifest_request(self.ManifestRequest)
|
285
|
+
self.assertEqual(request.serialize(), ManifestRequest)
|
286
|
+
|
287
|
+
def test_create_manifest(self):
|
288
|
+
with patch("karrio.mappers.{{id}}.proxy.lib.request") as mock:
|
289
|
+
mock.return_value = "{}"
|
290
|
+
karrio.Manifest.create(self.ManifestRequest).from_(gateway)
|
291
|
+
self.assertEqual(
|
292
|
+
mock.call_args[1]["url"],
|
293
|
+
f"{gateway.settings.server_url}/manifests"
|
294
|
+
)
|
295
|
+
|
296
|
+
def test_parse_manifest_response(self):
|
297
|
+
with patch("karrio.mappers.{{id}}.proxy.lib.request") as mock:
|
298
|
+
mock.return_value = ManifestResponse
|
299
|
+
parsed_response = (
|
300
|
+
karrio.Manifest.create(self.ManifestRequest)
|
301
|
+
.from_(gateway)
|
302
|
+
.parse()
|
303
|
+
)
|
304
|
+
self.assertIsNotNone(parsed_response[0])
|
305
|
+
self.assertEqual(len(parsed_response[1]), 0)
|
306
|
+
self.assertEqual(parsed_response[0].carrier_name, "{{id}}")
|
307
|
+
|
308
|
+
def test_parse_error_response(self):
|
309
|
+
with patch("karrio.mappers.{{id}}.proxy.lib.request") as mock:
|
310
|
+
mock.return_value = ErrorResponse
|
311
|
+
parsed_response = (
|
312
|
+
karrio.Manifest.create(self.ManifestRequest)
|
313
|
+
.from_(gateway)
|
314
|
+
.parse()
|
315
|
+
)
|
316
|
+
self.assertIsNone(parsed_response[0])
|
317
|
+
self.assertEqual(len(parsed_response[1]), 1)
|
318
|
+
self.assertEqual(parsed_response[1][0].code, "manifest_error")
|
319
|
+
|
320
|
+
|
321
|
+
if __name__ == "__main__":
|
322
|
+
unittest.main()
|
323
|
+
|
324
|
+
|
325
|
+
ManifestResponse = {% if is_xml_api %}"""<?xml version="1.0"?>
|
326
|
+
<manifest-response>
|
327
|
+
<carrier-id>{{id}}</carrier-id>
|
328
|
+
<carrier-name>{{id}}</carrier-name>
|
329
|
+
<manifest>JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwogIC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAvTWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0KPj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAgL1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9udAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2JqCgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJUCjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4gCjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAwMDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G</manifest>
|
330
|
+
</manifest-response>"""{% else %}"""{
|
331
|
+
"carrier_id": "{{id}}",
|
332
|
+
"carrier_name": "{{id}}",
|
333
|
+
"manifest": "JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwogIC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAvTWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0KPj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAgL1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9udAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2JqCgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJUCjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4gCjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAwMDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9vdCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G"
|
334
|
+
}"""{% endif %}
|
335
|
+
|
336
|
+
ManifestRequest = {% if is_xml_api %}"""<?xml version="1.0"?>
|
337
|
+
<manifest-request>
|
338
|
+
<shipment-identifiers>
|
339
|
+
<shipment-identifier>SHIP123456</shipment-identifier>
|
340
|
+
<shipment-identifier>SHIP789012</shipment-identifier>
|
341
|
+
</shipment-identifiers>
|
342
|
+
<address>
|
343
|
+
<address-line1>123 Main Street</address-line1>
|
344
|
+
<city>Los Angeles</city>
|
345
|
+
<postal-code>90001</postal-code>
|
346
|
+
<country-code>US</country-code>
|
347
|
+
<state-code>CA</state-code>
|
348
|
+
<person-name>John Doe</person-name>
|
349
|
+
<company-name>Test Company</company-name>
|
350
|
+
<phone-number>555-123-4567</phone-number>
|
351
|
+
<email>john.doe@example.com</email>
|
352
|
+
</address>
|
353
|
+
<reference>REF123</reference>
|
354
|
+
<options>
|
355
|
+
<option>
|
356
|
+
<key>close_date</key>
|
357
|
+
<value>2023-07-01</value>
|
358
|
+
</option>
|
359
|
+
</options>
|
360
|
+
</manifest-request>"""{% else %}"""{
|
361
|
+
"shipmentIdentifiers": [
|
362
|
+
"SHIP123456",
|
363
|
+
"SHIP789012"
|
364
|
+
],
|
365
|
+
"address": {
|
366
|
+
"addressLine1": "123 Main Street",
|
367
|
+
"city": "Los Angeles",
|
368
|
+
"postalCode": "90001",
|
369
|
+
"countryCode": "US",
|
370
|
+
"stateCode": "CA",
|
371
|
+
"personName": "John Doe",
|
372
|
+
"companyName": "Test Company",
|
373
|
+
"phoneNumber": "555-123-4567",
|
374
|
+
"email": "john.doe@example.com"
|
375
|
+
},
|
376
|
+
"reference": "REF123",
|
377
|
+
"options": {
|
378
|
+
"close_date": "2023-07-01"
|
379
|
+
}
|
380
|
+
}"""{% endif %}
|
381
|
+
|
382
|
+
ErrorResponse = {% if is_xml_api %}"""<?xml version="1.0"?>
|
383
|
+
<error-response>
|
384
|
+
<e>
|
385
|
+
<code>manifest_error</code>
|
386
|
+
<message>Unable to create manifest</message>
|
387
|
+
<details>Invalid shipment identifiers provided</details>
|
388
|
+
</e>
|
389
|
+
</error-response>"""{% else %}"""{
|
390
|
+
"error": {
|
391
|
+
"code": "manifest_error",
|
392
|
+
"message": "Unable to create manifest",
|
393
|
+
"details": "Invalid shipment identifiers provided"
|
394
|
+
}
|
395
|
+
}"""{% endif %}'''
|
396
|
+
)
|