Search in sources :

Example 1 with LinksDecorator

use of uk.gov.pay.products.service.LinksDecorator in project pay-products by alphagov.

the class ProductsModule method configure.

@Override
protected void configure() {
    final Client client = RestClientFactory.buildClient(configuration.getRestClientConfiguration());
    bind(Client.class).toInstance(client);
    bind(ProductsConfiguration.class).toInstance(configuration);
    bind(DataSourceFactory.class).toInstance(configuration.getDataSourceFactory());
    bind(MetricRegistry.class).toInstance(environment.metrics());
    bind(Environment.class).toInstance(environment);
    bind(RequestValidations.class).in(Singleton.class);
    bind(ProductRequestValidator.class).in(Singleton.class);
    bind(LinksDecorator.class).toInstance(new LinksDecorator(configuration.getBaseUrl(), configuration.getProductsUiPayUrl(), configuration.getFriendlyBaseUri()));
    bind(ProductFinder.class).in(Singleton.class);
    bind(PaymentFinder.class).in(Singleton.class);
    bind(ProductApiTokenManager.class).in(Singleton.class);
    bind(PublicApiRestClient.class).toInstance(new PublicApiRestClient(client, configuration.getPublicApiUrl()));
    install(jpaModule(configuration));
    install(new FactoryModuleBuilder().build(ProductFactory.class));
    install(new FactoryModuleBuilder().build(PaymentFactory.class));
}
Also used : ProductRequestValidator(uk.gov.pay.products.validations.ProductRequestValidator) DataSourceFactory(io.dropwizard.db.DataSourceFactory) ProductApiTokenManager(uk.gov.pay.products.service.ProductApiTokenManager) ProductFactory(uk.gov.pay.products.service.ProductFactory) FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) MetricRegistry(com.codahale.metrics.MetricRegistry) LinksDecorator(uk.gov.pay.products.service.LinksDecorator) PaymentFinder(uk.gov.pay.products.service.PaymentFinder) PublicApiRestClient(uk.gov.pay.products.client.publicapi.PublicApiRestClient) ProductFinder(uk.gov.pay.products.service.ProductFinder) Environment(io.dropwizard.setup.Environment) RequestValidations(uk.gov.pay.products.validations.RequestValidations) PublicApiRestClient(uk.gov.pay.products.client.publicapi.PublicApiRestClient) Client(javax.ws.rs.client.Client) PaymentFactory(uk.gov.pay.products.service.PaymentFactory)

Aggregations

MetricRegistry (com.codahale.metrics.MetricRegistry)1 FactoryModuleBuilder (com.google.inject.assistedinject.FactoryModuleBuilder)1 DataSourceFactory (io.dropwizard.db.DataSourceFactory)1 Environment (io.dropwizard.setup.Environment)1 Client (javax.ws.rs.client.Client)1 PublicApiRestClient (uk.gov.pay.products.client.publicapi.PublicApiRestClient)1 LinksDecorator (uk.gov.pay.products.service.LinksDecorator)1 PaymentFactory (uk.gov.pay.products.service.PaymentFactory)1 PaymentFinder (uk.gov.pay.products.service.PaymentFinder)1 ProductApiTokenManager (uk.gov.pay.products.service.ProductApiTokenManager)1 ProductFactory (uk.gov.pay.products.service.ProductFactory)1 ProductFinder (uk.gov.pay.products.service.ProductFinder)1 ProductRequestValidator (uk.gov.pay.products.validations.ProductRequestValidator)1 RequestValidations (uk.gov.pay.products.validations.RequestValidations)1