From b6f0d1f5b29bafb56410bf9648a878f687634c3c Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Thu, 2 Feb 2023 15:31:47 +0000 Subject: [PATCH] fix for comments in https://github.com/transferwise/openbanking-client/pull/170 --- .../client/api/event/EventClient.java | 19 +++++++++++++------ .../client/api/event/RestEventClient.java | 12 ++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/transferwise/openbanking/client/api/event/EventClient.java b/src/main/java/com/transferwise/openbanking/client/api/event/EventClient.java index 63d7e793..217f7837 100644 --- a/src/main/java/com/transferwise/openbanking/client/api/event/EventClient.java +++ b/src/main/java/com/transferwise/openbanking/client/api/event/EventClient.java @@ -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); diff --git a/src/main/java/com/transferwise/openbanking/client/api/event/RestEventClient.java b/src/main/java/com/transferwise/openbanking/client/api/event/RestEventClient.java index a13e69ab..8554164e 100644 --- a/src/main/java/com/transferwise/openbanking/client/api/event/RestEventClient.java +++ b/src/main/java/com/transferwise/openbanking/client/api/event/RestEventClient.java @@ -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 @@ -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(), @@ -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) { @@ -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)