- Overview
- Requirements
- Integrating with OpenAPI Generator
- Configuration
- Use-Cases
- Execute the Use-Cases
- Service Documentation
- API Reference
- Support
- License
This is a reference application to demonstrate how Elevate Accelerator Proxy APIs can be used. To call these APIs, consumer key and .p12 file required from your project on Mastercard Developers.
- Mastercard Developers Account with access to "Elevate" API
- Java 11
- Apache maven 3.3+
- A text Editor or any IDE
- Apache Maven
- OpenAPI Generator
OpenAPI Generator generates API client libraries from OpenAPI Specs. It provides generators and library templates for supporting multiple languages and frameworks. Check Generating and Configuring a Mastercard API Client to know more about how to generate a simple API client for consuming APIs.
See also:
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/elevate-accelerator-proxy-services.yaml</inputSpec>
<generatorName>java</generatorName>
<library>okhttp-gson</library>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>src/gen/main/java</sourceFolder>
<dateLibrary>java8</dateLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Now that you have all the dependencies you need, you can generate the sources. To do this, use one of the following two methods:
Using IDE
-
Method 1
In IntelliJ IDEA, open the Maven window (View > Tool Windows > Maven). Click the iconsReimport All Maven Projects
andGenerate Sources and Update Folders for All Projects
-
Method 2
In the same menu, navigate to the commands ({Project name} > Lifecycle), selectclean
andcompile
then click the iconRun Maven Build
.
Using Terminal
Navigate to the root directory of the project within a terminal window and execute mvn clean compile
command.
- Create your account on Mastercard Developers if you don't have it already.
- Create a new project here and add Elevate to it and click continue.
- Download Sandbox Signing Key, a
.p12
file will be downloaded. - In the Client Encryption Keys section of the dashboard, click on the
Actions
dropdown and download the client encryption key, a ``.pem``` file will be downloaded. - Copy the downloaded
.p12
and.pem
files tosrc/main/resources
folder in your code. - Open
src/main/resources/application.properties
and configure:mastercard.elevate.client.p12.path
- Path to keystore (.p12) file, just change the name as per the downloaded file in step 5.mastercard.elevate.client.ref.app.consumer.key
- Copy the Consumer key from "Sandbox/Production Keys" section on your project pagemastercard.elevate.client.ref.app.keystore.alias
- Alias of your key. Default key alias for the sandbox iskeyalias
.mastercard.elevate.client.ref.app.keystore.password
- Password of your Keystore. Default keystore password for sandbox project iskeystorepassword
.mastercard.elevate.client.ref.app.encryption.file
- Path to encryption key (.pem) file, just change the name as per the downloaded file in step 5, e.g.src/main/resources/<fileName>.pem
.
-
Check Eligibility
Endpoint: "/eligibility". Used to check eligibility of a credit card in elevate program for a specific benefit. -
Create Redemptions
Endpoint: "/redemptions". Used to create a redemption for a credit card that was previously enrolled through the eligibilities resource.
More details can be found here.
Below are the APIs exposed by this application:
- POST /elevate/eligibility
- POST /elevate/redemptions
Once you have added the correct properties, you are ready to build the application. You can do this by navigating to the project’s base directory from the terminal and then by running the following command.
mvn clean install
When the project builds successfully, you can run the following command to start the project
- Run
java -jar target/elevate-accelerator-1.0.0.jar
command to run the application. - Add argument
checkEligibility
orredemption
in above command to execute each api individually:- For example, run
java -jar target/elevate-accelerator-1.0.0.jar checkEligibility
command to execute the/eligibility
api, - Run
java -jar target/elevate-accelerator-1.0.0.jar redemption
command to execute the/redemption
api.
- For example, run
NOTE:
- Update request with valid details in json files under location /src/main/resources/templates/
in order to execute these apis successfully.
- For each new call, you should change the email address,such as, dane+101@ifonly.com or dane+102@ifonly.com. If you use the same email address, you may get an error that the benefit has already been redeemed (this is expected). For each new call, you should change the card number. Use the number generator to generate a number that passes the MOD10/Luhn test. The range of eligible PANs is 5555555555550000 through 5555555555559999.
Elevate Accelerator Proxy documentation can be found here.
The Swagger API specification can be found here.
Please email apisupport@mastercard.com with any questions or feedback you may have.
Copyright 2021 Mastercard
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.