use of uk.gov.pay.connector.app.ConnectorConfiguration in project pay-connector by alphagov.
the class SmartpayPaymentProviderTest method getSmartpayPaymentProvider.
private PaymentProvider getSmartpayPaymentProvider() {
Client client = TestClientFactory.createJerseyClient();
GatewayClient gatewayClient = new GatewayClient(client, mockMetricRegistry);
GatewayClientFactory gatewayClientFactory = mock(GatewayClientFactory.class);
when(gatewayClientFactory.createGatewayClient(any(PaymentGatewayName.class), any(MetricRegistry.class))).thenReturn(gatewayClient);
GatewayConfig gatewayConfig = mock(GatewayConfig.class);
when(gatewayConfig.getUrls()).thenReturn(Map.of(TEST.toString(), url));
ConnectorConfiguration configuration = mock(ConnectorConfiguration.class);
when(configuration.getGatewayConfigFor(SMARTPAY)).thenReturn(gatewayConfig);
return new SmartpayPaymentProvider(configuration, gatewayClientFactory, mockEnvironment);
}
use of uk.gov.pay.connector.app.ConnectorConfiguration in project pay-connector by alphagov.
the class HistoricalEventEmitterServiceTest method setUp.
@Before
public void setUp() {
connectorConfiguration = new ConnectorConfiguration();
historicalEventEmitterService = new HistoricalEventEmitterService(chargeDao, refundDao, chargeEventDao, emittedEventDao, stateTransitionService, eventService, chargeService, connectorConfiguration);
CardDetailsEntity cardDetails = mock(CardDetailsEntity.class);
when(cardDetails.getLastDigitsCardNumber()).thenReturn(LastDigitsCardNumber.of("1234"));
chargeEntity = ChargeEntityFixture.aValidChargeEntity().withCardDetails(cardDetails).build();
ChargeEventEntity chargeEventEntity = ChargeEventEntityFixture.aValidChargeEventEntity().withTimestamp(ZonedDateTime.ofInstant(chargeEntity.getCreatedDate(), ZoneOffset.UTC)).withCharge(chargeEntity).withChargeStatus(ChargeStatus.CREATED).build();
chargeEntity.getEvents().add(chargeEventEntity);
}
use of uk.gov.pay.connector.app.ConnectorConfiguration in project pay-connector by alphagov.
the class LedgerServiceTest method setUp.
@Before
public void setUp() {
Client mockClient = mock(Client.class);
ConnectorConfiguration mockConnectorConfiguration = mock(ConnectorConfiguration.class);
WebTarget mockWebTarget = mock(WebTarget.class);
Invocation.Builder mockBuilder = mock(Invocation.Builder.class);
mockResponse = mock(Response.class);
when(mockConnectorConfiguration.getLedgerBaseUrl()).thenReturn("http://ledgerUrl");
when(mockClient.target(any(UriBuilder.class))).thenReturn(mockWebTarget);
when(mockWebTarget.request()).thenReturn(mockBuilder);
when(mockBuilder.accept(APPLICATION_JSON)).thenReturn(mockBuilder);
when(mockBuilder.get()).thenReturn(mockResponse);
when(mockResponse.getStatus()).thenReturn(SC_OK);
ledgerService = new LedgerService(mockClient, mockConnectorConfiguration);
}
use of uk.gov.pay.connector.app.ConnectorConfiguration in project pay-connector by alphagov.
the class Card3dsResponseAuthServiceTest method setUpCardAuthorisationService.
@Before
public void setUpCardAuthorisationService() {
Environment mockEnvironment = mock(Environment.class);
Counter mockCounter = mock(Counter.class);
when(mockEnvironment.metrics()).thenReturn(mockMetricRegistry);
when(mockMetricRegistry.counter(anyString())).thenReturn(mockCounter);
ConnectorConfiguration mockConfiguration = mock(ConnectorConfiguration.class);
when(mockConfiguration.getAuthorisation3dsConfig()).thenReturn(mockAuthorisation3dsConfig);
chargeService = new ChargeService(null, mockedChargeDao, mockedChargeEventDao, null, null, mockConfiguration, null, mockStateTransitionService, ledgerService, mockedRefundService, mockEventService, mockGatewayAccountCredentialsService, northAmericanRegionMapper, mockTaskQueueService);
AuthorisationService authorisationService = new AuthorisationService(mockExecutorService, mockEnvironment);
card3dsResponseAuthService = new Card3dsResponseAuthService(mockedProviders, chargeService, authorisationService, mockConfiguration);
}
use of uk.gov.pay.connector.app.ConnectorConfiguration in project pay-connector by alphagov.
the class DropwizardTestApplications method getTestContextOf.
static TestContext getTestContextOf(Class<? extends Application<?>> appClass, String configClasspathLocation, WireMockServer wireMockServer) {
Pair<Class<? extends Application>, String> appConfig = Pair.of(appClass, configClasspathLocation);
DropwizardTestSupport application = apps.get(appConfig);
return new TestContext(application.getLocalPort(), ((ConnectorConfiguration) application.getConfiguration()), InjectorLookup.getInjector(application.getApplication()).get(), wireMockServer);
}
Aggregations