Search in sources :

Example 1 with OBReadTransaction4

use of uk.org.openbanking.datamodel.account.OBReadTransaction4 in project openbanking-aspsp by OpenBankingToolkit.

the class TransactionsApiControllerIT method getAccountTransactionShouldBeOk.

@Test
public void getAccountTransactionShouldBeOk() throws Exception {
    // Given
    String jws = jws("accounts");
    this.mockAuthCollector();
    this.mockTppStoreService();
    mockAccessTokenVerification(jws);
    mockAccountPermissions(Arrays.asList(FRExternalPermissionsCode.READTRANSACTIONSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSCREDITS, FRExternalPermissionsCode.READTRANSACTIONSDEBITS));
    OBReadTransaction4 transaction = new OBReadTransaction4();
    given(rsStoreGateway.toRsStore(any(), any(), any(), any())).willReturn(ResponseEntity.ok(transaction));
    // When
    HttpResponse<OBReadTransaction4> response = Unirest.get("https://rs-api:" + port + "/open-banking/v3.1/aisp/accounts/100000123/transactions").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.financialId).header(OBHeaders.AUTHORIZATION, "Bearer " + jws).asObject(OBReadTransaction4.class);
    // Then
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : OBReadTransaction4(uk.org.openbanking.datamodel.account.OBReadTransaction4) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test)

Example 2 with OBReadTransaction4

use of uk.org.openbanking.datamodel.account.OBReadTransaction4 in project openbanking-aspsp by OpenBankingToolkit.

the class TransactionsApiControllerIT method getAccountStatementTransactionShouldBeOk.

@Test
public void getAccountStatementTransactionShouldBeOk() throws Exception {
    // Given
    String jws = jws("accounts");
    this.mockAuthCollector();
    this.mockTppStoreService();
    mockAccessTokenVerification(jws);
    mockAccountPermissions(Arrays.asList(FRExternalPermissionsCode.READSTATEMENTSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSCREDITS, FRExternalPermissionsCode.READTRANSACTIONSDEBITS));
    OBReadTransaction4 transaction = new OBReadTransaction4();
    given(rsStoreGateway.toRsStore(any(), any(), any(), any())).willReturn(ResponseEntity.ok(transaction));
    // When
    HttpResponse<OBReadTransaction4> response = Unirest.get("https://rs-api:" + port + "/open-banking/v3.1/aisp/accounts/100000123/statements/1000001234/transactions").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.financialId).header(OBHeaders.AUTHORIZATION, "Bearer " + jws).asObject(OBReadTransaction4.class);
    // Then
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : OBReadTransaction4(uk.org.openbanking.datamodel.account.OBReadTransaction4) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test)

Example 3 with OBReadTransaction4

use of uk.org.openbanking.datamodel.account.OBReadTransaction4 in project openbanking-aspsp by OpenBankingToolkit.

the class TransactionsApiControllerIT method getAccountStatementTransactionShouldNotGetMoreTransactionThatConsentAllows.

@Test
public void getAccountStatementTransactionShouldNotGetMoreTransactionThatConsentAllows() throws Exception {
    // Given
    String jws = jws("accounts");
    this.mockAuthCollector();
    this.mockTppStoreService();
    mockAccessTokenVerification(jws);
    mockAccountPermissions(Arrays.asList(FRExternalPermissionsCode.READSTATEMENTSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSCREDITS, FRExternalPermissionsCode.READTRANSACTIONSDEBITS));
    OBReadTransaction4 transaction = new OBReadTransaction4();
    given(rsStoreGateway.toRsStore(any(), any(), any(), any())).willReturn(ResponseEntity.ok(transaction));
    DateTime older = DateTime.now().minusDays(5);
    DateTime newer = DateTime.now().plusDays(5);
    // When
    HttpResponse<OBReadTransaction4> response = Unirest.get("https://rs-api:" + port + "/open-banking/v3.1.7/aisp/accounts/100000123/statements/1000001234/transactions").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.financialId).header(OBHeaders.AUTHORIZATION, "Bearer " + jws).queryString(TO_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(newer)).queryString(FROM_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(older)).asObject(OBReadTransaction4.class);
    assertThat(response.getStatus()).isEqualTo(200);
    ImmutableMap<String, String> params = ImmutableMap.<String, String>builder().put(TO_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(CONSENT_TO)).put(FROM_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(CONSENT_FROM)).build();
    verify(rsStoreGateway).toRsStore(any(), any(), eq(params), any());
}
Also used : OBReadTransaction4(uk.org.openbanking.datamodel.account.OBReadTransaction4) DateTime(org.joda.time.DateTime) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test)

Example 4 with OBReadTransaction4

use of uk.org.openbanking.datamodel.account.OBReadTransaction4 in project openbanking-aspsp by OpenBankingToolkit.

the class TransactionsApiControllerIT method getAccountTransactionShouldNotGetMoreTransactionThatConsentAllows.

@Test
public void getAccountTransactionShouldNotGetMoreTransactionThatConsentAllows() throws Exception {
    // Given
    String jws = jws("accounts");
    this.mockAuthCollector();
    this.mockTppStoreService();
    mockAccessTokenVerification(jws);
    mockAccountPermissions(Arrays.asList(FRExternalPermissionsCode.READTRANSACTIONSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSCREDITS, FRExternalPermissionsCode.READTRANSACTIONSDEBITS));
    OBReadTransaction4 transaction = new OBReadTransaction4();
    given(rsStoreGateway.toRsStore(any(), any(), any(), any())).willReturn(ResponseEntity.ok(transaction));
    DateTime older = DateTime.now().minusDays(5);
    DateTime newer = DateTime.now().plusDays(5);
    // When
    HttpResponse<OBReadTransaction4> response = Unirest.get("https://rs-api:" + port + "/open-banking/v3.1.7/aisp/accounts/100000123/transactions").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.financialId).header(OBHeaders.AUTHORIZATION, "Bearer " + jws).queryString(TO_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(newer)).queryString(FROM_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(older)).asObject(OBReadTransaction4.class);
    assertThat(response.getStatus()).isEqualTo(200);
    ImmutableMap<String, String> params = ImmutableMap.<String, String>builder().put(TO_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(CONSENT_TO)).put(FROM_BOOKING_DATE_TIME, DateTimeFormat.forPattern(BOOKED_TIME_DATE_FORMAT).print(CONSENT_FROM)).build();
    verify(rsStoreGateway).toRsStore(any(), any(), eq(params), any());
}
Also used : OBReadTransaction4(uk.org.openbanking.datamodel.account.OBReadTransaction4) DateTime(org.joda.time.DateTime) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test)

Example 5 with OBReadTransaction4

use of uk.org.openbanking.datamodel.account.OBReadTransaction4 in project openbanking-aspsp by OpenBankingToolkit.

the class TransactionsApiControllerIT method getAccountStatementTransactionShouldBeOk.

@Test
public void getAccountStatementTransactionShouldBeOk() throws Exception {
    // Given
    String jws = jws("accounts");
    this.mockAuthCollector();
    this.mockTppStoreService();
    mockAccessTokenVerification(jws);
    mockAccountPermissions(Arrays.asList(FRExternalPermissionsCode.READSTATEMENTSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSDETAIL, FRExternalPermissionsCode.READTRANSACTIONSCREDITS, FRExternalPermissionsCode.READTRANSACTIONSDEBITS));
    OBReadTransaction4 transaction = new OBReadTransaction4();
    given(rsStoreGateway.toRsStore(any(), any(), any(), any())).willReturn(ResponseEntity.ok(transaction));
    // When
    HttpResponse<OBReadTransaction4> response = Unirest.get("https://rs-api:" + port + "/open-banking/v3.1.7/aisp/accounts/100000123/statements/1000001234/transactions").header(OBHeaders.X_FAPI_FINANCIAL_ID, rsConfiguration.financialId).header(OBHeaders.AUTHORIZATION, "Bearer " + jws).asObject(OBReadTransaction4.class);
    // Then
    assertThat(response.getStatus()).isEqualTo(200);
}
Also used : OBReadTransaction4(uk.org.openbanking.datamodel.account.OBReadTransaction4) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SpringSecForTest(com.forgerock.openbanking.integration.test.support.SpringSecForTest) Test(org.junit.Test)

Aggregations

OBReadTransaction4 (uk.org.openbanking.datamodel.account.OBReadTransaction4)17 SpringSecForTest (com.forgerock.openbanking.integration.test.support.SpringSecForTest)14 Test (org.junit.Test)14 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)14 DateTime (org.joda.time.DateTime)11 BOOKED_TIME_DATE_FORMAT (com.forgerock.openbanking.constants.OpenBankingConstants.BOOKED_TIME_DATE_FORMAT)5 FROM_BOOKING_DATE_TIME (com.forgerock.openbanking.constants.OpenBankingConstants.ParametersFieldName.FROM_BOOKING_DATE_TIME)5 TO_BOOKING_DATE_TIME (com.forgerock.openbanking.constants.OpenBankingConstants.ParametersFieldName.TO_BOOKING_DATE_TIME)5 List (java.util.List)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 ResponseEntity (org.springframework.http.ResponseEntity)5 FRTransactionRepository (com.forgerock.openbanking.aspsp.rs.store.repository.accounts.transactions.FRTransactionRepository)3 AccountDataInternalIdFilter (com.forgerock.openbanking.aspsp.rs.store.utils.AccountDataInternalIdFilter)3 PaginationUtil (com.forgerock.openbanking.aspsp.rs.store.utils.PaginationUtil)3 FRTransaction (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRTransaction)3 FRExternalPermissionsCodeConverter.toFRExternalPermissionsCodeList (com.forgerock.openbanking.common.services.openbanking.converter.account.FRExternalPermissionsCodeConverter.toFRExternalPermissionsCodeList)3 FRTransactionConverter (com.forgerock.openbanking.common.services.openbanking.converter.account.FRTransactionConverter)3 AVAILABLE_DATE_FORMAT (com.forgerock.openbanking.constants.OpenBankingConstants.AVAILABLE_DATE_FORMAT)3 HTTP_DATE_FORMAT (com.forgerock.openbanking.constants.OpenBankingConstants.HTTP_DATE_FORMAT)3 OBErrorResponseException (com.forgerock.openbanking.exceptions.OBErrorResponseException)3