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
3 changes: 2 additions & 1 deletion official/guides/create-carrier-curls/amazonshipping.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ curl -X POST https://api.easypost.com/v2/carrier_accounts/register_oauth \
"carrier_account_oauth_registrations": {
"type": "AmazonShippingAccount",
"description": "My Shipping Account (optional)",
"reference": "Internal reference id (optional)"
"reference": "Internal reference id (optional)",
"return_to_url": "https://example.com (optional)"
}
}'
28 changes: 6 additions & 22 deletions official/guides/create-carrier-curls/ups.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
curl -X POST https://api.easypost.com/v2/carrier_accounts \
curl -X POST https://api.easypost.com/v2/carrier_accounts/register_oauth \
-u "$EASYPOST_API_KEY": \
-H 'Content-Type: application/json' \
-d '{
"carrier_account": {
"carrier_account_oauth_registrations": {
"type": "UpsAccount",
"description": "UpsAccount",
"registration_data": {
"account_number": "VALUE",
"city": "VALUE",
"company": "VALUE",
"country": "VALUE",
"email": "VALUE",
"name": "VALUE",
"phone": "VALUE",
"postal_code": "VALUE",
"state": "VALUE",
"street1": "VALUE",
"title": "VALUE",
"website": "VALUE",
"invoice_amount": "VALUE",
"invoice_control_id": "VALUE",
"invoice_currency": "VALUE",
"invoice_date": "VALUE",
"invoice_number": "VALUEr"
}
"account_number": "CUSTOMER UPS ACCOUNT NUMBER",
"description": "CUSTOMER ACCOUNT DESCRIPTION (optional)",
"reference": "UNIQUE ACCOUNT REFERENCE (optional)",
"return_to_url": "https://example.com (optional)"
}
}'
20 changes: 18 additions & 2 deletions tools/build_create_carrier_curl_requests/build_curls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"FedexSmartpostAccount",
]
UPS_CUSTOM_WORKFLOW_CARRIERS = [
"UpsAccount",
"UpsDapAccount",
]
CANADAPOST_CUSTOM_WORKFLOW_CARRIERS = [
"CanadaPostAccount",
]
OAUTH_CUSTOM_WORKFLOW_CARRIERS = [
"AmazonShippingAccount",
"UpsAccount"
]
MAERSK_CUSTOM_WORKFLOW_CARRIERS = [
"MaerskAccount"
Expand Down Expand Up @@ -188,13 +188,29 @@ def add_credential_structure(carrier_output: str, carrier: dict[str, str]) -> st
carrier_output += END_CHARS
carrier_output = carrier_output.replace(f"{LINE_BREAK_CHARS}{END_CHARS}", f"{END_CHARS}")
return carrier_output
# UPS OAuth
elif carrier["type"] == "UpsAccount":
carrier_account_json = {
"carrier_account_oauth_registrations": {
"type": "UpsAccount",
"account_number": "CUSTOMER UPS ACCOUNT NUMBER",
"description": "CUSTOMER ACCOUNT DESCRIPTION (optional)",
"reference": "UNIQUE ACCOUNT REFERENCE (optional)",
"return_to_url": "https://example.com (optional)"
}
}

carrier_output += f" -d '{json.dumps(carrier_account_json, indent=2)}'"
carrier_output += END_CHARS
return carrier_output
# Amazon Shipping
elif carrier["type"] in OAUTH_CUSTOM_WORKFLOW_CARRIERS:
carrier_account_json = {
"carrier_account_oauth_registrations": {
"type": carrier["type"],
"description": "My Shipping Account (optional)",
"reference": "Internal reference id (optional)"
"reference": "Internal reference id (optional)",
"return_to_url": "https://example.com (optional)"
}
}

Expand Down