@@ -15,7 +15,7 @@ public class CreditCard extends BaseCreditCard {
1515 * @return CreditCardFund object.
1616 * @throws EasyPostException when the request fails.
1717 */
18- public static CreditCardFund fund (String amount , CreditCardPriority primaryOrSecondary ) throws EasyPostException {
18+ public static boolean fund (String amount , CreditCardPriority primaryOrSecondary ) throws EasyPostException {
1919 return fund (amount , primaryOrSecondary , null );
2020 }
2121
@@ -28,7 +28,7 @@ public static CreditCardFund fund(String amount, CreditCardPriority primaryOrSec
2828 * @return CreditCardFund object.
2929 * @throws EasyPostException when the request fails.
3030 */
31- public static CreditCardFund fund (String amount , CreditCardPriority primaryOrSecondary , String apiKey )
31+ public static boolean fund (String amount , CreditCardPriority primaryOrSecondary , String apiKey )
3232 throws EasyPostException {
3333 PaymentMethod paymentMethods = PaymentMethod .all ();
3434 String cardID = null ;
@@ -44,16 +44,18 @@ public static CreditCardFund fund(String amount, CreditCardPriority primaryOrSec
4444 break ;
4545 }
4646
47- if (cardID == null || cardID . isEmpty () || !cardID .startsWith ("card_" )) {
47+ if (cardID == null || !cardID .startsWith ("card_" )) {
4848 throw new EasyPostException ("The chosen payment method is not a credit card. Please try again." );
4949 }
5050
5151 Map <String , Object > params = new HashMap <String , Object >();
5252 params .put ("amount" , amount );
5353
54- return request (RequestMethod .POST ,
55- String .format ("%s/%s/%s/%s" , EasyPost .API_BASE , "credit_cards" , cardID , "charges" ), params ,
56- CreditCardFund .class , apiKey );
54+ // will attempt to serialize the empty response to a CreditCard object (doesn't matter)
55+ request (RequestMethod .POST , String .format ("%s/%s/%s/%s" , EasyPost .API_BASE , "credit_cards" , cardID , "charges" ),
56+ params , CreditCard .class , apiKey );
57+
58+ return true ;
5759 }
5860
5961 /**
0 commit comments