use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccount in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldUpdateMotoMaskCardSecurityCodeInputTrue.
@Test
public void shouldUpdateMotoMaskCardSecurityCodeInputTrue() {
JsonPatchRequest request = JsonPatchRequest.from(objectMapper.valueToTree(Map.of("op", "replace", "path", "moto_mask_card_security_code_input", "value", true)));
when(mockGatewayAccountDao.findById(GATEWAY_ACCOUNT_ID)).thenReturn(Optional.of(mockGatewayAccountEntity));
Optional<GatewayAccount> optionalGatewayAccount = gatewayAccountService.doPatch(GATEWAY_ACCOUNT_ID, request);
assertThat(optionalGatewayAccount.isPresent(), is(true));
verify(mockGatewayAccountEntity).setMotoMaskCardSecurityCodeInput(true);
verify(mockGatewayAccountDao).merge(mockGatewayAccountEntity);
}
use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccount in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldUpdateAllowZeroAmountFalse.
@Test
public void shouldUpdateAllowZeroAmountFalse() {
JsonPatchRequest request = JsonPatchRequest.from(objectMapper.valueToTree(Map.of("op", "replace", "path", "allow_zero_amount", "value", false)));
when(mockGatewayAccountDao.findById(GATEWAY_ACCOUNT_ID)).thenReturn(Optional.of(mockGatewayAccountEntity));
Optional<GatewayAccount> optionalGatewayAccount = gatewayAccountService.doPatch(GATEWAY_ACCOUNT_ID, request);
assertThat(optionalGatewayAccount.isPresent(), is(true));
verify(mockGatewayAccountEntity).setAllowZeroAmount(false);
verify(mockGatewayAccountDao).merge(mockGatewayAccountEntity);
}
use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccount in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldUpdateProviderSwitchEnabledToTrue.
@Test
public void shouldUpdateProviderSwitchEnabledToTrue() {
JsonPatchRequest request = JsonPatchRequest.from(objectMapper.valueToTree(Map.of("op", "replace", "path", "provider_switch_enabled", "value", true)));
when(mockGatewayAccountDao.findById(GATEWAY_ACCOUNT_ID)).thenReturn(Optional.of(mockGatewayAccountEntity));
when(mockGatewayAccountEntity.getId()).thenReturn(GATEWAY_ACCOUNT_ID);
when(mockGatewayAccountCredentialsService.hasActiveCredentials(GATEWAY_ACCOUNT_ID)).thenReturn(true);
Optional<GatewayAccount> optionalGatewayAccount = gatewayAccountService.doPatch(GATEWAY_ACCOUNT_ID, request);
assertThat(optionalGatewayAccount.isPresent(), is(true));
verify(mockGatewayAccountEntity).setProviderSwitchEnabled(true);
verify(mockGatewayAccountDao).merge(mockGatewayAccountEntity);
}
use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccount in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldUpdateSendPayerEmailToGatewayToTrue.
@Test
public void shouldUpdateSendPayerEmailToGatewayToTrue() {
JsonPatchRequest request = JsonPatchRequest.from(objectMapper.valueToTree(Map.of("op", "replace", "path", "send_payer_email_to_gateway", "value", true)));
when(mockGatewayAccountDao.findById(GATEWAY_ACCOUNT_ID)).thenReturn(Optional.of(mockGatewayAccountEntity));
Optional<GatewayAccount> optionalGatewayAccount = gatewayAccountService.doPatch(GATEWAY_ACCOUNT_ID, request);
assertThat(optionalGatewayAccount.isPresent(), is(true));
verify(mockGatewayAccountEntity).setSendPayerEmailToGateway(true);
verify(mockGatewayAccountDao).merge(mockGatewayAccountEntity);
}
use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccount in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldUpdateAllowMotoFalse.
@Test
public void shouldUpdateAllowMotoFalse() {
JsonPatchRequest request = JsonPatchRequest.from(objectMapper.valueToTree(Map.of("op", "replace", "path", "allow_moto", "value", false)));
when(mockGatewayAccountDao.findById(GATEWAY_ACCOUNT_ID)).thenReturn(Optional.of(mockGatewayAccountEntity));
Optional<GatewayAccount> optionalGatewayAccount = gatewayAccountService.doPatch(GATEWAY_ACCOUNT_ID, request);
assertThat(optionalGatewayAccount.isPresent(), is(true));
verify(mockGatewayAccountEntity).setAllowMoto(false);
verify(mockGatewayAccountDao).merge(mockGatewayAccountEntity);
}
Aggregations