All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.banxa.model.request.GetPaymentMethodsRequest Maven / Gradle / Ivy

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);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy