Skip to content

Commit a36982e

Browse files
Merge pull request #217 from hollyabrams/adding-carrier-curls
Added Maersk custom workflow and carrier curls
2 parents b3ab4f2 + 2116204 commit a36982e

3 files changed

Lines changed: 66 additions & 7 deletions

File tree

official/guides/create-carrier-curls/maersk.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,29 @@ curl -X POST https://api.easypost.com/v2/carrier_accounts \
44
-d '{
55
"carrier_account": {
66
"type": "MaerskAccount",
7-
"description": "MaerskAccount",
7+
"description": "Maersk Account",
8+
"reference": null,
89
"credentials": {
9-
"account_key": "VALUE",
10-
"account_number": "VALUE"
11-
}
10+
"first_name": "VALUE",
11+
"last_name": "VALUE",
12+
"company_name": "VALUE",
13+
"email": "VALUE",
14+
"phone": "VALUE",
15+
"daily_number_of_shipments": "VALUE",
16+
"channel": "VALUE",
17+
"accepted_terms": "true",
18+
"serial_number": "VALUE",
19+
"origin_address_line_1": "VALUE",
20+
"origin_address_line_2": "VALUE",
21+
"origin_postal_code": "VALUE",
22+
"origin_city": "VALUE",
23+
"origin_state": "VALUE",
24+
"billing_address_line_1": "VALUE",
25+
"billing_address_line_2": "VALUE",
26+
"billing_postal_code": "VALUE",
27+
"billing_city": "VALUE",
28+
"billing_state": "VALUE"
29+
},
30+
"test_credentials": {}
1231
}
1332
}'

official/guides/create-carrier-curls/royalmailv3.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ curl -X POST https://api.easypost.com/v2/carrier_accounts \
1818
"internal_location_id": "VALUE",
1919
"oba_access_code": "VALUE",
2020
"oba_email_address": "VALUE",
21-
"posting_location_number": "VALUE"
21+
"posting_location_number": "VALUE",
22+
"registered_billing_postcode": "VALUE"
2223
}
2324
}
2425
}'

tools/build_create_carrier_curl_requests/build_curls.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
"CanadaPostAccount",
2626
]
2727
OAUTH_CUSTOM_WORKFLOW_CARRIERS = [
28-
"AmazonShippingAccount"
28+
"AmazonShippingAccount",
29+
]
30+
MAERSK_CUSTOM_WORKFLOW_CARRIERS = [
31+
"MaerskAccount"
2932
]
3033

3134
def main():
@@ -119,7 +122,7 @@ def add_credential_structure(carrier_output: str, carrier: dict[str, str]) -> st
119122
carrier_output += end
120123
carrier_output = carrier_output.replace(f"{LINE_BREAK_CHARS}{END_CHARS}", f"{END_CHARS}")
121124

122-
# Default (aggregation) cURL
125+
# Default (aggregation) cURL
123126
default_output = f'# {carrier.get("type")} (EasyPost Aggregation)\n'
124127
default_output = add_curl_line(default_output, carrier)
125128
default_output = add_headers(default_output, carrier)
@@ -146,6 +149,42 @@ def add_credential_structure(carrier_output: str, carrier: dict[str, str]) -> st
146149
default_file.write(re.sub(r"^.*?\n", "", default_output))
147150

148151
return carrier_output
152+
# Maersk Parcel — custom static credential structure
153+
elif carrier["type"] in MAERSK_CUSTOM_WORKFLOW_CARRIERS:
154+
carrier_account_json = {
155+
"carrier_account": {
156+
"type": "MaerskAccount",
157+
"description": "Maersk Account",
158+
"reference": None,
159+
"credentials": {
160+
"first_name": "VALUE",
161+
"last_name": "VALUE",
162+
"company_name": "VALUE",
163+
"email": "VALUE",
164+
"phone": "VALUE",
165+
"daily_number_of_shipments": "VALUE",
166+
"channel": "VALUE",
167+
"accepted_terms": "true",
168+
"serial_number": "VALUE",
169+
"origin_address_line_1": "VALUE",
170+
"origin_address_line_2": "VALUE",
171+
"origin_postal_code": "VALUE",
172+
"origin_city": "VALUE",
173+
"origin_state": "VALUE",
174+
"billing_address_line_1": "VALUE",
175+
"billing_address_line_2": "VALUE",
176+
"billing_postal_code": "VALUE",
177+
"billing_city": "VALUE",
178+
"billing_state": "VALUE"
179+
},
180+
"test_credentials": {}
181+
}
182+
}
183+
184+
carrier_output += f" -d '{json.dumps(carrier_account_json, indent=2)}'"
185+
carrier_output += END_CHARS
186+
carrier_output = carrier_output.replace(f"{LINE_BREAK_CHARS}{END_CHARS}", f"{END_CHARS}")
187+
return carrier_output
149188
# Amazon Shipping
150189
elif carrier["type"] in OAUTH_CUSTOM_WORKFLOW_CARRIERS:
151190
carrier_account_json = {

0 commit comments

Comments
 (0)