Giter VIP home page Giter VIP logo

openbanking's Introduction

openbanking-client

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 2019 TransferWise Ltd.

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.

openbanking's People

Contributors

jordantan1999 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.