@Test void identifyPayment() throws RedirectUrlIsExpiredException { when(referencePolicy.fromRequest(anyString(), anyString(), anyString(), anyBoolean())).thenReturn(getConsentReference()); when(cmsPsuPisService.checkRedirectAndGetPayment(anyString(), anyString())).thenReturn(getCmsPaymentResponse()); when(paymentMapper.toAbstractPayment(anyString(), anyString(), anyString())).thenReturn(getPaymentTO(ACCP)); PaymentWorkflow result = service.identifyPayment(ENCRYPTED_ID, AUTH_ID, false, COOKIE, PSU_ID, new BearerTokenTO()); assertThat(result).isEqualToComparingFieldByFieldRecursively(getExpectedWorkflow(null, TransactionStatus.ACCP.name())); }
@Override public PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken) { ConsentReference consentReference = referencePolicy.fromRequest(encryptedPaymentId, authorizationId, consentCookieString, strict); CmsPaymentResponse cmsPaymentResponse = loadPaymentByRedirectId(consentReference); PaymentWorkflow workflow = new PaymentWorkflow(cmsPaymentResponse, consentReference); PaymentTO payment = getPaymentTO(workflow); workflow.setAuthResponse(new PaymentAuthorizeResponse(payment)); workflow.getAuthResponse().setAuthorisationId(cmsPaymentResponse.getAuthorisationId()); workflow.getAuthResponse().setEncryptedConsentId(encryptedPaymentId); workflow.setPaymentStatus(Optional.ofNullable(payment.getTransactionStatus()).map(Enum::name).orElse("RCVD")); if (bearerToken != null) { SCAPaymentResponseTO scaPaymentResponseTO = new SCAPaymentResponseTO(); scaPaymentResponseTO.setBearerToken(bearerToken); workflow.setScaResponse(scaPaymentResponseTO); } return workflow; }
CommonPaymentServiceImpl implements CommonPaymentService { @Override public PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken) { ConsentReference consentReference = referencePolicy.fromRequest(encryptedPaymentId, authorizationId, consentCookieString, strict); CmsPaymentResponse cmsPaymentResponse = loadPaymentByRedirectId(consentReference); PaymentWorkflow workflow = new PaymentWorkflow(cmsPaymentResponse, consentReference); PaymentTO payment = getPaymentTO(workflow); workflow.setAuthResponse(new PaymentAuthorizeResponse(payment)); workflow.getAuthResponse().setAuthorisationId(cmsPaymentResponse.getAuthorisationId()); workflow.getAuthResponse().setEncryptedConsentId(encryptedPaymentId); workflow.setPaymentStatus(Optional.ofNullable(payment.getTransactionStatus()).map(Enum::name).orElse("RCVD")); if (bearerToken != null) { SCAPaymentResponseTO scaPaymentResponseTO = new SCAPaymentResponseTO(); scaPaymentResponseTO.setBearerToken(bearerToken); workflow.setScaResponse(scaPaymentResponseTO); } return workflow; } }
CommonPaymentServiceImpl implements CommonPaymentService { @Override public PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken) { ConsentReference consentReference = referencePolicy.fromRequest(encryptedPaymentId, authorizationId, consentCookieString, strict); CmsPaymentResponse cmsPaymentResponse = loadPaymentByRedirectId(consentReference); PaymentWorkflow workflow = new PaymentWorkflow(cmsPaymentResponse, consentReference); PaymentTO payment = getPaymentTO(workflow); workflow.setAuthResponse(new PaymentAuthorizeResponse(payment)); workflow.getAuthResponse().setAuthorisationId(cmsPaymentResponse.getAuthorisationId()); workflow.getAuthResponse().setEncryptedConsentId(encryptedPaymentId); workflow.setPaymentStatus(Optional.ofNullable(payment.getTransactionStatus()).map(Enum::name).orElse("RCVD")); if (bearerToken != null) { SCAPaymentResponseTO scaPaymentResponseTO = new SCAPaymentResponseTO(); scaPaymentResponseTO.setBearerToken(bearerToken); workflow.setScaResponse(scaPaymentResponseTO); } return workflow; }  }
CommonPaymentServiceImpl implements CommonPaymentService { @Override public PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken) { ConsentReference consentReference = referencePolicy.fromRequest(encryptedPaymentId, authorizationId, consentCookieString, strict); CmsPaymentResponse cmsPaymentResponse = loadPaymentByRedirectId(consentReference); PaymentWorkflow workflow = new PaymentWorkflow(cmsPaymentResponse, consentReference); PaymentTO payment = getPaymentTO(workflow); workflow.setAuthResponse(new PaymentAuthorizeResponse(payment)); workflow.getAuthResponse().setAuthorisationId(cmsPaymentResponse.getAuthorisationId()); workflow.getAuthResponse().setEncryptedConsentId(encryptedPaymentId); workflow.setPaymentStatus(Optional.ofNullable(payment.getTransactionStatus()).map(Enum::name).orElse("RCVD")); if (bearerToken != null) { SCAPaymentResponseTO scaPaymentResponseTO = new SCAPaymentResponseTO(); scaPaymentResponseTO.setBearerToken(bearerToken); workflow.setScaResponse(scaPaymentResponseTO); } return workflow; }  @Override PaymentWorkflow selectScaForPayment(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString, boolean isCancellationOperation, String psuId, BearerTokenTO tokenTO); @Override PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken); @Override void updateAspspConsentData(PaymentWorkflow paymentWorkflow); @Override String resolveRedirectUrl(String encryptedPaymentId, String authorisationId, String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String psuId, BearerTokenTO tokenTO, String authConfirmationCode); @Override PaymentWorkflow initiatePayment(PaymentWorkflow paymentWorkflow, String psuId); @Override PaymentWorkflow initiateCancelPayment(PaymentWorkflow paymentWorkflow, String psuId); @Override PaymentWorkflow authorizePayment(PaymentWorkflow paymentWorkflow, String psuId, String authCode); @Override PaymentWorkflow authorizeCancelPayment(PaymentWorkflow paymentWorkflow, String psuId, String authCode); }
CommonPaymentServiceImpl implements CommonPaymentService { @Override public PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken) { ConsentReference consentReference = referencePolicy.fromRequest(encryptedPaymentId, authorizationId, consentCookieString, strict); CmsPaymentResponse cmsPaymentResponse = loadPaymentByRedirectId(consentReference); PaymentWorkflow workflow = new PaymentWorkflow(cmsPaymentResponse, consentReference); PaymentTO payment = getPaymentTO(workflow); workflow.setAuthResponse(new PaymentAuthorizeResponse(payment)); workflow.getAuthResponse().setAuthorisationId(cmsPaymentResponse.getAuthorisationId()); workflow.getAuthResponse().setEncryptedConsentId(encryptedPaymentId); workflow.setPaymentStatus(Optional.ofNullable(payment.getTransactionStatus()).map(Enum::name).orElse("RCVD")); if (bearerToken != null) { SCAPaymentResponseTO scaPaymentResponseTO = new SCAPaymentResponseTO(); scaPaymentResponseTO.setBearerToken(bearerToken); workflow.setScaResponse(scaPaymentResponseTO); } return workflow; }  @Override PaymentWorkflow selectScaForPayment(String encryptedPaymentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString, boolean isCancellationOperation, String psuId, BearerTokenTO tokenTO); @Override PaymentWorkflow identifyPayment(String encryptedPaymentId, String authorizationId, boolean strict, String consentCookieString, String psuId, BearerTokenTO bearerToken); @Override void updateAspspConsentData(PaymentWorkflow paymentWorkflow); @Override String resolveRedirectUrl(String encryptedPaymentId, String authorisationId, String consentAndAccessTokenCookieString, boolean isOauth2Integrated, String psuId, BearerTokenTO tokenTO, String authConfirmationCode); @Override PaymentWorkflow initiatePayment(PaymentWorkflow paymentWorkflow, String psuId); @Override PaymentWorkflow initiateCancelPayment(PaymentWorkflow paymentWorkflow, String psuId); @Override PaymentWorkflow authorizePayment(PaymentWorkflow paymentWorkflow, String psuId, String authCode); @Override PaymentWorkflow authorizeCancelPayment(PaymentWorkflow paymentWorkflow, String psuId, String authCode);  }