This is a reference application that demonstrates how Available Merchant Offers APIs can be used. Please see here for details on the APIs: Mastercard Developers. This application requires consumer key and .p12 file as received from Mastercard Developers.
-
Maven 3.6 or later
-
JDK 1.8.0 or later
-
Spring Boot 2.2+
-
A text editor or IDE
If you do not want to use the default STAGE keys associated with this project.
- Setup account at Mastercard Developers
- Create a project & download signing key for the Avail Merchant Offers API. It will download a zip file.
- Select .p12 file and copy it to
src\main\resources
folder. - Open
${project.basedir}/src/main/resources/application.properties
and set these parameters: [consumerKey, signingKeyFilePath, keyalias, keystorepassword]. Replace 'stage' with 'sandbox' in the basepath parameter
Running outside of IDE, from command line
-
mvn clean install
-
java -jar target/AvailMerchantOffersReferenceImpl-1.0.jar
Go to your browser: localhost:8080/ and work through the application
Running on IntelliJ IDE.
-
On IntelliJ IDEA: File/New/Project From Version Control/
-
Open Maven window to generate dependencies: Click on Lifecycle - Clean & Install Compile: Lifecycle - Compile
-
Run AvailableOffersApplication.java
This will start up your local server at port 8080
Go to your browser: localhost:8080/ and work through the application
-
Could not run this service on Sandbox as the service is not configured properly in Sandbox. Works from STAGE though, however STAGE is not stable all the time
-
It returns a null pointer exception where no offers are found
-
Does not follow proper MC Error handling standards
-
Offers API has Category Code as optional but it looks to be a mandatory