# Reference Application
source: https://developer.mastercard.com/open-banking-connect/documentation/referenceapp/index.md

## Overview {#overview}

To assist the understanding of the Open Banking Connect Platform, the following reference application has been designed, which brings to life how the Open Banking Connect APIs will work.
The reference application shows the following flows:
> AccountsFlow: Invokes below Account Information Service APIs sequentially

* [AIS - Get List of ASPSPs](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/ais-get-list-of-aspsps/)
* [Account Information Consent](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/account-information-consent/)
* [Exchange the PSU Authorization for Access Consent](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/exchange-psu-consent/)
* [Get List of Accounts](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/get-list-accounts/)
* [Get Account Balances](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/get-account-balances/)
* [Get Account Transactions](https://developer.mastercard.com/open-banking-connect/documentation/aisfeatures/get-account-transactions/)

> PaymentFlow: Invokes below Payment Initiation Service APIs sequentially

* [PIS - Get List of ASPSPs](https://developer.mastercard.com/open-banking-connect/documentation/pisfeatures/pis-get-list-of-aspsps/)
* [Domestic Payment Initiation Consent](https://developer.mastercard.com/open-banking-connect/documentation/pisfeatures/payment-initiation-consent-request/)
* [Domestic Payment Credit Transfer](https://developer.mastercard.com/open-banking-connect/documentation/pisfeatures/payment-credit-transfer-initiation-request/)
* [Get Domestic Payment Status](https://developer.mastercard.com/open-banking-connect/documentation/pisfeatures/get-payment-status-request/)

## Setting Up {#setting-up}

### Requirements {#requirements}

* Java 8 and above
* Set up the [JAVA_HOME](https://explainjava.com/java-path/) environment variable to match the location of your Java installation.
* Set up the [MAVEN_HOME](https://dzone.com/articles/installing-maven) environment variable to match the location of your Maven bin folder.

### Prerequisites {#prerequisites}

* [Spring Boot](https://spring.io/projects/spring-boot)
* [Apache Maven](https://maven.apache.org/index.html)
* [IntelliJ IDEA](https://www.jetbrains.com/idea/download)
* A developer account on [Mastercard Developers](https://developer.mastercard.com) with access to the Open Banking Connect APIs
* The [AIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-accounts-service.yaml) (Swagger .yaml file).
* The [PIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-payments-service.yaml) (Swagger .yaml file).

## Download the Project {#download-the-project}

[mcob-client-example.zip](https://static.developer.mastercard.com/content/open-banking-connect/ReferenceApp/mcob-client-example.zip) (295KB)

## Add Resources {#add-resources}

1. Open Mastercard Developers website and create an account at [Mastercard Developers](https://developer.mastercard.com).
2. Create a new project [here](https://developer.mastercard.com/dashboard)
3. Add the `Open Banking Connect Account Information Service` and `Open Banking Connect Payment Initiation Service` APIs to your project and click continue.
4. Configure project and click continue.
5. Download Sandbox Signing Key and copy the .p12 file to `src/main/resources` folder in the code.
6. Retrieve the [AIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-accounts-service.yaml) and the [PIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-payments-service.yaml) files and add them to `src/main/resources/` folder.
7. Open `src/main/resources/application.properties` and configure:
   * `consumer.key` - string value of Consumer Key that can be found in your project in [Mastercard Developers](https://developer.mastercard.com).
   * `consumer.keyFilePath` - Consumer key. Copy this from "Sandbox/Production Keys" on your project page
   * `consumer.keyAlias` - Key alias. Default key alias for sandbox is `keyalias`.
   * `consumer.keyPassword` - Keystore password. Default keystore password for sandbox project is `keystorepassword`.

The Mastercard APIs use OAuth authentication. For information on OAuth 1.0a and using it to access Mastercard APIs, see [this article](https://developer.mastercard.com/platform/documentation/security-and-authentication/using-oauth-1a-to-access-mastercard-apis/).

Your Maven project directory should look as follows (the .idea and .iml items are used by IntelliJ IDEA):
![](https://static.developer.mastercard.com/content/open-banking-connect/img/tutorials/resources_folder.png)

## Generating the API Client SDK {#generating-the-api-client-sdk}

You should now be ready to generate the API client library.

In the same menu, navigate to the commands \*\* ({Project name} \> Lifecycle) \*\*, run \*\* clean \*\* and then \*\* package \*\*. Alternatively, you can navigate to the root directory of the project within a terminal window and run `mvn clean package`.

Afterwards, there should be a new folder named \*\* target \*\*, within your root directory, which contains classes generated for the schemas and API calls defined within the OpenAPI Specification. The generated classes can be found in target/generated-sources/openapi/, as shown below.
![](https://static.developer.mastercard.com/content/open-banking-connect/img/tutorials/target.png)

## Running the Application {#running-the-application}

In order to start the application please run `com.mastercard.mcob.ClientApplication`

This will start the following API flows:

* `AccountFlow` - executes AIS API calls
* `PaymentFlow` - executes PIS API calls

## Troubleshooting {#troubleshooting}

This error happens during the Maven build and usually related to missing API Swagger .yaml files in resources folder. Please make sure you have the [AIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-accounts-service.yaml) (Swagger .yaml file) and [PIS API Specification](https://static.developer.mastercard.com/content/open-banking-connect/swagger/api-payments-service.yaml) (Swagger .yaml file). in your `resources` folder This happens during runtime when either `consumer.keyAlias` or `consumer.keyPassword` are wrong. Please check \*\* Default key alias \*\* and \*\* Default keystore password \*\* values in your [Mastercard Developers](https://developer.mastercard.com) account and make sure the correct. This is an API response that indicates that `consumer.key` is wrong. Please check \*\* CONSUMER KEY \*\* value in your [Mastercard Developers](https://developer.mastercard.com) account and make sure it's correct.
