DefaultWorldpayAuthorisationResultService implements WorldpayAuthorisationResultService { @Override public void setAuthoriseResultByTransactionStatus(final AbstractResult target, final AuthorisedStatus status, final String orderCode) { switch (status) { case ERROR: LOG.warn("Error Response from worldpay for transaction: " + orderCode); setSubscriptionAuthoriseResult(target, ERROR, GENERAL_SYSTEM_ERROR); break; case AUTHORISED: setSubscriptionAuthoriseResult(target, ACCEPTED, SUCCESFULL); break; default: LOG.debug(status + " Response from worldpay for transaction: " + orderCode); setSubscriptionAuthoriseResult(target, REJECTED, UNKNOWN_CODE); break; } }  @Override void setAuthoriseResultAsError(final AbstractResult target); @Override void setAuthoriseResultByTransactionStatus(final AbstractResult target, final AuthorisedStatus status, final String orderCode); @Override void setAuthorizeResultForAPM(final DirectAuthoriseServiceResponse response,
                                         final WorldpaySubscriptionAuthorizeResult result);  }
@Test public void testSetAuthoriseResultERROR() { testObj.setAuthoriseResultByTransactionStatus(abstractResultMock, ERROR, ORDER_CODE); verify(abstractResultMock).setTransactionStatus(TransactionStatus.ERROR); verify(abstractResultMock).setTransactionStatusDetails(GENERAL_SYSTEM_ERROR); }
@Test public void testSetAuthoriseResultAUTHORISED() { testObj.setAuthoriseResultByTransactionStatus(abstractResultMock, AUTHORISED, ORDER_CODE); verify(abstractResultMock).setTransactionStatus(TransactionStatus.ACCEPTED); verify(abstractResultMock).setTransactionStatusDetails(SUCCESFULL); }
@Test public void testSetAuthoriseResultOTHER() { testObj.setAuthoriseResultByTransactionStatus(abstractResultMock, FAILURE, ORDER_CODE); verify(abstractResultMock).setTransactionStatus(TransactionStatus.REJECTED); verify(abstractResultMock).setTransactionStatusDetails(UNKNOWN_CODE); }