make MPGS requests easy
Maven
<dependency>
<groupId>com.github.marcoblos</groupId>
<artifactId>mastercard-mpgs-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
MastercardProperties properties = new MastercardProperties();
properties.setBaseUrl("https://eu-gateway.mastercard.com/api/rest/version/");
properties.setApiVersion("45");
properties.setMerchantId("TEST...");
properties.setApiKey("xxxxxxxxxxxxxxxxxx");
MastercardRestTemplate restTemplate = new MastercardRestTemplate(properties.getMerchantId(), properties.getApiKey());
// normally you get this informations from your user and your system (amount,
// credit card data, etc.) this isnecessary data to build the MPGS request
MastercardRequestDTO dto = MastercardRequestDTO.builder()
.apiOperation(MastercardAPIOperationType.PAY)
.amount(new BigDecimal("10000.00"))
.cardNumber("cccccccccccccccc")
...
.build();
MastercardRequestResponseDTO requestResponseDTO = MastercardObjectRequestFactory.build(dto);
MastercardResponse response = MastercardBaseRequest.execute(restTemplate, properties, requestResponseDTO, "myOrderId323214343");
// PS: the value "myOrderId323214343" is generated by you and you need tu used
// it to identify the orders in the Mastercard MPGS Panel
...
...
MastercardRequestDTO dto = MastercardRequestDTO.builder()
.apiOperation(MastercardAPIOperationType.REFUND)
.amount(new BigDecimal("5000.00"))
.currency("EUR")
.build();
MastercardRequestResponseDTO requestResponseDTO = MastercardObjectRequestFactory.build(dto);
MastercardResponse response = MastercardBaseRequest.execute(restTemplate, properties, requestResponseDTO, "myOrderId323214343");
// PS: the value "myOrderId323214343" it is the same that you previously used in the pay method and that you wish to refund now
mvn clean install
Marco Blos – marcoblos1234@gmail.com
Distributed under the Apache 2.0 license. See LICENSE
for more information.
https://github.com/marcoblos/mastercard-mpgs-sdk
- Fork it (https://github.com/marcoblos/mastercard-mpgs-sdk/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request