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