Custom Mastercard MATCH Connector in Mule - ⋮IWConnect

Custom Mastercard MATCH Connector in Mule

Technology is essential for any business to function competently and efficiently. To ensure that we are providing the best service to our customers, it is imperative that applications run as efficiently and as quickly as possible.  There are many ways to speed up the development process, building a custom connector is one of the possibilities when we want to connect an app to some custom service.

Before we explain why we are building a custom connector and how that specific connector works, it will be useful to explain in more detail the types of connectors, so we don’t get ourselves confused. 

There are two types of connectors, public and custom connectors. Public connectors are the ones that are out-of-the-box and are publicly available. However, custom connectors are not always available publicly, they are the ones built by a developer in an organization, they can be made available to a user, group of users, or the entire organization.

Why do we need to build a custom connector?

Mulesoft offers a huge number of connectors in MuleSoft Connectors Library site to connect applications to different services, but sometimes we might need to access a source or service that is not part of the out-of-the-box connectors provided by Mulesoft. And even though the connector might be publicly available it might not have the features that we are looking for, or we might also need to connect it to a custom or internal service. Custom connectors address this scenario by allowing you to create (and even share) a connector in order to hide the integration complexity, speed up the development process, and greatly reduce the friction of learning a custom module.

There are many reasons why you might want to develop a custom connector, but it’s difficult to come up with a single reason. Below are some of the advantages of building a custom connector

  • Could be reused at all integration points to that system
  • Hides integration complexity and makes development easier
  • Could connect to any API or protocol
  • Greatly reduce the friction of learning a custom module

This article will walk you through the process of how to use our Mastercard MATCH Custom Mule Connector in your project.

What is Mastercard MATCH?

The Mastercard Alert to Control High-risk Merchants (MATCH) allows an acquiring partner to lookup whether another acquiring partner has terminated a merchant in the past, the reason for that termination, and to aid an onboarding decision. This will give acquirers the opportunity to develop and review enhanced or incremental risk information before entering into a merchant agreement.

Mule 4 HTTP connector supports the following types of authentication: Basic Authentication, NTLM Authentication, Digest Authentication, OAuth2 – Authorization Code and OAuth2 – Client Credentials.

Mastercard uses one-legged OAuth 1.0a for authenticating and authorizing client applications. It means every request sent to Mastercard must be digitally signed, and only requests with valid signatures created by authorized clients are granted access to their services.

In addition to that, requests with a body must be signed using the Google Request Body Hash extension for OAuth. Due to this fact, it is not so easy to make calls to Mastercard APIs.

In order to make our developers’ life easier, we developed a custom connector using the Mule SDK and we included dependencies for the API client library generation and the Mastercard OAuth1 Signer library. An alternative option would be to disable the built-in authentication methods and implement the HMAC-SHA1 signing yourself in the flow. Mule 4.2.x provides a DataWeave HMACWith() function that could be used to generate the signature. But building a custom connector will hide the integration complexity, speed up the development process and greatly reduce the friction of learning a custom module.

Mastercard provides the following list of SDKs that can be used in our project: Java, C#, NodeJS, PHP, Python, and Ruby. We will use JAVA SDK in order to do the integration with Mastercard.

<build>
    <plugins>
        <plugin>
            <groupId>org.openapitools</groupId>
            <artifactId>openapi-generator-maven-plugin</artifactId>
            <version>3.3.4</version>
            <executions>
                <execution>
                    <id>Match API REST Client</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <inputSpec>${project.basedir}/src/main/resources/match-v3.yaml</inputSpec>
                        <generatorName>java</generatorName>
                        <configOptions>
                            <sourceFolder>src/gen/java/main</sourceFolder>
                            <hideGenerationTimestamp>true</hideGenerationTimestamp>
                        </configOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
…
<dependency>
     <groupId>com.mastercard.developer</groupId>
     <artifactId>oauth1-signer</artifactId>
     <version>1.2.1</version>
</dependency>
<dependency>
     <groupId>com.google.code.gson</groupId>
     <artifactId>gson</artifactId>
     <version>${gson-version}</version>
</dependency>
<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-annotations</artifactId>
    <version>${swagger-core-version}</version>
</dependency>

Before using this connector, you will need to set up a MATCH project in the Mastercard Developers Portal.

As part of this setup, you’ll receive credentials for your app:

  • A consumer key (displayed on the Mastercard Developer Portal)
  • A private request signing key (matching the public certificate displayed on the Mastercard Developer Portal)

Prior to executing the merchant agreement, the Acquirer submits an inquiry to the MATCH API that includes information on a merchant and the associated principal owner(s). MATCH searches the database for possible matches between the merchant information provided in the inquiry and information related to merchants added to MATCH during the past five years, as well as matches to inquiries performed by other acquirers during the past 360 days. Then MATCH returns details of all merchants found listed in MATCH; the response indicates if each search result is based on an exact match or phonetic matches to each of the data elements provided by the acquirer.

Conclusion

The development of a custom connector revolves around the capacities to be more agile, innovative, customer-centric, efficient, and able to induce/leverage opportunities to hide the integration complexity, speed up the development process and greatly reduce the friction of learning a custom module.

Mulesoft Mastercard Custom Connector enables an easy and much more efficient way to integrate MuleSoft applications with Mastercard. The Custom Mastercard connector can be easily used within the application’s flow to send and receive data via a protocol that provides the acquirers with the opportunity to review enhanced or incremental risk information before entering into a merchant agreement.

If you want to learn more about MuleSoft Mastercard Custom Connector, you can contact us via the contact form below.

Tanja Miloshevska Petrovska
Tanja Miloshevska Petrovska

Lead Technical Consultant