Skip to content
Java SDK generated against the Yapily API. This SDK can be used to connect to Open Banking entities.
Java Other
  1. Java 99.3%
  2. Other 0.7%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
sdk
.gitignore
CODE_OF_CONDUCT.md
LICENCE
README.md

README.md

Yapily Java SDK

GitHub version

This SDK was generated using Swagger Code Generator. The SDK can be used as a module in your code and the examples demonstrate how to connect to financial institutions integrated with Yapily.

Requirements

To connect to the Yapily API, you will need to register your application at https://dashboard.yapily.com.

Specify the financial institutions you want to work with and save your application. You will then be prompted to download your application credentials. These application credentials can then be used to authorise your requests against the yapily API.

Installation

The SDK is currently available in the Yapily maven repository and can be included in your project by adding it to your dependencies

Maven

Repository:

<repositories>
   <!-- other repos-->
   <repository>
       <id>yapily-repo</id>
       <name>yapily-repo</name>
       <url>http://maven.yapily.com/</url>
   </repository>
</repositories>

Dependency:

<dependencies>
   <!-- other dependencies -->
   <dependency>
       <groupId>yapily</groupId>
       <artifactId>yapily-sdk</artifactId>
       <version>0.0.169</version>
   </dependency>
</dependencies>

Gradle

Repository:

repositories {
    // other repos
    maven {
        url "http://maven.yapily.com/"
    }
}

Dependency:

compile group: 'yapily', name: 'yapily-sdk-java', version: '0.0.169'

Download JAR

The JAR can also be downloaded from a tagged release, or this project can be cloned/downloaded and packaged into a library JAR to be included in your project.

Usage

Sample usages of the SDK can be seen in the examples folder.

  • Configure the default api client
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the API authentication
HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
// Replace these demo constants with your application credentials
basicAuth.setUsername(APPLICATION_ID);
basicAuth.setPassword(APPLICATION_SECRET);
  • Or configure a new one for multiple application cases
ApiClient applicationClient = new ApiClient();
// Configure the API authentication
HttpBasicAuth basicAuth = (HttpBasicAuth) applicationClient.getAuthentication("basicAuth");
// Replace these demo constants with your application credentials
basicAuth.setUsername(APPLICATION_ID);
basicAuth.setPassword(APPLICATION_SECRET);
InstitutionsApi institutionsApi = new InstitutionsApi();
institutionsApi.setApiClient(applicationClient);
  • Retrieve a list of available financial institutions to connect to
InstitutionsApi institutionsApi = new InstitutionsApi();
List<Institution> institutions = institutionsApi.getInstitutionsUsingGET().getData();
  • Creating users and retrieving users for your application registered in the Yapily Dashboard
final ApplicationUsersApi usersApi = new ApplicationUsersApi();
NewApplicationUser user = new NewApplicationUser();
user.setReferenceId("Bojack");
usersApi.addUserUsingPOST(user);

List<ApplicationUser> users = usersApi.listUsers();
  • Create an authorization url in order for your users to give consent on accessing their account data.
final AccountsApi accountsApi = new AccountsApi();
AccountAuthorisationRequest accountAuthorisationRequest = new AccountAuthorisationRequest();
accountAuthorisationRequest.setUserUuid(userUuid);
accountAuthorisationRequest.setInstitutionId(institutionId);
/**
* Use the defaults
*/
accountAuthorisationRequest.setAccountRequest(new AccountRequest());
ApiResponseOfAuthorisationRequestResponse authorizationResponse = accountsApi.initiateAccountRequestUsingPOST(accountAuthorisationRequest);
String directUrl = authorizationResponse.getData().getAuthorisationUrl();
  • Receive consents issued by your user by authorizing to a specific institution
// Get user consents
final ConsentsApi consentsApi = new ConsentsApi();
List<Consent> consents = consentsApi.getUserConsentsUsingGET(userUuid, institutionId);
  • Return user account details using the consent the user has given
String consentToken = consent.getConsentToken();
ApiListResponseOfAccount accountsResponse = accountsApi.getAccountsUsingGET(consentToken);
List<Account> accounts = accountsResponse.getData();
  • Return user transaction details, using an account the user has given consent to.
String consentToken = consent.getConsentToken();
ApiListResponseOfTransaction transactionsResponse = transactionsApi.getTransactionsUsingGET(consentToken, accountId, new ArrayList<>());
List<Transaction> transactions = transactionsResponse.getData();
  • Return user identity details
String consentToken = consent.getConsentToken();
IdentityApi identityApi = new IdentityApi();
ApiResponseOfIdentity identityResp = identityApi.getIdentityUsingGET(consentToken); 
Identity identity = identityResp.getData();
  • Create an authorization url in order for your users to give consent on executing a payment.
SortCodePaymentRequest sortCodePaymentRequest = new SortCodePaymentRequest();
sortCodePaymentRequest.setName("name");
sortCodePaymentRequest.setAmount(new BigDecimal("2.9"));
sortCodePaymentRequest.setReference("Up to 35 characters");
sortCodePaymentRequest.setCountry("GB");
sortCodePaymentRequest.setCurrency("GBP");
sortCodePaymentRequest.setAccountNumber("accountNumber");
sortCodePaymentRequest.setSortCode("123456");

SortCodePaymentAuthRequest authRequest = new SortCodePaymentAuthRequest();
sortCodePaymentAuthRequest.setInstitutionId(institutionId);
sortCodePaymentAuthRequest.setUserUuid(userUUID);
sortCodePaymentAuthRequest.setPaymentRequest(sortCodePaymentRequest);

PaymentsApi paymentsApi = new PaymentsApi();
ApiResponseOfAuthorisationRequestResponse authorizationResponse = paymentsApi.createPaymentInitiationUsingPOST(authRequest);
String url = authorizationResponse.getData().getAuthorisationUrl();
  • Submit a payment request using the consent given by the user
String consentToken = consent.getConsentToken();
ApiResponseOfPaymentResponse response = paymentsApi.createPaymentUsingPOST(consentToken,sortCodePaymentRequest);
  • Check the payment status;
String consentToken = consent.getConsentToken();
String paymentId =  paymentResponse.getData().getId();
ApiResponseOfPaymentResponse apiResponseOfPaymentResponse = paymentsApi.getPaymentStatusUsingGET(paymentId, consentToken);

Further information

For more information on how to get connected, visit the Yapily developer resources repo.

Website | Legal | Contact Us
You can’t perform that action at this time.