xendit-java icon indicating copy to clipboard operation
xendit-java copied to clipboard

Provide More Method in Building Request

Open kevindavee opened this issue 5 years ago • 1 comments

For credit card charge example:

  public static CreditCardCharge createAuthorization(
      String tokenId,
      String externalId,
      Number amount,
      String authenticationId,
      String cardCVN,
      Boolean capture)

understand this is only for the required parameters. if the user wants to use the client method with optional fields, she will need to use the createAuthorization(Map<String, Object> params) function. I'm personally not super keen on letting users use this as we are losing the entire advantage of a typed language to hint to devs on what are the required parameters of the function.

We can look at including a CreateAuthorizationParams object to specify what is required/not required and let users create the request params as the argument to the client method. One drawback is if we change our API specs (adding new fields) is that we might need to update the client. But I guess we can still have the createAuthorization(Map<String, Object> params) method to have some flexibility for certain users

kevindavee avatar Feb 17 '20 07:02 kevindavee