Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions official/guides/create-carrier-curls/maersk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,29 @@ curl -X POST https://api.easypost.com/v2/carrier_accounts \
-d '{
"carrier_account": {
"type": "MaerskAccount",
"description": "MaerskAccount",
"description": "Maersk Account",
"reference": null,
"credentials": {
"account_key": "VALUE",
"account_number": "VALUE"
}
"first_name": "VALUE",
"last_name": "VALUE",
"company_name": "VALUE",
"email": "VALUE",
"phone": "VALUE",
"daily_number_of_shipments": "VALUE",
"channel": "VALUE",
"accepted_terms": "true",
"serial_number": "VALUE",
"origin_address_line_1": "VALUE",
"origin_address_line_2": "VALUE",
"origin_postal_code": "VALUE",
"origin_city": "VALUE",
"origin_state": "VALUE",
"billing_address_line_1": "VALUE",
"billing_address_line_2": "VALUE",
"billing_postal_code": "VALUE",
"billing_city": "VALUE",
"billing_state": "VALUE"
},
"test_credentials": {}
}
}'
3 changes: 2 additions & 1 deletion official/guides/create-carrier-curls/royalmailv3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ curl -X POST https://api.easypost.com/v2/carrier_accounts \
"internal_location_id": "VALUE",
"oba_access_code": "VALUE",
"oba_email_address": "VALUE",
"posting_location_number": "VALUE"
"posting_location_number": "VALUE",
"registered_billing_postcode": "VALUE"
}
}
}'
43 changes: 41 additions & 2 deletions tools/build_create_carrier_curl_requests/build_curls.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
"CanadaPostAccount",
]
OAUTH_CUSTOM_WORKFLOW_CARRIERS = [
"AmazonShippingAccount"
"AmazonShippingAccount",
]
MAERSK_CUSTOM_WORKFLOW_CARRIERS = [
"MaerskAccount"
]

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

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

return carrier_output
# Maersk Parcel — custom static credential structure
elif carrier["type"] in MAERSK_CUSTOM_WORKFLOW_CARRIERS:
carrier_account_json = {
"carrier_account": {
"type": "MaerskAccount",
"description": "Maersk Account",
"reference": None,
"credentials": {
"first_name": "VALUE",
"last_name": "VALUE",
"company_name": "VALUE",
"email": "VALUE",
"phone": "VALUE",
"daily_number_of_shipments": "VALUE",
"channel": "VALUE",
"accepted_terms": "true",
"serial_number": "VALUE",
"origin_address_line_1": "VALUE",
"origin_address_line_2": "VALUE",
"origin_postal_code": "VALUE",
"origin_city": "VALUE",
"origin_state": "VALUE",
"billing_address_line_1": "VALUE",
"billing_address_line_2": "VALUE",
"billing_postal_code": "VALUE",
"billing_city": "VALUE",
"billing_state": "VALUE"
},
"test_credentials": {}
}
}

carrier_output += f" -d '{json.dumps(carrier_account_json, indent=2)}'"
carrier_output += END_CHARS
carrier_output = carrier_output.replace(f"{LINE_BREAK_CHARS}{END_CHARS}", f"{END_CHARS}")
return carrier_output
# Amazon Shipping
elif carrier["type"] in OAUTH_CUSTOM_WORKFLOW_CARRIERS:
carrier_account_json = {
Expand Down