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);
}
Aggregations