Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0815c13
Create EndpointGuideAdapterApi
snehalubale Dec 24, 2025
48cf9b9
Create BaseResponse.java
snehalubale Dec 24, 2025
6572b00
Rename EndpointGuideAdapterApi to EndpointGuideAdapterApi.java
snehalubale Dec 24, 2025
2f45b07
Rename src/main/java/com/mastercard/crossborder/api/rest/endpoint/gui…
snehalubale Dec 24, 2025
9e56ebe
Create DestinationPaymentInstrument.java
snehalubale Dec 24, 2025
4a0b900
Create EndpointGuideResponse.java
snehalubale Dec 24, 2025
b3f9b6d
Create Field.java
snehalubale Dec 24, 2025
0abbc27
Create PaymentType.java
snehalubale Dec 24, 2025
cb9f014
Create SupportedValues.java
snehalubale Dec 24, 2025
6f67748
Create Technical.java
snehalubale Dec 24, 2025
06c12e5
Create AmountDTO.java
snehalubale Dec 24, 2025
d85d71e
Create BegFieldDTO.java
snehalubale Dec 24, 2025
2e42ea9
Create BrandDTO.java
snehalubale Dec 24, 2025
1eb3094
Create Business.java
snehalubale Dec 24, 2025
66920a4
Create BusinessBeg.java
snehalubale Dec 24, 2025
c5d06e5
Create CashPickupDTO.java
snehalubale Dec 24, 2025
a58c598
Create ClearingHouseDetailDTO.java
snehalubale Dec 24, 2025
c53ed6c
Create ClearingPaymentInformationDTO.java
snehalubale Dec 24, 2025
215a891
Create DocumentationDTO.java
snehalubale Dec 24, 2025
fb1fc01
Create FlowTypeDTO.java
snehalubale Dec 24, 2025
7c0f910
Create LimitDTO.java
snehalubale Dec 24, 2025
e44ca5a
Create PreApprovedRequirementDTO.java
snehalubale Dec 24, 2025
0ca21fa
Create ReceiveAmountLimitDTO.java
snehalubale Dec 24, 2025
179fa7e
Create ReceivingInstitutionDTO.java
snehalubale Dec 24, 2025
0910033
Create RestrictedFlowDTO.java
snehalubale Dec 24, 2025
586ed6a
Create SendAmountLimitDTO.java
snehalubale Dec 24, 2025
312d012
Create SupportedCustomerTypeDTO.java
snehalubale Dec 24, 2025
b02c6f4
Create SupportedFxModelDTO.java
snehalubale Dec 24, 2025
4505e74
Create DetailsDeserializer.java
snehalubale Dec 24, 2025
76fb4db
Create JacksonConfig.java
snehalubale Dec 24, 2025
e8b3545
Update MastercardHttpHeaders.java
snehalubale Dec 24, 2025
423406c
Update RestClientServiceImpl.java
snehalubale Dec 24, 2025
2ea4563
Create EndpointGuideAdapter.java
snehalubale Dec 24, 2025
31e16dc
Create EndpointGuideAdapterApiTest.java
snehalubale Dec 24, 2025
f0409f8
Rename src/test/java/com/mastercard/crossborder/api/helper/EndpointGu…
snehalubale Dec 24, 2025
65997bc
Rename src/test/java/com/mastercard/crossborder/api/EndpointGuideAdap…
snehalubale Dec 24, 2025
109df62
Update RestClientServiceImpl.java
snehalubale Dec 29, 2025
41934c8
Create BusinessNew.java
snehalubale Dec 29, 2025
26ad6f6
Update EndpointGuideAdapterApiTest.java
snehalubale Dec 29, 2025
26c0e5e
Update Detail.java
snehalubale Dec 29, 2025
a9b8dfe
Update MastercardHttpHeaders.java
snehalubale Jan 6, 2026
4f61eb3
Update BusinessBeg.java
snehalubale Jan 6, 2026
81eb618
Update ClearingHouseDetailDTO.java
snehalubale Jan 6, 2026
a05430b
Update EndpointGuideResponse.java
snehalubale Jan 6, 2026
ec07cfe
Update EndpointGuideAdapterApi.java
snehalubale Jan 6, 2026
a9100c4
Update RestClientServiceImpl.java
snehalubale Jan 6, 2026
abac647
Update EndpointGuideAdapterApiTest.java
snehalubale Jan 6, 2026
8033c77
Update RestClientServiceImpl.java
snehalubale Jan 6, 2026
fd04f19
Update README.md
snehalubale Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,3 +520,17 @@ N] [Generate IBAN API](https://developer.mastercard.com/send-cross-border/docume
- OI calls the service to generate the IBAN but the country is not entered in acceptable format, use case 14
- OI calls the service to generate the IBAN but the Bank Identifier is incorrect, use case 15
- The above use cases just shows two the examples of error handling

O] [Endpoint Guide API](https://developer.mastercard.com/cross-border-services/documentation/api-ref/endpoint-guide-adapter_api/):

> Case 1: **Test Endpoint Guide API for TEG data with encryption**
- OI can call this method to get details of TEG data for a specific corridor
- In this use case, we need to pass payment type, destination payment instrument, destination country and destination currency as request headers. A successful response would result with TEG data.

> Case 2: **Error scenario**
- OI calls the service to get TEG data but the corridor details are incorrect
- API results in error response as resource unknown

> Case 3: **Test Endpoint Guide API for BEG data with encryption**
- OI can call this method to get details of TEG data for a specific corridor
- In this use case, we need to pass payment type, destination payment instrument, destination country and destination currency as request headers. A successful response would result with BEG data.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.mastercard.crossborder.api.config;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import com.mastercard.crossborder.api.rest.response.Detail;
import com.mastercard.crossborder.api.rest.response.Details;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DetailsDeserializer extends JsonDeserializer<Details> {
@Override
public Details deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
JsonNode node = p.getCodec().readTree(p);

Details details = new Details();

if (node.isArray()) {
// Deserialize as a list of Detail objects
List<Detail> detailList = new ArrayList<>();
for (JsonNode detailNode : node) {
Detail detail = p.getCodec().treeToValue(detailNode, Detail.class);
detailList.add(detail);
}
details.setDetails(detailList);
} else if (node.isObject()) {
// Deserialize as a single Detail object
Detail detail = p.getCodec().treeToValue(node, Detail.class);
details.setDetails(Collections.singletonList(detail));
}

return details;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mastercard.crossborder.api.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.mastercard.crossborder.api.rest.response.Details;
import org.springframework.context.annotation.Primary;

@Configuration
public class JacksonConfig {
@Bean
@Primary
public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(Details.class, new DetailsDeserializer());
objectMapper.registerModule(module);
return objectMapper;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.mastercard.crossborder.api.constants;

public enum MastercardHttpHeaders {
ENCRYPTED_HEADER("x-encrypted");
ENCRYPTED_HEADER("x-encrypted"),
PARTNER_REF_ID("Partner-Ref-Id"),
SPECIFICATION_TYPE("Specification-Type");

private final String text;

MastercardHttpHeaders(String text) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api;

import com.mastercard.crossborder.api.exception.ServiceException;
import com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response.EndpointGuideResponse;
import com.mastercard.crossborder.api.service.RestClientService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class EndpointGuideAdapterApi {
@Autowired
RestClientService restClientService; // NOSONAR
private static final Logger logger = LoggerFactory.getLogger(EndpointGuideAdapterApi.class);
public static final String ENDPOINT_GUIDE_ADAPTER_URL="crossborder/endpoint-guide/specifications?payment_type={paymentType}&destination_payment_instrument={destinationPaymentInstrument}&destination_country={destinationCountry}&destination_currency={destinationCurrency}";

public List<EndpointGuideResponse> getEndpointWithEncryption(HttpHeaders headers, Map<String, Object> requestParams) throws ServiceException {
logger.info("Calling Endpoint guide adapter api with encryption");
return (List<EndpointGuideResponse>) restClientService.serviceEncryption(ENDPOINT_GUIDE_ADAPTER_URL,headers, HttpMethod.GET, requestParams,null, List.class, true, EndpointGuideResponse.class);
}

public List<EndpointGuideResponse> getEndpoint(HttpHeaders headers, Map<String, Object> requestParams) throws ServiceException {
logger.info("Calling Endpoint guide adapter api ");
return (List<EndpointGuideResponse>) restClientService.service(ENDPOINT_GUIDE_ADAPTER_URL,headers, HttpMethod.GET, requestParams,null, List.class, true,EndpointGuideResponse.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;

@Getter
@Setter
public class BaseResponse {
@JsonIgnore
private String correlationId;
@JsonIgnore
private HttpStatus responseCode;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

public enum DestinationPaymentInstrument {
BANK, CASH, CARD, EWALLET, MWALLET, BANKWIRE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response.begapi.BusinessBeg;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.SneakyThrows;


@EqualsAndHashCode(callSuper = true)
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class EndpointGuideResponse extends BaseResponse {
private PaymentType paymentType;
private String destinationCountry;
private String destinationCurrency;
private DestinationPaymentInstrument destinationPaymentInstrument;
private Technical technical;
private BusinessBeg business;

@SneakyThrows
@Override
public String toString() {
return new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_EMPTY).writeValueAsString(this);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;



@Data
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class Field {
private String fieldName;
private String mandatory;
private String validationPattern;
private String additionalFieldId;
private String additionalFieldName;
private String specialNotes;
private Date effectiveDate;
private Date lastUpdatedTime;
private String lastUpdateComments;
private List<SupportedValues> supportedValues;

private Field(FieldBuilder fieldBuilder) {
this.additionalFieldId=fieldBuilder.additionalFieldId;
this.additionalFieldName=fieldBuilder.additionalFieldName;
this.fieldName=fieldBuilder.fieldName;
this.mandatory=fieldBuilder.mandatory;
this.validationPattern=fieldBuilder.validationPattern;
this.specialNotes=fieldBuilder.specialNotes;
this.effectiveDate = fieldBuilder.effectiveDate;
this.lastUpdatedTime = fieldBuilder.lastUpdatedTime;
this.lastUpdateComments = fieldBuilder.lastUpdateComments;
this.supportedValues=fieldBuilder.supportedValues;

}

public Field() {

}

public String getSpecialNotes() {
specialNotes= specialNotes!=null?specialNotes.
replaceAll("(?i)\\[\\s*(Payment|Quote)\\s+(Req|Resp)\\s*-\\s*[MO]\\s*\\]\\s*", "")
.replaceAll("\\s+", " ") // Replace multiple spaces/newlines with a single space
.trim():null;
specialNotes= specialNotes==null?"":specialNotes;
if (specialNotes.isEmpty()){
specialNotes=null;
}
return specialNotes;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Field field = (Field) o;
return Objects.equals(fieldName, field.fieldName) && Objects.equals(additionalFieldId, field.additionalFieldId);
}

@Override
public int hashCode() {
return Objects.hash(fieldName, additionalFieldId);
}

public static class FieldBuilder {
private String fieldName;
private String mandatory;
private String validationPattern;
private String additionalFieldId;
private String additionalFieldName;
private String specialNotes;
private Date effectiveDate;
private Date lastUpdatedTime;
private String lastUpdateComments;
private List<SupportedValues> supportedValues;

public FieldBuilder setMandatory(String mandatory) {
this.mandatory = mandatory;
return this;
}

public FieldBuilder setFieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}

public FieldBuilder setValidationPattern(String validationPattern) {
this.validationPattern = validationPattern;
return this;
}

public FieldBuilder setAdditionalFieldId(String additionalFieldId) {
this.additionalFieldId = additionalFieldId;
return this;
}

public FieldBuilder setAdditionalFieldName(String additionalFieldName) {
this.additionalFieldName = additionalFieldName;
return this;
}

public FieldBuilder setSpecialNotes(String specialNotes) {
this.specialNotes = specialNotes;
return this;
}
public void setEffectiveDate(Date effectiveDate) {
this.effectiveDate = effectiveDate;
}
public void setLastUpdatedTime(Date lastUpdatedTime) {
this.lastUpdatedTime = lastUpdatedTime;
}

public void setLastUpdateComments(String lastUpdateComments) {
this.lastUpdateComments = lastUpdateComments;
}

public FieldBuilder setSupportedValues(List<SupportedValues> supportedValues) {
this.supportedValues = supportedValues;
return this;
}

public Field build() {
return new Field(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

public enum PaymentType {
B2P, B2B, G2P, P2P, P2B
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class SupportedValues {

private String id;
private String name;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;
import lombok.Data;

@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Technical {
private String specialNotes;
private String lastUpdatedTime;
private List<Field> fields;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response.begapi;

import lombok.Data;
import org.springframework.stereotype.Component;

@Data
@Component
public class AmountDTO {
private double value;
private String currency;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mastercard.crossborder.api.rest.endpoint.guide.adapter.api.response.begapi;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class BegFieldDTO {

private String begFieldMappingId;
private String endPointId;
private String region;
private Boolean recipientNotification;
private String channelReach;
private String deliveryTime;
private String notes;
private String country;
private String channels;
private String onTheFlyWalletCreation;
private String registrationRequirements;
private Boolean isInternal;
//Need to do its mapping from the RSD API Response
private String serviceType;
private String paymentType;
private String destinationCurrency;
}
Loading