Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
fix for comments in #170
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek0739 committed Feb 2, 2023
1 parent 1b00c7b commit b6f0d1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,37 @@

/**
* Interface specifying operations supported for event API open banking in 3.1.10
* https://openbankinguk.github.io/read-write-api-site3/v3.1.10/profiles/event-notification-api-profile.html
*/
public interface EventClient {

/**
* Create an Event Subscription :
* Asking a ASPSP to notify callback whenever there are updates on the given event.
*
* @param eventSubscriptionRequest request for event contains {callback URL, event type, version}
* @param aspspDetails -> detail of ASPSP which has the event to subscribe.
* @param softwareStatementDetails -> The details of the software statement that the ASPSP registration uses
* @return OBEventSubscriptionResponse1 -> Event {subscription id, callback URL, version, event types}
*/
OBEventSubscriptionResponse1 subscribeToAnEvent(OBEventSubscription1 eventSubscriptionRequest, AspspDetails aspspDetails,
OBEventSubscriptionResponse1 subscribeToAnEvent(
OBEventSubscription1 eventSubscriptionRequest,
AspspDetails aspspDetails,
SoftwareStatementDetails softwareStatementDetails);

/**
* Get all events from the given ASPSP.
*
* @param aspspDetails detail of ASPSP which has the event to subscribe.
* @return
* @param aspspDetails details of ASPSP which has the subscribed event resources.
* @return OBEventSubscriptionsResponse1 set of events subscribed to the given ASPSP.
*/
public OBEventSubscriptionsResponse1 getEventResources( AspspDetails aspspDetails);

/**
* Ask ASPSP to delete the given subscribed Event resource.
*
* @param eventSubscriptionId
* @param aspspDetails
* @param eventSubscriptionId Unique identification as assigned by the ASPSP,
* to uniquely identify the callback URL resource.
* @param aspspDetails details of ASPSP which has the subscribed event resources.
*/
public void deleteAnEventResource(
String eventSubscriptionId, AspspDetails aspspDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class RestEventClient extends BasePaymentClient implements EventClient {

private final JwtClaimsSigner jwtClaimsSigner;

public RestEventClient(RestOperations restOperations,
public RestEventClient(
RestOperations restOperations,
JsonConverter jsonConverter,
OAuthClient oAuthClient,
JwtClaimsSigner jwtClaimsSigner
Expand All @@ -37,7 +38,8 @@ public RestEventClient(RestOperations restOperations,

@Override
public OBEventSubscriptionResponse1 subscribeToAnEvent(
OBEventSubscription1 eventSubscriptionRequest, AspspDetails aspspDetails,
OBEventSubscription1 eventSubscriptionRequest,
AspspDetails aspspDetails,
SoftwareStatementDetails softwareStatementDetails) {

OpenBankingHeaders headers = OpenBankingHeaders.postHeaders(aspspDetails.getOrganisationId(),
Expand All @@ -64,8 +66,7 @@ public OBEventSubscriptionResponse1 subscribeToAnEvent(
} catch (RestClientException e) {
throw new EventApiCallException("Call to subscribe event endpoint failed, and no response body returned", e);
}
OBEventSubscriptionResponse1 eventSubscriptionResponse = jsonConverter.readValue(response.getBody(), OBEventSubscriptionResponse1.class);
return eventSubscriptionResponse;
return jsonConverter.readValue(response.getBody(), OBEventSubscriptionResponse1.class);
}

public OBEventSubscriptionsResponse1 getEventResources( AspspDetails aspspDetails) {
Expand Down Expand Up @@ -99,8 +100,7 @@ public OBEventSubscriptionsResponse1 getEventResources( AspspDetails aspspDetail


@Override
public void deleteAnEventResource(
String eventSubscriptionId, AspspDetails aspspDetails) {
public void deleteAnEventResource( String eventSubscriptionId, AspspDetails aspspDetails) {
OpenBankingHeaders headers = OpenBankingHeaders.defaultHeaders(
aspspDetails.getOrganisationId(),
getClientCredentialsToken(aspspDetails)
Expand Down

0 comments on commit b6f0d1f

Please sign in to comment.