Search in sources :

Example 1 with SinglePaymentConsentDetails

use of com.forgerock.openbanking.common.model.rcs.consentdetails.SinglePaymentConsentDetails in project openbanking-aspsp by OpenBankingToolkit.

the class RCSConsentDecisionApiControllerIT method getConsentDetailsForSinglePayment.

@Test
public void getConsentDetailsForSinglePayment() throws Exception {
    // Given
    FRWriteDomesticConsentData writeDomesticConsentData = FRWriteDomesticConsentData.builder().initiation(FRWriteDomesticDataInitiation.builder().build()).build();
    FRPaymentSetup payment = FRPaymentSetup.builder().pispId(PISP_ID).pispName(PISP_NAME).status(ConsentStatusCode.AWAITINGAUTHORISATION).paymentSetupRequest(FRWriteDomesticConsent.builder().data(writeDomesticConsentData).build()).build();
    payment.getInitiation().setInstructedAmount(FRAmount.builder().build());
    when(singlePaymentService.getPayment(any())).thenReturn(payment);
    String signedJwtEncoded = toEncodedSignedTestJwt("jwt/singlePaymentConsentRequestPayload.json");
    // When
    HttpResponse<SinglePaymentConsentDetails> response = Unirest.post("https://rs-rcs:" + port + "/api/rcs/consent/details/").header(OBHeaders.CONTENT_TYPE, CONTENT_TYPE_JWT).header("Cookie", MOCK_COOKIE).body(signedJwtEncoded).asObject(SinglePaymentConsentDetails.class);
    // Then
    assertThat(response.getStatus()).isEqualTo(200);
    SinglePaymentConsentDetails resp = response.getBody();
    assertThat(resp.getClientId()).isEqualTo(PISP_ID);
    assertThat(resp.getPispName()).isEqualTo(PISP_NAME);
    assertThat(resp.getUsername()).isEqualTo(USER_ID);
    assertThat(resp.getIntentType()).isEqualTo(IntentType.PAYMENT_SINGLE_REQUEST);
    assertThat(resp.getDecisionAPIUri()).isEqualTo(EXPECTED_DECISION_API_URI);
}
Also used : SinglePaymentConsentDetails(com.forgerock.openbanking.common.model.rcs.consentdetails.SinglePaymentConsentDetails) FRPaymentSetup(com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRPaymentSetup) FRWriteDomesticConsentData(com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticConsentData) JwtTestHelper.utf8FileToString(com.forgerock.openbanking.aspsp.rs.rcs.api.rcs.JwtTestHelper.utf8FileToString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

JwtTestHelper.utf8FileToString (com.forgerock.openbanking.aspsp.rs.rcs.api.rcs.JwtTestHelper.utf8FileToString)1 FRWriteDomesticConsentData (com.forgerock.openbanking.common.model.openbanking.domain.payment.FRWriteDomesticConsentData)1 FRPaymentSetup (com.forgerock.openbanking.common.model.openbanking.persistence.payment.FRPaymentSetup)1 SinglePaymentConsentDetails (com.forgerock.openbanking.common.model.rcs.consentdetails.SinglePaymentConsentDetails)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1