# Acquirers: Onboard Risk Check API onboarding
source: https://developer.mastercard.com/onboard-risk-check/documentation/tutorials-and-guides/orc-inquiries-tutorial/index.md
## What you will learn {#what-you-will-learn}
* Create a new Maven (Java) project.
* Add required resources.
* Add required dependencies.
* Generate the API client.
* Make an API call.
## What you will need {#what-you-will-need}
To complete this tutorial, you can use:
* Maven 3+
* JDK 17+
* IntelliJ IDEA 2017+ (any other IDE can be used).
* OpenAPI spec for Onboard Risk Check API [onboard-risk-check-api.yaml](https://static.developer.mastercard.com/content/onboard-risk-check/swagger/onboard-risk-check-api.yaml) (63KB).
* A developer account on [Mastercard Developers](https://developer.mastercard.com/account/log-in) and Onboard Risk Check API project.
Tip: For instructions on how to create a developer account and API project, please refer to the [Quick Start Guide](https://developer.mastercard.com/platform/documentation/getting-started-with-mastercard-apis/quick-start-guide/).
Click **Next** to begin.
### Step 1 - Step one: Create a new Maven project {#step-1---step-one-create-a-new-maven-project}
To begin ORC API onboarding, you must first create a new Maven project.
## 1. New Maven project {#1-new-maven-project}
In IntelliJ IDEA, create a new Maven project that sets up your directory structure automatically.

## 2. Naming details {#2-naming-details}
Enter "cyber-secure-orc-tutorial" in the **Name** and **ArtifactId** fields.

### Step 2 - Step two: Add resources {#step-2---step-two-add-resources}
Before you can add dependencies, you must add resources.
## 1. Save the API specification file {#1-save-the-api-specification-file}
Download the OpenAPI specification file for the Onboard Risk Check API
[onboard-risk-check-api.yaml](https://static.developer.mastercard.com/content/onboard-risk-check/swagger/onboard-risk-check-api.yaml) (63KB), and add it to the resources folder of your Maven project.
## 2. Save the API signing key {#2-save-the-api-signing-key}
Add the Sandbox Signing Key generated for your Cyber Secure ORC project to the resources folder of your Maven project.
The steps to create the project and generate the Sandbox Signing Key are described in the [Quick Start Guide](https://developer.mastercard.com/platform/documentation/getting-started-with-mastercard-apis/quick-start-guide/).
Note: For detailed information about the Signing Keys, refer to [Getting keys for your application](https://developer.mastercard.com/platform/documentation/security-and-authentication/using-oauth-1a-to-access-mastercard-apis/#getting-keys-for-your-application).
Your Maven project directory should look as follows (the .iml file is used by IntelliJ IDEA).

### Step 3 - Step three: Add dependencies {#step-3---step-three-add-dependencies}
Before you can generate the API client, you must update the pom.xml file.
## 1. Add OpenAPI plugin details {#1-add-openapi-plugin-details}
Add the following plugin to the pom.xml file in your Maven project to add the OpenAPI Generator.
The OpenAPI Generator creates API client libraries from [OpenAPI Specifications](https://github.com/OAI/OpenAPI-Specification) (formerly known as Swagger Files).
OpenAPI Generator provides multiple generators and library templates to support multiple languages and frameworks.
In this tutorial we are using the Java generator and the default okhttp-gson library template.
```java
4.0.0
com.mastercard.api.orc
cyber-secure-orc-tutorial
1.0-SNAPSHOT
org.openapitools
openapi-generator-maven-plugin
6.6.0
Cyber Secure ORC API REST Client
generate
${project.basedir}/src/main/resources/onboard-risk-check-api.yaml
java
src/gen/java/main
com.mastercard.api.orc
com.mastercard.api.orc
cyber-secure-orc-tutorial
com.mastercard.api.orc.model
```
## 2. Add various dependencies {#2-add-various-dependencies}
Add the following dependencies for the API client library generation and the Mastercard OAuth1 Signer library to your pom.xml file.
Mastercard APIs use [OAuth 1.0a](https://developer.mastercard.com/platform/documentation/authentication/using-oauth-1a-to-access-mastercard-apis/) authentication. OAuth1 Signer libraries are developed and maintained by the Mastercard API team and hosted on [GitHub](https://github.com/Mastercard).
They include code helpers targeting the HTTP clients used by the different OpenAPI Generator library templates.
```java
17
17
UTF-8
17
${java.version}
${java.version}
2.0.21-RELEASE
UTF-8
1.5.2.Final
5.9.1
5.6.0
1.9.0
5.0.2-RELEASE
4.0.0-RELEASE
1.8.5
1.6.8
4.10.0
2.10.1
1.6.5
4.13.2
1.0.2
1.5.2
3.0.2
0.2.6
2.1.1
5.9.2
io.swagger
swagger-annotations
${swagger-core-version}
com.squareup.okhttp3
okhttp
${okhttp3-version}
com.squareup.okhttp3
logging-interceptor
${okhttp3-version}
com.google.code.gson
gson
${gson-version}
io.gsonfire
gson-fire
${gson-fire-version}
org.apache.oltu.oauth2
org.apache.oltu.oauth2.client
${oltu-version}
org.threeten
threetenbp
${threetenbp-version}
com.mastercard.developer
oauth1-signer
${oauth1-signer-version}
junit
junit
${junit-version}
com.google.code.findbugs
jsr305
${findbugs-version}
org.openapitools
jackson-databind-nullable
${nullable-version}
javax.ws.rs
javax.ws.rs-api
${javax-rs-version}
org.junit.jupiter
junit-jupiter-api
${junit-jupiter-version}
compile
javax.annotation
javax.annotation-api
1.3.2
```
### Step 4 - Step four: Generate the API client {#step-4---step-four-generate-the-api-client}
Once you have added the dependencies, you can generate the sources.
There are two options when using the OpenAPI Generator to generate the API client library:
* Generate and use the source files on the fly.
* Generate and deploy the source files to a Maven repository.
This tutorial explains how to generate the API client library on the fly, so the dependencies that are needed to generate the library are included.
To deploy the source files to a Maven repository, you only need to include the dependency for that repository.
## 1. Open Maven window {#1-open-maven-window}
In IntelliJ IDEA, navigate to **View** \> **Tool Windows** \> **Maven** to open the Maven window.

## 2. Generate sources {#2-generate-sources}
Click the icons for **Reimport All Maven Projects and Generate Sources** and **Update Folders for All Projects** .

The sources will be generated in the target folder inside the Maven project structure. This project can be built and used as a standalone dependency in any project you need to develop.

### Step 5 - Step five: Make a POST API call {#step-5---step-five-make-a-post-api-call}
In this step we will make a POST API call to initiate an inquiry using the generated API client.
## 1. Main class {#1-main-class}
Create a Java file called Main.java in the `com.mastercard.api.orc` package.
## 2. Prepare the API key details {#2-prepare-the-api-key-details}
Add the following code to the `main()` method of the class. This will make your OAuth credentials available to the program and will create the PrivateKey used for signing the requests.
```java
String consumerKey = "#YOUR 97 CHARACTER CONSUMER KEY HERE#";
String signingKeyFilePath = "#PATH TO YOUR P12 FILE HERE#";
String signingKeyAlias = "#YOUR KEY ALIAS HERE#";
String signingKeyPass = "#YOUR KEY PASSWORD HERE#";
// Load the signing key
PrivateKey signingKey = AuthenticationUtils.loadSigningKey(signingKeyFilePath, signingKeyAlias, signingKeyPass);
```
## 3. Configure APIClient {#3-configure-apiclient}
Add the following code to instantiate an ApiClient and configure it to sign requests with your authentication credentials.
The `OkHttpOAuth1Interceptor` used to sign the requests is provided by the Mastercard OAuth1 Signer library. This tutorial also uses `client.setDebugging(true)` to view detailed request information when the application is run.
```java
// Set the ApiClient
ApiClient client = new ApiClient();
OkHttpClient.Builder httpClientBuilder = client.getHttpClient().newBuilder();
// Configure the Mastercard service URL
client.setBasePath("https://sandbox.api.mastercard.com/onboard-risk-check");
// Add the interceptor code responsible for signing HTTP requests
httpClientBuilder.addInterceptor(new OkHttpOAuth1Interceptor(consumerKey, signingKey));
client.setHttpClient(httpClientBuilder.build());
//Debugging is enabled for testing
client.setDebugging(true);
```
## 4. Create the Inquiry object that contains the merchant details {#4-create-the-inquiry-object-that-contains-the-merchant-details}
In this example we plan to get Cyber Health Risks, Sanctions Screening, and Business Identity.
```java
// Form the inquiry request object that contains the details about the merchant
InitiateInquiry inquiry = new InitiateInquiry();
// Add options - cyberHealth is for Cyber Risks
inquiry.addOptionsItem("cyberHealth");
// Add options - sanctionsScreening is for Sanctions Screening
inquiry.addOptionsItem("sanctionsScreening");
// Add options - businessIdentity is for Business Identity
inquiry.addOptionsItem("businessIdentity");
// Construct businessInfo object -- part of criteria
Map businessInfo = new HashMap<>();
// Construct business address object -- part of businessInfo
Map businessAddress = new HashMap<>();
businessAddress.put("streetAddressLine1", "1551 CROSSBEAM DR");
businessAddress.put("streetAddressLine2", "CASSELBERRY");
businessAddress.put("city", "Miami");
businessAddress.put("stateCode", "FL");
businessAddress.put("postalCode", "327075922");
businessAddress.put("countryCode", "US");
// Construct peopleOfSignificantControl address object -- part of peopleOfSignificantControl
Map peopleOfSignificantControlAddress = new HashMap<>();
peopleOfSignificantControlAddress.put("addressOne", "123 Main St.");
peopleOfSignificantControlAddress.put("addressTwo", "village");
peopleOfSignificantControlAddress.put("country", "US");
peopleOfSignificantControlAddress.put("stateProvince", "Texas");
peopleOfSignificantControlAddress.put("city", "Houston");
peopleOfSignificantControlAddress.put("postalCode", "73001");
// Construct List of peopleOfSignificantControl object -- part of businessInfo
//Map peopleOfSignificantControl = new HashMap<>();
List