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

jp.gopay.sdk.builders.store.StoreBuilders Maven / Gradle / Ivy

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

import jp.gopay.sdk.builders.store.AbstractStoreBuilders.*;
import jp.gopay.sdk.models.common.Domain;
import jp.gopay.sdk.models.common.GopayCustomerId;
import jp.gopay.sdk.models.common.StoreId;
import jp.gopay.sdk.models.common.Void;
import jp.gopay.sdk.models.request.configuration.StoreConfigurationRequest;
import jp.gopay.sdk.models.request.store.CustomerIdRequest;
import jp.gopay.sdk.models.request.store.StoreCreateData;
import jp.gopay.sdk.models.response.PaginatedList;
import jp.gopay.sdk.models.response.store.CheckoutInfo;
import jp.gopay.sdk.models.response.store.Store;
import jp.gopay.sdk.models.response.store.StoreWithConfiguration;
import jp.gopay.sdk.resources.StoresResource;
import jp.gopay.sdk.utils.builders.ConfigurationBuilder;
import retrofit2.Call;
import retrofit2.Retrofit;

public abstract class StoreBuilders {

    public static class ListStoresRequestBuilder
            extends AbstractListStoresRequestBuilder{

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

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

    public static class DeleteStoreRequestBuilder
            extends AbstractDeleteStoreRequestBuilder{

        public DeleteStoreRequestBuilder(Retrofit retrofit, StoreId storeId) {
            super(retrofit, storeId);
        }

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.delete(storeId);
        }

    }

    public static class GetStoreRequestBuilder
            extends AbstractGetStoreRequestBuilder{

        public GetStoreRequestBuilder(Retrofit retrofit, StoreId storeId) {
            super(retrofit, storeId);
        }

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.get(storeId);
        }

    }

    public static class UpdateStoreRequestBuilder
            extends AbstractUpdateStoreRequestBuilder{

        public UpdateStoreRequestBuilder(Retrofit retrofit, StoreId storeId) {
            super(retrofit, storeId);
        }

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.update(storeId, new StoreCreateData(name,
                    new ConfigurationBuilder()
                            .withLogoUrl(logoUrl)
                            .withCountry(country)
                            .withLanguage(language)
                            .withTimeZone(timeZone)
                            .withUserTransactionsConfiguration(userTransactionsConfiguration)
                            .withCardConfiguration(cardConfiguration)
                            .withQrScanConfiguration(qrScanConfiguration)
                            .withConvenienceConfiguration(convenienceConfiguration)
                            .withPaidyConfiguration(paidyConfiguration)
                            .withRecurringConfiguration(recurringTokenConfiguration)
                            .withSecurityConfiguration(securityConfiguration)
                            .withCardBrandPercentFees(cardBrandPercentFees)
                            .withSubscriptionConfiguration(subscriptionConfiguration)
                            .build()
            ), idempotencyKey);
        }
    }

    public static class CreateStoreRequestBuilder
            extends AbstractCreateStoreRequestBuilder{

        public CreateStoreRequestBuilder(Retrofit retrofit, String name) {
            super(retrofit, name);
        }

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.create(new StoreCreateData(name, new ConfigurationBuilder()
                    .withLogoUrl(logoUrl)
                    .withLanguage(language)
                    .withCountry(country)
                    .withTimeZone(timeZone)
                    .withUserTransactionsConfiguration(userTransactionsConfiguration)
                    .withCardConfiguration(cardConfiguration)
                    .withQrScanConfiguration(qrScanConfiguration)
                    .withConvenienceConfiguration(convenienceConfiguration)
                    .withPaidyConfiguration(paidyConfiguration)
                    .withRecurringConfiguration(recurringTokenConfiguration)
                    .withSecurityConfiguration(securityConfiguration)
                    .withCardBrandPercentFees(cardBrandPercentFees)
                    .withSubscriptionConfiguration(subscriptionConfiguration)
                    .build()), idempotencyKey);
        }

    }

    public static class GetCheckoutInfoRequestBuilder
            extends AbstractGetCheckoutInfoRequestBuilder{

        public GetCheckoutInfoRequestBuilder(Retrofit retrofit, Domain origin) {
            super(retrofit, origin);
        }

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

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.getCheckoutInfo(origin);
        }
    }

    public static class CreateCustomerIdRequestBuilder
            extends AbstractCreateCustomerIdRequestBuilder{

        public CreateCustomerIdRequestBuilder(Retrofit retrofit, StoreId storeId, String customerId) {
            super(retrofit, storeId, customerId);
        }

        @Override
        protected Call getRequest(StoresResource resource) {
            return resource.createCustomerId(storeId, new CustomerIdRequest(customerId));
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy