Skip to content

Commit 6cfab49

Browse files
committed
chore: cleanup methods
1 parent 87e3a44 commit 6cfab49

2 files changed

Lines changed: 5 additions & 136 deletions

File tree

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.easypost.model;
22

3-
import com.google.gson.annotations.SerializedName;
43
import java.util.Map;
4+
55
import lombok.Getter;
66

77
@Getter
88
public final class FedExAccountValidationResponse extends EasyPostResource {
9-
@SerializedName("email_address")
109
private String emailAddress;
1110
private Map<String, String> options;
12-
@SerializedName("phone_number")
1311
private String phoneNumber;
1412
}

src/main/java/com/easypost/service/FedexRegistrationService.java

Lines changed: 4 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -22,52 +22,12 @@ public class FedexRegistrationService {
2222
this.client = client;
2323
}
2424

25-
/**
26-
* Register the billing address for a FedEx account.
27-
* Convenience method that automatically wraps parameters in the required structure.
28-
*
29-
* @param fedexAccountNumber The FedEx account number.
30-
* @param name The account name (use a unique identifier).
31-
* @param street1 Street address line 1.
32-
* @param city City.
33-
* @param state State/province code.
34-
* @param postalCode Postal/ZIP code.
35-
* @param countryCode Country code (e.g., "US").
36-
* @param carrierAccountId EasyPost carrier account ID to update.
37-
* @return FedExAccountValidationResponse object with next steps (PIN or invoice validation).
38-
* @throws EasyPostException when the request fails.
39-
*/
40-
public FedExAccountValidationResponse registerAddress(final String fedexAccountNumber, final String name,
41-
final String street1, final String city, final String state, final String postalCode,
42-
final String countryCode, final String carrierAccountId) throws EasyPostException {
43-
Map<String, Object> addressValidation = new HashMap<>();
44-
addressValidation.put("name", name);
45-
addressValidation.put("street1", street1);
46-
addressValidation.put("city", city);
47-
addressValidation.put("state", state);
48-
addressValidation.put("postal_code", postalCode);
49-
addressValidation.put("country_code", countryCode);
50-
51-
Map<String, Object> easypostDetails = new HashMap<>();
52-
easypostDetails.put("carrier_account_id", carrierAccountId);
53-
54-
Map<String, Object> params = new HashMap<>();
55-
params.put("address_validation", addressValidation);
56-
params.put("easypost_details", easypostDetails);
57-
58-
return registerAddress(fedexAccountNumber, params);
59-
}
60-
6125
/**
6226
* Register the billing address for a FedEx account.
6327
* Advanced method for custom parameter structures.
6428
*
6529
* @param fedexAccountNumber The FedEx account number.
66-
* @param params Map of parameters containing "address_validation" with address fields
67-
* (name, street1, city, state, postal_code, country_code).
68-
* If "address_validation.name" is not provided, a UUID will be
69-
* auto-generated.
70-
* Optional: "easypost_details" object with "carrier_account_id".
30+
* @param params Map of parameters.
7131
* @return FedExAccountValidationResponse object with next steps (PIN or invoice validation).
7232
* @throws EasyPostException when the request fails.
7333
*/
@@ -82,10 +42,9 @@ public FedExAccountValidationResponse registerAddress(final String fedexAccountN
8242

8343
/**
8444
* Request a PIN for FedEx account verification.
85-
* Convenience method that automatically wraps the PIN method in the required structure.
8645
*
8746
* @param fedexAccountNumber The FedEx account number.
88-
* @param pinMethodOption The PIN delivery method: "SMS", "CALL", or "EMAIL".
47+
* @param pinMethodOption The PIN delivery method: "SMS", "CALL", or "EMAIL".
8948
* @return FedExAccountValidationResponse object confirming PIN was sent.
9049
* @throws EasyPostException when the request fails.
9150
*/
@@ -100,60 +59,11 @@ public FedExAccountValidationResponse requestPin(final String fedexAccountNumber
10059
return requestPin(fedexAccountNumber, params);
10160
}
10261

103-
/**
104-
* Request a PIN for FedEx account verification.
105-
* Advanced method for custom parameter structures.
106-
*
107-
* @param fedexAccountNumber The FedEx account number.
108-
* @param params Map of parameters containing "pin_method" with "option" field.
109-
* The "option" value must be one of "SMS", "CALL", or "EMAIL".
110-
* Example: {"pin_method": {"option": "SMS"}}
111-
* @return FedExAccountValidationResponse object confirming PIN was sent.
112-
* @throws EasyPostException when the request fails.
113-
*/
114-
public FedExAccountValidationResponse requestPin(final String fedexAccountNumber, final Map<String, Object> params)
115-
throws EasyPostException {
116-
String endpoint = String.format("fedex_registrations/%s/pin", fedexAccountNumber);
117-
118-
return Requestor.request(RequestMethod.POST, endpoint, params, FedExAccountValidationResponse.class, client);
119-
}
120-
12162
/**
12263
* Validate the PIN entered by the user for FedEx account verification.
123-
* Convenience method that automatically wraps parameters in the required structure.
12464
*
12565
* @param fedexAccountNumber The FedEx account number.
126-
* @param pinCode The PIN code received by the user.
127-
* @param name The account name (use a unique identifier).
128-
* @param carrierAccountId EasyPost carrier account ID to update.
129-
* @return FedexRegistration object.
130-
* @throws EasyPostException when the request fails.
131-
*/
132-
public FedexRegistration validatePin(final String fedexAccountNumber, final String pinCode, final String name,
133-
final String carrierAccountId) throws EasyPostException {
134-
Map<String, Object> pinValidation = new HashMap<>();
135-
pinValidation.put("pin_code", pinCode);
136-
pinValidation.put("name", name);
137-
138-
Map<String, Object> easypostDetails = new HashMap<>();
139-
easypostDetails.put("carrier_account_id", carrierAccountId);
140-
141-
Map<String, Object> params = new HashMap<>();
142-
params.put("pin_validation", pinValidation);
143-
params.put("easypost_details", easypostDetails);
144-
145-
return validatePin(fedexAccountNumber, params);
146-
}
147-
148-
/**
149-
* Validate the PIN entered by the user for FedEx account verification.
150-
* Advanced method for custom parameter structures.
151-
*
152-
* @param fedexAccountNumber The FedEx account number.
153-
* @param params Map of parameters containing "pin_validation" with "pin_code" and
154-
* "name" fields. If "pin_validation.name" is not provided, a UUID will be
155-
* auto-generated.
156-
* Optional: "easypost_details" object with "carrier_account_id".
66+
* @param params Map of parameters.
15767
* @return FedexRegistration object.
15868
* @throws EasyPostException when the request fails.
15969
*/
@@ -167,48 +77,9 @@ public FedexRegistration validatePin(final String fedexAccountNumber, final Map<
16777

16878
/**
16979
* Submit invoice information to complete FedEx account registration.
170-
* Convenience method that automatically wraps parameters in the required structure.
171-
*
172-
* @param fedexAccountNumber The FedEx account number.
173-
* @param name The account name (use a unique identifier).
174-
* @param invoiceNumber The invoice number.
175-
* @param invoiceDate The invoice date (format: YYYY-MM-DD).
176-
* @param invoiceAmount The invoice amount (e.g., "100.00").
177-
* @param invoiceCurrency The invoice currency code (e.g., "USD").
178-
* @param carrierAccountId EasyPost carrier account ID to update.
179-
* @return FedexRegistration object.
180-
* @throws EasyPostException when the request fails.
181-
*/
182-
public FedexRegistration submitInvoice(final String fedexAccountNumber, final String name,
183-
final String invoiceNumber, final String invoiceDate, final String invoiceAmount,
184-
final String invoiceCurrency, final String carrierAccountId) throws EasyPostException {
185-
Map<String, Object> invoiceValidation = new HashMap<>();
186-
invoiceValidation.put("name", name);
187-
invoiceValidation.put("invoice_number", invoiceNumber);
188-
invoiceValidation.put("invoice_date", invoiceDate);
189-
invoiceValidation.put("invoice_amount", invoiceAmount);
190-
invoiceValidation.put("invoice_currency", invoiceCurrency);
191-
192-
Map<String, Object> easypostDetails = new HashMap<>();
193-
easypostDetails.put("carrier_account_id", carrierAccountId);
194-
195-
Map<String, Object> params = new HashMap<>();
196-
params.put("invoice_validation", invoiceValidation);
197-
params.put("easypost_details", easypostDetails);
198-
199-
return submitInvoice(fedexAccountNumber, params);
200-
}
201-
202-
/**
203-
* Submit invoice information to complete FedEx account registration.
204-
* Advanced method for custom parameter structures.
20580
*
20681
* @param fedexAccountNumber The FedEx account number.
207-
* @param params Map of parameters containing "invoice_validation" with invoice fields
208-
* (name, invoice_number, invoice_date, invoice_amount, invoice_currency).
209-
* If "invoice_validation.name" is not provided, a UUID will be
210-
* auto-generated.
211-
* Optional: "easypost_details" object with "carrier_account_id".
82+
* @param params Map of parameters.
21283
* @return FedexRegistration object.
21384
* @throws EasyPostException when the request fails.
21485
*/

0 commit comments

Comments
 (0)