The Mastercard Integration Service is a Service SDK microservice that acts as an integration layer between Backbase's Digital Banking Platform and Mastercard's OpenBanking Connect APIs. It implements Backbase's integration contracts for account information services (AIS) and payment initiation services (PIS), translating them to Mastercard OpenBanking Connect API calls.
This service functions as an adapter that:
- Exposes Backbase-compliant REST APIs for arrangements, payments, and cards
- Transforms Backbase data models to Mastercard OpenBanking Connect formats
- Handles authentication context and request metadata propagation
- Provides asynchronous balance fetching for multiple accounts
mastercard-integration-service
├── config/ # Configuration and API client setup
├── rest/ # REST Controllers implementing Backbase APIs
├── service/ # Business logic layer
├── mapper/ # Data transformation between Backbase and Mastercard models
├── model/ # Internal data models
└── util/ # Utility classes for request handling
Balance Controller (BalanceController)
- Implements Backbase's
BalanceApicontract - Fetches account balances from Mastercard OpenBanking Connect
- Supports batch balance retrieval with asynchronous processing
- Maps both current and available balances
Key Operations:
GET /balances- Retrieve balances for multiple arrangements
Payment Order Controller (PaymentOrderController)
- Implements Backbase's
PaymentOrderIntegrationOutboundApicontract - Manages payment order lifecycle
Key Operations:
POST /payment-orders- Create new payment ordersPUT /payment-orders/{bankReferenceId}- Update existing payment ordersPOST /payment-orders/{bankReferenceId}/cancel- Cancel payment orders
Payment Validation Controller (PaymentValidationController)
- Implements Backbase's
PaymentOrderIntegrationValidatorApicontract - Validates payment order requests before execution
Key Operations:
POST /webhook/payment-order/validate- Validate payment order details
Cards Controller (CardsController)
- Implements Backbase's
CardsApicontract - Provides card management operations with mock implementations
Key Operations:
GET /cards- List cards with optional filtersGET /cards/{id}- Get card detailsPOST /cards- Request new cardPUT /cards/{id}/activate- Activate a cardPUT /cards/{id}/lock-status- Update card lock statusPOST /cards/{id}/pin/request- Request PINPOST /cards/{id}/pin/reset- Reset PINPOST /cards/{id}/replacement- Request card replacementPUT /cards/{id}/limits- Change card limitsPOST /cards/{id}/authorized-users- Add authorized userGET /cards/{id}/replacement/fee- Get replacement fee
- Framework: Spring Boot 3.x with Service SDK 16.1.6
- Java Version: 17
- Build Tool: Maven
- API Generation: BOAT Maven Plugin (Backbase OpenAPI Tools)
- Security: Backbase Auth Security
- Service Discovery: Eureka Client
- Mapping: MapStruct
- API Documentation: OpenAPI/Swagger
service-sdk-starter-core- Core service SDK functionalityservice-sdk-starter-mapping- Data mapping utilitiesauth-security- Security and authenticationbackbase-bom- Bill of materials for version management
The service generates multiple API clients during build:
- Arrangement Manager API - Balance integration contracts
- Payment Order Service API - Payment integration contracts
- Card Manager API - Card management contracts
- Mastercard AIS API - Account Information Service client
- Mastercard APS API - Account Payment Service client
Mastercard OpenBanking Connect API Configuration:
mastercard:
mcob:
api:
baseUri: https://api.mastercard.com/openbanking # Optional custom base URI
proxy:
enabled: false # Enable proxy
host: proxy.example.com # Proxy host
port: 8080 # Proxy portService Registration:
spring:
application:
name: mastercard-integration-service
eureka:
instance:
metadata-map:
public: false # Internal service, not exposed publiclyThe OpenBankingApiConfiguration class:
- Configures the Mastercard API client with custom base URI
- Supports HTTP proxy configuration for corporate environments
- Provides beans for Account Balances API
The service propagates authentication and request context through:
- RequestUtils - Extracts and builds request information including:
- PSU IP Address
- PSU User Agent
- X-Request-ID for tracing
- ASPSP ID from token claims
- Consent ID from token claims
- Transforms Mastercard balance types to Backbase balance models
- Supports "Current" and "Available" balance indicators
- Handles credit/debit indicators
- Calculates final balance amounts considering multiple balance entries
- Maps internal request context to Mastercard's RequestInfo format
- Preserves correlation IDs for distributed tracing
mvn clean installsource .env
mvn spring-boot:run -Dspring-boot.run.profiles=localThe service includes Jib configuration for containerization:
mvn compile jib:dockerBuildThe BOAT Maven Plugin generates code during the generate-sources phase:
-
Backbase API Implementations - Server-side implementations for:
- Arrangement Balance API
- Payment Order API
- Payment Validation API
- Card Manager API
-
Mastercard API Clients - Client-side implementations for:
- Account Information Service (AIS)
- Account Payment Service (APS)
The service includes:
- Integration tests for REST controllers
- Unit tests for mappers
- Spring Cloud Contract stub runner support for contract testing
Run tests:
mvn test- Accepts multiple arrangement IDs
- Fetches balances asynchronously using
AsyncTaskExecutor - Returns consolidated balance information
- Throws
NotFoundExceptionif account balances are not found - Throws
BadRequestExceptionfor API errors
- Currently provides mock implementations
- Generates UUID-based bank reference IDs
- Returns "PROCESSED" status for all operations
- Logs all payment operations for debugging
- Provides mock card data
- Extracts cardholder name from security context (
subclaim) - Returns predefined card attributes (GBP currency, Visa brand, etc.)
- Integrates with Backbase's security framework
- Uses
SecurityContextUtilto extract user claims - Supports OAuth2/OIDC authentication flow
- Propagates consent and ASPSP identifiers from access tokens
The service includes:
- Actuator endpoints for health checks and metrics
- HTTP trace repository for request/response logging
- SLF4J logging with configurable levels
- Service discovery registration with Eureka
- Arrangement Manager - For balance queries
- Payment Order Service - For payment execution
- Card Manager - For card operations
- Account Information Service API
- Payment Service API
- Update relevant controller in
rest/package - Add business logic in
service/package - Create mappers in
mapper/package if needed - Add integration tests
Modify the BOAT plugin executions in pom.xml to:
- Change API specifications
- Adjust package names
- Configure additional generation options
- Payment operations are currently mocked
- Card operations return simulated data
- No actual Mastercard API integration for payments and cards (AIS balances are integrated)
- Complete Mastercard Payment Service integration
- Implement real card management operations
- Add transaction history retrieval
- Support additional account types
- Implement webhook handling for payment status updates
This service works in conjunction with:
- Authorization Server - Provides OAuth2/OIDC authentication
- Backbase Environment - Complete Digital Banking Platform setup
This is a proof-of-concept implementation for integration purposes. Do not use it in production.