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

jp.gopay.sdk.builders.transactiontoken.AbstractTransactionTokensBuilders Maven / Gradle / Ivy

There is a newer version: 0.11.17
Show newest version
package jp.gopay.sdk.builders.transactiontoken;

import jp.gopay.sdk.builders.IdempotentRetrofitRequestBuilder;
import jp.gopay.sdk.builders.RetrofitRequestBuilder;
import jp.gopay.sdk.builders.RetrofitRequestBuilderPaginated;
import jp.gopay.sdk.models.common.*;
import jp.gopay.sdk.models.common.Void;
import jp.gopay.sdk.models.request.transactiontoken.PaymentData;
import jp.gopay.sdk.models.response.GoPayBinaryData;
import jp.gopay.sdk.models.response.transactiontoken.*;
import jp.gopay.sdk.types.*;
import jp.gopay.sdk.utils.MetadataAdapter;
import retrofit2.Retrofit;

import java.util.Date;

public abstract class AbstractTransactionTokensBuilders {

    public static abstract class AbstractDeleteTransactionTokenRequestBuilder
            extends RetrofitRequestBuilder {

        protected StoreId storeId;
        protected TransactionTokenId transactionTokenId;

        protected StoreId getStoreId() {
            return storeId;
        }

        protected TransactionTokenId getTransactionTokenId() {
            return transactionTokenId;
        }

        public AbstractDeleteTransactionTokenRequestBuilder(Retrofit retrofit, StoreId storeId, TransactionTokenId transactionTokenId) {
            super(retrofit);
            this.storeId = storeId;
            this.transactionTokenId = transactionTokenId;
        }

    }

    public static abstract class AbstractGetTransactionTokenRequestBuilder
            extends RetrofitRequestBuilder {

        protected StoreId storeId;
        protected TransactionTokenId transactionTokenId;

        protected StoreId getStoreId() {
            return storeId;
        }

        protected TransactionTokenId getTransactionTokenId() {
            return transactionTokenId;
        }

        public AbstractGetTransactionTokenRequestBuilder(Retrofit retrofit, StoreId storeId, TransactionTokenId transactionTokenId) {
            super(retrofit);
            this.storeId = storeId;
            this.transactionTokenId = transactionTokenId;
        }

    }


    public static abstract class AbstractCreateTransactionTokenRequestBuilder
            extends IdempotentRetrofitRequestBuilder {

        protected String email;
        protected RecurringTokenInterval usageLimit;
        protected PaymentData paymentData;
        protected TransactionTokenType type;
        protected MetadataMap metadata = new MetadataMap();

        protected String getEmail() {
            return email;
        }

        protected RecurringTokenInterval getUsageLimit() {
            return usageLimit;
        }

        protected MetadataMap getMetadata() {
            return metadata;
        }

        protected PaymentData getPaymentData() {
            return paymentData;
        }

        protected TransactionTokenType getType() {
            return type;
        }

        public AbstractCreateTransactionTokenRequestBuilder(Retrofit retrofit,
                                                    String email,
                                                    PaymentData paymentData,
                                                    TransactionTokenType type) {
            super(retrofit);
            this.paymentData = paymentData;
            this.email = email;
            this.type = type;
        }

        public B withUsageLimit(RecurringTokenInterval usageLimit){
            this.usageLimit = usageLimit;
            return (B)this;
        }


        public B withMetadata(MetadataMap metadata){
            this.metadata.putAll(metadata);
            return (B)this;
        }

        public  B withMetadata(T metadata, MetadataAdapter adapter) {
            this.metadata.putAll(adapter.serialize(metadata));
            return (B)this;
        }

        public B withCustomerId(GopayCustomerId customerId){
            this.metadata.put(GopayCustomerId.metadataKey, customerId.toString());
            return (B)this;
        }
    }

    public static abstract class AbstractUpdateTransactionTokenRequestBuilder
            extends IdempotentRetrofitRequestBuilder{

        protected String email;
        protected MetadataMap metadata = new MetadataMap();
        protected Integer cvv;
        protected StoreId storeId;
        protected TransactionTokenId transactionTokenId;

        protected String getAmount() {
            return email;
        }

        protected MetadataMap getMetadata() {
            return metadata;
        }

        protected Integer getCvv() {
            return cvv;
        }

        protected StoreId getStoreId() {
            return storeId;
        }

        protected TransactionTokenId getTransactionTokenId() {
            return transactionTokenId;
        }

        public AbstractUpdateTransactionTokenRequestBuilder(Retrofit retrofit, StoreId storeId, TransactionTokenId transactionTokenId) {
            super(retrofit);
            this.storeId = storeId;
            this.transactionTokenId = transactionTokenId;
        }

        public B withEmail(String email) {
            this.email = email;
            return (B) this;
        }

        public B withMetadata(MetadataMap metadata) {
            this.metadata.putAll(metadata);
            return (B) this;
        }

        public  B withMetadata(T metadata, MetadataAdapter adapter) {
            this.metadata.putAll(adapter.serialize(metadata));
            return (B)this;
        }

        public B withCustomerId(GopayCustomerId customerId){
            this.metadata.put(GopayCustomerId.metadataKey, customerId.toString());
            return (B)this;
        }

        public B withCvv(Integer cvv) {
            this.cvv = cvv;
            return (B)this;
        }

    }

    public static abstract class AbstractListTransactionTokensRequestBuilder
            extends RetrofitRequestBuilderPaginated{
        protected StoreId storeId;
        protected Boolean all;
        protected String search;
        protected GopayCustomerId customerId;
        protected ProcessingMode mode;
        protected TransactionTokenType type;

        public AbstractListTransactionTokensRequestBuilder(Retrofit retrofit, StoreId storeId) {
            super(retrofit);
            this.storeId = storeId;
        }

        public Boolean getAll() {
            return all;
        }

        public String getSearch() {
            return search;
        }

        public GopayCustomerId getCustomerId() {
            return customerId;
        }

        public ProcessingMode getMode() {
            return mode;
        }

        public TransactionTokenType getType() {
            return type;
        }

        protected StoreId getStoreId() {
            return storeId;
        }

        public B withListAll(Boolean all){
            this.all = all;
            return (B)this;
        }

        public B withSearch(String searchString) {
            this.search = searchString;
            return (B)this;
        }

        public B withCustomerId(GopayCustomerId customerId){
            this.customerId = customerId;
            return (B)this;
        }

        public B withMode(ProcessingMode mode){
            this.mode = mode;
            return (B)this;
        }

        public B withType(TransactionTokenType type){
            this.type = type;
            return (B)this;
        }

    }

    public static abstract class AbstractListTransactionTokensMerchantRequestBuilder
            extends RetrofitRequestBuilderPaginated {

        protected Boolean all;
        protected String search;
        protected GopayCustomerId customerId;
        protected ProcessingMode mode;
        protected TransactionTokenType type;

        public AbstractListTransactionTokensMerchantRequestBuilder(Retrofit retrofit) {
            super(retrofit);
        }

        protected String getSearch() {
            return search;
        }

        protected GopayCustomerId getCustomerId() {
            return customerId;
        }

        protected ProcessingMode getMode() {
            return mode;
        }

        public TransactionTokenType getType() {
            return type;
        }

        public Boolean getAll() {
            return all;
        }

        public B withListAll(Boolean all){
            this.all = all;
            return (B)this;
        }

        public B withSearch(String searchString) {
            this.search = searchString;
            return (B)this;
        }

        public B withCustomerId(GopayCustomerId customerId){
            this.customerId = customerId;
            return (B)this;
        }

        public B withMode(ProcessingMode mode){
            this.mode = mode;
            return (B)this;
        }

        public B withType(TransactionTokenType type){
            this.type = type;
            return (B)this;
        }

    }

    public static abstract class AbstractCreateTemporaryTokenAliasRequestBuilder
            extends IdempotentRetrofitRequestBuilder {

        protected TransactionTokenId transactionTokenId;
        protected Date validUntil;
        protected MoneyLike money;
        protected MetadataMap metadata;

        public AbstractCreateTemporaryTokenAliasRequestBuilder(Retrofit retrofit, TransactionTokenId transactionTokenId) {
            super(retrofit);
            this.transactionTokenId = transactionTokenId;
        }

        public TransactionTokenId getTransactionTokenId() {
            return transactionTokenId;
        }

        public Date getValidUntil() {
            return validUntil;
        }

        public MoneyLike getMoney() {
            return money;
        }

        public MetadataMap getMetadata() {
            return metadata;
        }

        public B withValidUntil(Date validUntil){
            this.validUntil = validUntil;
            return (B)this;
        }

        public B withMoney(MoneyLike money){
            this.money = money;
            return (B)this;
        }

        public B withMetadata(MetadataMap metadata){
            this.metadata = metadata;
            return (B)this;
        }

        public  B withMetadata(T metadata, MetadataAdapter adapter) {
            this.metadata = adapter.serialize(metadata);
            return (B)this;
        }
    }

    public static abstract class AbstractGetTemporaryTokenAliasRequestBuilder
            extends RetrofitRequestBuilder {

        protected StoreId storeId;
        protected TokenAliasKey aliasKey;

        public AbstractGetTemporaryTokenAliasRequestBuilder(Retrofit retrofit, StoreId storeId, TokenAliasKey aliasKey) {
            super(retrofit);
            this.storeId = storeId;
            this.aliasKey = aliasKey;
        }

        public StoreId getStoreId() {
            return storeId;
        }

        public TokenAliasKey getAliasKey() {
            return aliasKey;
        }
    }

    public static abstract class AbstractGetTemporaryTokenAliasAsImageRequestBuilder
            extends RetrofitRequestBuilder {

        protected StoreId storeId;
        protected TokenAliasKey aliasKey;
        protected Integer size;
        protected TemporaryTokenAliasQRLogo logoType;
        protected String color;

        public AbstractGetTemporaryTokenAliasAsImageRequestBuilder(Retrofit retrofit, StoreId storeId, TokenAliasKey aliasKey) {
            super(retrofit);
            this.storeId = storeId;
            this.aliasKey = aliasKey;
        }

        public StoreId getStoreId() {
            return storeId;
        }

        public TokenAliasKey getAliasKey() {
            return aliasKey;
        }

        public Integer getSize() {
            return size;
        }

        public TemporaryTokenAliasQRLogo getLogoType() {
            return logoType;
        }

        public String getColor() {
            return color;
        }

        public B withSize(Integer size){
            this.size = size;
            return (B)this;
        }

        public B withLogoType(TemporaryTokenAliasQRLogo logoType){
            this.logoType = logoType;
            return (B)this;
        }

        public B withColor(String color){
            this.color = color;
            return (B)this;
        }
    }

    public static abstract class AbstractDeleteTemporaryTokenAliasRequestBuilder
            extends RetrofitRequestBuilder {

        protected StoreId storeId;
        protected TokenAliasKey aliasKey;

        public AbstractDeleteTemporaryTokenAliasRequestBuilder(Retrofit retrofit, StoreId storeId, TokenAliasKey aliasKey) {
            super(retrofit);
            this.storeId = storeId;
            this.aliasKey = aliasKey;
        }

        public StoreId getStoreId() {
            return storeId;
        }

        public TokenAliasKey getAliasId() {
            return aliasKey;
        }
    }

}