use of uk.gov.pay.connector.gateway.sandbox.SandboxPaymentProvider in project pay-connector by alphagov.
the class EventFactoryTest method setUp.
@Before
public void setUp() {
chargeService = mock(ChargeService.class);
refundDao = mock(RefundDao.class);
refundService = mock(RefundService.class);
chargeEventDao = mock(ChargeEventDao.class);
paymentProviders = mock(PaymentProviders.class);
PaymentProvider paymentProvider = new SandboxPaymentProvider();
when(paymentProviders.byName(any(PaymentGatewayName.class))).thenReturn(paymentProvider);
eventFactory = new EventFactory(chargeService, refundDao, refundService, chargeEventDao, paymentProviders);
}
use of uk.gov.pay.connector.gateway.sandbox.SandboxPaymentProvider in project pay-connector by alphagov.
the class ParityCheckServiceTest method setUp.
@Before
public void setUp() {
ChargeEventEntity chargeEventCreated = createChargeEventEntity(CREATED, "2016-01-25T13:23:55Z");
ChargeEventEntity chargeEventCaptured = createChargeEventEntity(CAPTURED, "2016-01-26T14:23:55Z");
ChargeEventEntity chargeEventCaptureSubmitted = createChargeEventEntity(CAPTURE_SUBMITTED, "2016-01-26T13:23:55Z");
chargeEntity = aValidChargeEntity().withStatus(CAPTURED).withCardDetails(defaultCardDetails()).withGatewayAccountEntity(defaultGatewayAccountEntity()).withMoto(true).withSource(CARD_PAYMENT_LINK).withFee(Fee.of(null, 10L)).withCorporateSurcharge(25L).withWalletType(APPLE_PAY).withDelayedCapture(true).withEvents(List.of(chargeEventCreated, chargeEventCaptured, chargeEventCaptureSubmitted)).build();
refundEntity = RefundEntityFixture.aValidRefundEntity().withStatus(REFUNDED).build();
when(mockRefundService.findRefunds(any())).thenReturn(refundEntities.stream().map(Refund::from).collect(Collectors.toList()));
when(mockProviders.byName(any())).thenReturn(new SandboxPaymentProvider());
parityCheckService = new ParityCheckService(mockLedgerService, mockChargeService, mockHistoricalEventEmitter, chargeParityChecker, refundParityChecker, mockRefundService);
}
use of uk.gov.pay.connector.gateway.sandbox.SandboxPaymentProvider in project pay-connector by alphagov.
the class ChargeParityCheckerTest method setUp.
@Before
public void setUp() {
ChargeEventEntity chargeEventCreated = createChargeEventEntity(CREATED, "2016-01-25T13:23:55Z");
ChargeEventEntity chargeEventCaptured = createChargeEventEntity(CAPTURED, "2016-01-26T14:23:55Z");
ChargeEventEntity chargeEventCaptureSubmitted = createChargeEventEntity(CAPTURE_SUBMITTED, "2016-01-26T13:23:55Z");
Auth3dsRequiredEntity auth3dsRequiredEntity = anAuth3dsRequiredEntity().withThreeDsVersion("2.1.0").build();
chargeEntity = aValidChargeEntity().withStatus(CAPTURED).withCardDetails(defaultCardDetails()).withGatewayAccountEntity(defaultGatewayAccountEntity()).withMoto(true).withSource(CARD_PAYMENT_LINK).withFee(Fee.of(null, 10L)).withCorporateSurcharge(25L).withWalletType(APPLE_PAY).withDelayedCapture(true).withEvents(List.of(chargeEventCreated, chargeEventCaptured, chargeEventCaptureSubmitted)).build();
chargeEntityWith3ds = aValidChargeEntity().withStatus(CAPTURED).withEvents(List.of(chargeEventCreated, chargeEventCaptured, chargeEventCaptureSubmitted)).withAuth3dsDetailsEntity(auth3dsRequiredEntity).build();
when(mockRefundService.findRefunds(any())).thenReturn(List.of());
when(mockProviders.byName(any())).thenReturn(new SandboxPaymentProvider());
Logger root = (Logger) LoggerFactory.getLogger(ChargeParityChecker.class);
root.setLevel(Level.INFO);
root.addAppender(mockAppender);
}
use of uk.gov.pay.connector.gateway.sandbox.SandboxPaymentProvider in project pay-connector by alphagov.
the class ParityCheckerServiceTest method setUp.
@Before
public void setUp() {
when(mockProviders.byName(any())).thenReturn(new SandboxPaymentProvider());
refundParityChecker = new RefundParityChecker(refundDao);
parityCheckService = new ParityCheckService(ledgerService, chargeService, historicalEventEmitter, chargeParityChecker, refundParityChecker, refundService);
parityCheckerService = new ParityCheckerService(chargeDao, chargeService, emittedEventDao, stateTransitionService, eventService, refundService, refundDao, parityCheckService);
chargeEntity = aValidChargeEntity().withCardDetails(defaultCardDetails()).withGatewayAccountEntity(defaultGatewayAccountEntity()).withMoto(true).withSource(CARD_PAYMENT_LINK).withFee(Fee.of(null, 10L)).withCorporateSurcharge(25L).withWalletType(APPLE_PAY).withDelayedCapture(true).build();
ChargeEventEntity chargeEventEntity = ChargeEventEntityFixture.aValidChargeEventEntity().withTimestamp(ZonedDateTime.ofInstant(chargeEntity.getCreatedDate(), ZoneOffset.UTC)).withCharge(chargeEntity).withChargeStatus(ChargeStatus.CREATED).build();
chargeEntity.getEvents().add(chargeEventEntity);
refundEntity = aValidRefundEntity().withChargeExternalId(chargeEntity.getExternalId()).build();
RefundHistory refundHistory = aValidRefundHistoryEntity().withChargeExternalId(refundEntity.getChargeExternalId()).withStatus(CREATED.toString()).withHistoryStartDate(refundEntity.getCreatedDate()).build();
refundHistoryList = new ArrayList<>();
refundHistoryList.add(refundHistory);
}
Aggregations