Skip to content

exohood/exohood-openbanking-client

Repository files navigation

Exohood Openbanking Client

🏦 Java client for using the UK Open Banking API

Apache 2 Java 1.8

Java client for using the Open Banking API, exposed by an ASPSP, as a TPP. The library supports a subset of the full API:

Example Usage

Client Registration

//
// Step 1 - configure the RegistrationClient instance to use for the ASPSP
//

TppConfiguration tppConfiguration = TppConfiguration.builder()
    // set the properties acording to your organisation
    .build();
// configure the SSL context of the instance according to your setup, including a KeyManager to support mutual TLS on
// conections to ASPSP and a TrustManager to support connections to ASPSPs using OB issued certificates
RestTemplate restTemplate = new RestTemplate();

// an example implementation might look up the values to supply from a KeyStore
KeySupplier signingKeySupplier = new ExampleKeySupplier();
JsonConverter jsonConverter = new JacksonJsonConverter();
JwtClaimsSigner jwtClaimsSigner = new JwtClaimsSigner(signingKeySupplier, jsonConverter);

RegistrationClient registrationClient = new RestRegistrationClient(jwtClaimsSigner, restTemplate);

RegistrationRequestService registrationRequestService = new RegistrationRequestService(keySupplier, tppConfiguration);

// supplies the details of the ASPSP implementation required to make the API calls
AspspDetails aspspDetails = new ExampleAspspDetails();

// 
// Step 2 - register with the ASPSP
// 

ClientRegistrationRequest clientRegistrationRequest = registrationRequestService.generateRegistrationRequest(
        softwareStatement, 
        aspspDetails);

ClientRegistrationResponse clientRegistrationResponse = registrationClient.registerClient(clientRegistrationRequest, 
        aspspDetails);

V3 Payments

//
// Step 1 - configure the V3 PaymentClient instance to use for the ASPSP
//

TppConfiguration tppConfiguration = TppConfiguration.builder()
    // set the properties acording to your organisation
    .build();
// configure the SSL context of the instance according to your setup, including a KeyManager to support mutual TLS on
// conections to ASPSP and a TrustManager to support connections to ASPSPs using OB issued certificates
RestTemplate restTemplate = new RestTemplate();

ClientAuthentication tlsClientAuthentication = new TlsAuthentication();
OAuthClient restOAuthClient = new RestOAuthClient(tlsClientAuthentication, restTemplate);

// an example implementation might use the EndToEndIdentification of the request as the idempotency key 
IdempotencyKeyGenerator idempotencyKeyGenerator = new ExampleIdempotencyKeyGenerator();

// an example implementation might look up the values to supply from a KeyStore
KeySupplier signingKeySupplier = new ExampleKeySupplier();
JsonConverter jsonConverter = new JacksonJsonConverter();
JwtClaimsSigner jwtClaimsSigner = new JwtClaimsSigner(signingKeySupplier, jsonConverter);

PaymentClient paymentClient = new RestPaymentClient(restTemplate,
    jsonConverter,
    restOAuthClient,
    idempotencyKeyGenerator,
    jwtClaimsSigner);

// supplies the details of the ASPSP implementation required to make the API calls
AspspDetails aspspDetails = new ExampleAspspDetails();

// 
// Step 2 - initiate the payment
// 

// set the properties according to the payment attempt
OBWriteDomesticConsent4 paymentConsentRequest = new OBWriteDomesticConsent4();
OBWriteDomesticConsentResponse5 paymentConsentResponse = paymentClient.createDomesticPaymentConsent(
    paymentConsentRequest, 
    aspspDetails);

// 
// Step 3 - redirect the user to the ASPSP authorisation site to authorise the payment 
// 
// on authorisation success, an authorization code is received from the ASPSP
// note, when building the ASPSP authorisation URL, the JwtClaimsSigner can be used to generate the request parameter
//  

//
// Step 4 - submit the payment for execution
//

//
// Step 4a (optional) - check for sufficient funds on the source account 
//

OBWriteFundsConfirmationResponse1 fundsConfirmationResponse = paymentClient.getFundsConfirmation(consentId, 
    authorizationCode, 
    aspspDetails);

// set the properties according to the payment attempt
OBWriteDomestic2 paymentRequest = new OBWriteDomestic2();
OBWriteDomesticResponse5 paymentResponse = paymentClient.createDomesticPayment(paymentRequest, 
    authorizationCode, 
    aspspDetails);

How to contribute

  1. Prepare a PR for review (all commits must be signed)
  2. We receive a notification and review your PR
  3. We merge approved PR and release a new version

How to configure GPG signing

  1. Generate a GPG key
  2. Upload your GPG public key to your GitHub account
  3. Configure Git to use your GPG key

License

Copyright 2023 Exohood Labs.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

🏦 Java client for using the UK Open Banking API

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages