diff --git a/official/guides/create-carrier-curls/amazonshipping.sh b/official/guides/create-carrier-curls/amazonshipping.sh index cd223136..caec2fa1 100644 --- a/official/guides/create-carrier-curls/amazonshipping.sh +++ b/official/guides/create-carrier-curls/amazonshipping.sh @@ -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)" } }' diff --git a/official/guides/create-carrier-curls/ups.sh b/official/guides/create-carrier-curls/ups.sh index 07ab49ea..003ff491 100644 --- a/official/guides/create-carrier-curls/ups.sh +++ b/official/guides/create-carrier-curls/ups.sh @@ -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)" } }' diff --git a/tools/build_create_carrier_curl_requests/build_curls.py b/tools/build_create_carrier_curl_requests/build_curls.py index 26e000dc..ac9f7869 100644 --- a/tools/build_create_carrier_curl_requests/build_curls.py +++ b/tools/build_create_carrier_curl_requests/build_curls.py @@ -18,7 +18,6 @@ "FedexSmartpostAccount", ] UPS_CUSTOM_WORKFLOW_CARRIERS = [ - "UpsAccount", "UpsDapAccount", ] CANADAPOST_CUSTOM_WORKFLOW_CARRIERS = [ @@ -26,6 +25,7 @@ ] OAUTH_CUSTOM_WORKFLOW_CARRIERS = [ "AmazonShippingAccount", + "UpsAccount" ] MAERSK_CUSTOM_WORKFLOW_CARRIERS = [ "MaerskAccount" @@ -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)" } }