com.banxa.model.request.GetPaymentMethodsRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
The Java SDK for integration with Banxa's API
The newest version!
package com.banxa.model.request;
import com.banxa.model.response.GetPaymentMethodsResponse;
import java.util.Map;
import java.util.TreeMap;
public class GetPaymentMethodsRequest extends GetRequest {
private static final String BASE_URI = "/api/payment-methods";
private final String source;
private final String target;
private GetPaymentMethodsRequest(Builder builder) {
this.source = builder.source;
this.target = builder.target;
}
@Override
public String getUri() {
Map uriParams = new TreeMap<>();
this.addUriParam(uriParams, "source", source);
this.addUriParam(uriParams, "target", target);
return appendUriParams(BASE_URI, uriParams);
}
@Override
public Class getResponseClass() {
return GetPaymentMethodsResponse.class;
}
public static Builder createBuyBuilder(String fiatCode, String coinCode) {
return new Builder().withSource(fiatCode).withTarget(coinCode);
}
public static Builder createSellBuilder(String fiatCode, String coinCode) {
return new Builder().withSource(coinCode).withTarget(fiatCode);
}
public static class Builder {
private String source;
private String target;
public Builder() {
}
public Builder withSource(String source) {
this.source = source;
return this;
}
public Builder withTarget(String target) {
this.target = target;
return this;
}
public GetPaymentMethodsRequest build() {
return new GetPaymentMethodsRequest(this);
}
}
}