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

jp.gopay.sdk.builders.bankaccount.BankAccountsBuilders Maven / Gradle / Ivy

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

import jp.gopay.sdk.builders.bankaccount.AbstractBankAccountsBuilders.*;
import jp.gopay.sdk.models.common.BankAccountId;
import jp.gopay.sdk.models.common.Void;
import jp.gopay.sdk.models.common.bankaccounts.BaseBankAccount;
import jp.gopay.sdk.models.request.bankaccount.BankAccountPatchData;
import jp.gopay.sdk.models.response.PaginatedList;
import jp.gopay.sdk.models.response.bankaccount.BankAccount;
import jp.gopay.sdk.resources.BankAccountsResource;
import retrofit2.Call;
import retrofit2.Retrofit;

public abstract class BankAccountsBuilders {

    public static class CreateBankAccountRequestBuilder
            extends AbstractCreateBankAccountRequestBuilder{

        public CreateBankAccountRequestBuilder(Retrofit retrofit, BaseBankAccount bankAccount) {
            super(retrofit, bankAccount);
        }

        @Override
        protected Call getRequest(BankAccountsResource resource) {
            return resource.create(bankAccount, idempotencyKey);
        }
    }

    public static class DeleteBankAccountRequestBuilder
            extends AbstractDeleteBankAccountRequestBuilder{

        public DeleteBankAccountRequestBuilder(Retrofit retrofit, BankAccountId bankAccountId) {
            super(retrofit, bankAccountId);
        }

        @Override
        protected Call getRequest(BankAccountsResource resource) {
            return resource.delete(bankAccountId);
        }
    }

    public static class GetBankAccountRequestBuilder
            extends AbstractGetBankAccountRequestBuilder{
        public GetBankAccountRequestBuilder(Retrofit retrofit, BankAccountId bankAccountId) {
            super(retrofit, bankAccountId);
        }

        @Override
        protected Call getRequest(BankAccountsResource resource) {
            return resource.get(bankAccountId);
        }
    }

    public static class ListAllBankAccountsRequestBuilder
            extends AbstractListAllBankAccountsRequestBuilder{

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

        @Override
        protected Call> getRequest(BankAccountsResource resource) {
            return resource.list(getLimit(), getCursorDirection(), getCursor());
        }
    }

    public static class GetPrimaryBankAccountRequestBuilder
            extends AbstractGetPrimaryBankAccountRequestBuilder{

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

        @Override
        protected Call getRequest(BankAccountsResource resource) {
            return resource.getPrimary();
        }
    }

    public static class UpdateBankAccountRequestBuilder
            extends AbstractUpdateBankAccountRequestBuilder{

        public UpdateBankAccountRequestBuilder(Retrofit retrofit, BankAccountId bankAccountId) {
            super(retrofit, bankAccountId);
        }

        @Override
        protected Call getRequest(BankAccountsResource resource) {
            return resource.update(bankAccountId,
                    new BankAccountPatchData(isPrimary, holderName, bankName, branchName, bankAddress, currency, accountNumber, swiftCode, routingNumber), idempotencyKey);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy