@@ -88,14 +88,9 @@ public List<CarrierAccount> all(final Map<String, Object> params) throws EasyPos
8888 * @throws EasyPostException when the request fails.
8989 */
9090 public CarrierAccount update (String id , final Map <String , Object > params ) throws EasyPostException {
91- CarrierAccount carrierAccount = this .retrieve (id );
92- String type = (String ) carrierAccount .getType ();
91+ String endpoint = "carrier_accounts/" + id ;
9392 Map <String , Object > wrappedParams = new HashMap <String , Object >();
94- wrappedParams .put (selectTopLayerKey (type ), params );
95-
96- String endpoint = (Constants .CarrierAccountTypes .UPS_OAUTH_CARRIER_ACCOUNT_TYPES .contains (type )
97- ? "ups_oauth_registrations/"
98- : "carrier_accounts/" ) + id ;
93+ wrappedParams .put ("carrier_account" , params );
9994
10095 return Requestor .request (RequestMethod .PUT , endpoint , wrappedParams , CarrierAccount .class ,
10196 client );
@@ -123,8 +118,6 @@ public void delete(String id) throws EasyPostException {
123118 private static String selectCarrierAccountCreationEndpoint (final String carrierAccountType ) {
124119 if (Constants .CarrierAccountTypes .CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_WORKFLOW .contains (carrierAccountType )) {
125120 return "carrier_accounts/register" ;
126- } else if (Constants .CarrierAccountTypes .UPS_OAUTH_CARRIER_ACCOUNT_TYPES .contains (carrierAccountType )) {
127- return "ups_oauth_registrations" ;
128121 } else if (Constants .CarrierAccountTypes .CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH .contains (carrierAccountType )) {
129122 return "carrier_accounts/register_oauth" ;
130123 } else {
@@ -146,9 +139,7 @@ private static String selectTopLayerKey(final String carrierAccountType) throws
146139 String .format (Constants .ErrorMessages .MISSING_REQUIRED_PARAMETER , "carrier account type" ));
147140 }
148141
149- if (Constants .CarrierAccountTypes .UPS_OAUTH_CARRIER_ACCOUNT_TYPES .contains (carrierAccountType )) {
150- return "ups_oauth_registrations" ;
151- } else if (Constants .CarrierAccountTypes .CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH .contains (carrierAccountType )) {
142+ if (Constants .CarrierAccountTypes .CARRIER_ACCOUNT_TYPES_WITH_CUSTOM_OAUTH .contains (carrierAccountType )) {
152143 return "carrier_account_oauth_registrations" ;
153144 } else {
154145 return "carrier_account" ;
0 commit comments