Skip to content

Commit

Permalink
Grabbing latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
niallmartinryan committed Dec 22, 2023
1 parent 00e5254 commit 09aedfe
Show file tree
Hide file tree
Showing 28 changed files with 192 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import com.mastercard.developer.transactionapi.client.model.BatchResponse;
import com.mastercard.developer.transactionapi.exception.TransactionApiException;
import org.openapitools.client.model.InitiationAuthorisationInitiationV02;
import org.openapitools.client.model.InitiationFinancialInitiationV02;
import org.openapitools.client.model.InitiationInquiryInitiationV01;
import org.openapitools.client.model.InitiationReversalInitiationV02;
import org.openapitools.client.model.ResponseAuthorisationResponseV02;
import org.openapitools.client.model.ResponseFinancialResponseV02;
import org.openapitools.client.model.ResponseInquiryResponseV01;
import org.openapitools.client.model.ResponseReversalResponseV02;
import org.openapitools.client.model.AuthorisationinitiationAuthorisationInitiationV02;
import org.openapitools.client.model.AuthorisationresponseAuthorisationResponseV02;
import org.openapitools.client.model.FinancialinitiationFinancialInitiationV02;
import org.openapitools.client.model.FinancialresponseFinancialResponseV02;
import org.openapitools.client.model.InquiryinitiationInquiryInitiationV01;
import org.openapitools.client.model.InquiryresponseInquiryResponseV01;
import org.openapitools.client.model.ReversalinitiationReversalInitiationV02;
import org.openapitools.client.model.ReversalresponseReversalResponseV02;

/**
* REST client for the Transaction API.
Expand All @@ -24,7 +24,7 @@ public interface TransactionApiClient {
* @param authorisationRequest authorisation request
* @return Correlation ID of the accepted request
*/
String submitAuthorisationRequest(InitiationAuthorisationInitiationV02 authorisationRequest) throws TransactionApiException;
String submitAuthorisationRequest(AuthorisationinitiationAuthorisationInitiationV02 authorisationRequest) throws TransactionApiException;

/**
* Submits the reversal request for processing.
Expand All @@ -34,7 +34,7 @@ public interface TransactionApiClient {
* @param reversalRequest reversal request
* @return Correlation ID of the accepted request
*/
String submitReversalRequest(InitiationReversalInitiationV02 reversalRequest) throws TransactionApiException;
String submitReversalRequest(ReversalinitiationReversalInitiationV02 reversalRequest) throws TransactionApiException;

/**
* Submits the inquiry request for processing.
Expand All @@ -44,7 +44,7 @@ public interface TransactionApiClient {
* @param inquiryRequest inquiry request
* @return Correlation ID of the accepted request
*/
String submitInquiryRequest(InitiationInquiryInitiationV01 inquiryRequest) throws TransactionApiException;
String submitInquiryRequest(InquiryinitiationInquiryInitiationV01 inquiryRequest) throws TransactionApiException;

/**
* Submits the financial advice for processing.
Expand All @@ -54,7 +54,7 @@ public interface TransactionApiClient {
* @param financialAdviceRequest financial advice
* @return Correlation ID of the accepted request
*/
String submitFinancialAdviceRequest(InitiationFinancialInitiationV02 financialAdviceRequest) throws TransactionApiException;
String submitFinancialAdviceRequest(FinancialinitiationFinancialInitiationV02 financialAdviceRequest) throws TransactionApiException;

/**
* Polls for available authorisation responses
Expand All @@ -63,7 +63,7 @@ public interface TransactionApiClient {
*
* @return response batch
*/
BatchResponse<ResponseAuthorisationResponseV02> getAuthorisationResponses() throws TransactionApiException;
BatchResponse<AuthorisationresponseAuthorisationResponseV02> getAuthorisationResponses() throws TransactionApiException;

/**
* Polls for available reversal responses
Expand All @@ -72,7 +72,7 @@ public interface TransactionApiClient {
*
* @return response batch
*/
BatchResponse<ResponseReversalResponseV02> getReversalResponses() throws TransactionApiException;
BatchResponse<ReversalresponseReversalResponseV02> getReversalResponses() throws TransactionApiException;

/**
* Polls for available inquiry responses
Expand All @@ -81,7 +81,7 @@ public interface TransactionApiClient {
*
* @return response batch
*/
BatchResponse<ResponseInquiryResponseV01> getInquiryResponses() throws TransactionApiException;
BatchResponse<InquiryresponseInquiryResponseV01> getInquiryResponses() throws TransactionApiException;

/**
* Polls for available financial advice responses
Expand All @@ -90,6 +90,6 @@ public interface TransactionApiClient {
*
* @return response batch
*/
BatchResponse<ResponseFinancialResponseV02> getFinancialAdviceResponses() throws TransactionApiException;
BatchResponse<FinancialresponseFinancialResponseV02> getFinancialAdviceResponses() throws TransactionApiException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
import org.openapitools.client.ApiResponse;
import org.openapitools.client.api.TransactionApiApi;
import org.openapitools.client.model.AuthorisationResponseV02List;
import org.openapitools.client.model.AuthorisationinitiationAuthorisationInitiationV02;
import org.openapitools.client.model.AuthorisationresponseAuthorisationResponseV02;
import org.openapitools.client.model.FinancialAdviceResponseV02List;
import org.openapitools.client.model.InitiationAuthorisationInitiationV02;
import org.openapitools.client.model.InitiationFinancialInitiationV02;
import org.openapitools.client.model.InitiationInquiryInitiationV01;
import org.openapitools.client.model.InitiationReversalInitiationV02;
import org.openapitools.client.model.FinancialinitiationFinancialInitiationV02;
import org.openapitools.client.model.FinancialresponseFinancialResponseV02;
import org.openapitools.client.model.InquiryResponseV01List;
import org.openapitools.client.model.ResponseAuthorisationResponseV02;
import org.openapitools.client.model.ResponseFinancialResponseV02;
import org.openapitools.client.model.ResponseInquiryResponseV01;
import org.openapitools.client.model.ResponseReversalResponseV02;
import org.openapitools.client.model.InquiryinitiationInquiryInitiationV01;
import org.openapitools.client.model.InquiryresponseInquiryResponseV01;
import org.openapitools.client.model.ReversalResponseV02List;
import org.openapitools.client.model.ReversalinitiationReversalInitiationV02;
import org.openapitools.client.model.ReversalresponseReversalResponseV02;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

Expand Down Expand Up @@ -64,7 +64,7 @@ interface ResponseSupplier<P> {
* @return Correlation ID of the accepted request
*/
@Override
public String submitAuthorisationRequest(InitiationAuthorisationInitiationV02 authorisationRequest) throws TransactionApiException {
public String submitAuthorisationRequest(AuthorisationinitiationAuthorisationInitiationV02 authorisationRequest) throws TransactionApiException {
try {
log.info("Calling Transaction API processAuthorisationRequest");
ApiResponse<Void> response = transactionApiApi.transactionApiProcessAuthorisationRequestWithHttpInfo(authorisationRequest);
Expand All @@ -85,7 +85,7 @@ public String submitAuthorisationRequest(InitiationAuthorisationInitiationV02 au
* @return Correlation ID of the accepted request
*/
@Override
public String submitReversalRequest(InitiationReversalInitiationV02 reversalRequest) throws TransactionApiException {
public String submitReversalRequest(ReversalinitiationReversalInitiationV02 reversalRequest) throws TransactionApiException {
try {
log.info("Calling Transaction API processReversalRequest");
ApiResponse<Void> response = transactionApiApi.transactionApiProcessReversalRequestWithHttpInfo(reversalRequest);
Expand All @@ -106,7 +106,7 @@ public String submitReversalRequest(InitiationReversalInitiationV02 reversalRequ
* @return Correlation ID of the accepted request
*/
@Override
public String submitInquiryRequest(InitiationInquiryInitiationV01 inquiryRequest) throws TransactionApiException {
public String submitInquiryRequest(InquiryinitiationInquiryInitiationV01 inquiryRequest) throws TransactionApiException {
try {
log.info("Calling Transaction API processInquiryRequest");
ApiResponse<Void> response = transactionApiApi.transactionApiProcessInquiryRequestWithHttpInfo(inquiryRequest);
Expand All @@ -127,7 +127,7 @@ public String submitInquiryRequest(InitiationInquiryInitiationV01 inquiryRequest
* @return Correlation ID of the accepted request
*/
@Override
public String submitFinancialAdviceRequest(InitiationFinancialInitiationV02 financialAdviceRequest) throws TransactionApiException {
public String submitFinancialAdviceRequest(FinancialinitiationFinancialInitiationV02 financialAdviceRequest) throws TransactionApiException {
try {
log.info("Calling Transaction API processFinancialAdviceRequest");
ApiResponse<Void> response = transactionApiApi.transactionApiProcessFinancialAdviceRequestWithHttpInfo(financialAdviceRequest);
Expand All @@ -148,13 +148,13 @@ public String submitFinancialAdviceRequest(InitiationFinancialInitiationV02 fina
* @return response batch
*/
@Override
public BatchResponse<ResponseAuthorisationResponseV02> getAuthorisationResponses() throws TransactionApiException {
public BatchResponse<AuthorisationresponseAuthorisationResponseV02> getAuthorisationResponses() throws TransactionApiException {
try {
log.info("Calling Transaction API getAuthorisationResponses");
ApiResponse<AuthorisationResponseV02List> response = handleTooEarly(() ->
transactionApiApi.transactionApiGetAuthorisationResponsesWithHttpInfo(RESPONSE_BATCH_LIMIT));

BatchResponse<ResponseAuthorisationResponseV02> batchResponse = BatchResponse.<ResponseAuthorisationResponseV02>builder()
BatchResponse<AuthorisationresponseAuthorisationResponseV02> batchResponse = BatchResponse.<AuthorisationresponseAuthorisationResponseV02>builder()
.items(wrapItems(response, AuthorisationResponseV02List::getItems, AuthorisationResponseItem::new))
.hasMore(response.getStatusCode() == HttpStatus.SC_PARTIAL_CONTENT)
.retryAfter(getRetryAfter(response))
Expand All @@ -175,13 +175,13 @@ public BatchResponse<ResponseAuthorisationResponseV02> getAuthorisationResponses
* @return response batch
*/
@Override
public BatchResponse<ResponseReversalResponseV02> getReversalResponses() throws TransactionApiException {
public BatchResponse<ReversalresponseReversalResponseV02> getReversalResponses() throws TransactionApiException {
try {
log.info("Calling Transaction API getReversalResponses");
ApiResponse<ReversalResponseV02List> response = handleTooEarly(() ->
transactionApiApi.transactionApiGetReversalResponsesWithHttpInfo(RESPONSE_BATCH_LIMIT));

BatchResponse<ResponseReversalResponseV02> batchResponse = BatchResponse.<ResponseReversalResponseV02>builder()
BatchResponse<ReversalresponseReversalResponseV02> batchResponse = BatchResponse.<ReversalresponseReversalResponseV02>builder()
.items(wrapItems(response, ReversalResponseV02List::getItems, ReversalResponseItem::new))
.hasMore(response.getStatusCode() == HttpStatus.SC_PARTIAL_CONTENT)
.retryAfter(getRetryAfter(response))
Expand All @@ -202,13 +202,13 @@ public BatchResponse<ResponseReversalResponseV02> getReversalResponses() throws
* @return response batch
*/
@Override
public BatchResponse<ResponseInquiryResponseV01> getInquiryResponses() throws TransactionApiException {
public BatchResponse<InquiryresponseInquiryResponseV01> getInquiryResponses() throws TransactionApiException {
try {
log.info("Calling Transaction API getInquiryResponses");
ApiResponse<InquiryResponseV01List> response = handleTooEarly(() ->
transactionApiApi.transactionApiGetInquiryResponsesWithHttpInfo(RESPONSE_BATCH_LIMIT));

BatchResponse<ResponseInquiryResponseV01> batchResponse = BatchResponse.<ResponseInquiryResponseV01>builder()
BatchResponse<InquiryresponseInquiryResponseV01> batchResponse = BatchResponse.<InquiryresponseInquiryResponseV01>builder()
.items(wrapItems(response, InquiryResponseV01List::getItems, InquiryResponseItem::new))
.hasMore(response.getStatusCode() == HttpStatus.SC_PARTIAL_CONTENT)
.retryAfter(getRetryAfter(response))
Expand All @@ -229,13 +229,13 @@ public BatchResponse<ResponseInquiryResponseV01> getInquiryResponses() throws Tr
* @return response batch
*/
@Override
public BatchResponse<ResponseFinancialResponseV02> getFinancialAdviceResponses() throws TransactionApiException {
public BatchResponse<FinancialresponseFinancialResponseV02> getFinancialAdviceResponses() throws TransactionApiException {
try {
log.info("Calling Transaction API getFinancialAdviceResponses");
ApiResponse<FinancialAdviceResponseV02List> response = handleTooEarly(() ->
transactionApiApi.transactionApiGetFinancialAdviceResponsesWithHttpInfo(RESPONSE_BATCH_LIMIT));

BatchResponse<ResponseFinancialResponseV02> batchResponse = BatchResponse.<ResponseFinancialResponseV02>builder()
BatchResponse<FinancialresponseFinancialResponseV02> batchResponse = BatchResponse.<FinancialresponseFinancialResponseV02>builder()
.items(wrapItems(response, FinancialAdviceResponseV02List::getItems, FinancialAdviceResponseItem::new))
.hasMore(response.getStatusCode() == HttpStatus.SC_PARTIAL_CONTENT)
.retryAfter(getRetryAfter(response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import lombok.RequiredArgsConstructor;
import org.openapitools.client.model.AuthorisationResponseV02Item;
import org.openapitools.client.model.AuthorisationresponseAuthorisationResponseV02;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.ResponseAuthorisationResponseV02;

import java.util.List;

/**
* Adapter class for an Authorisation response item.
*/
@RequiredArgsConstructor
public class AuthorisationResponseItem implements ResponseItem<ResponseAuthorisationResponseV02> {
public class AuthorisationResponseItem implements ResponseItem<AuthorisationresponseAuthorisationResponseV02> {

private final AuthorisationResponseV02Item responseItem;

Expand All @@ -26,7 +26,7 @@ public int getHttpStatus() {
}

@Override
public ResponseAuthorisationResponseV02 getPayload() {
public AuthorisationresponseAuthorisationResponseV02 getPayload() {
return responseItem.getPayload();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import lombok.RequiredArgsConstructor;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.FinancialAdviceResponseV02Item;
import org.openapitools.client.model.ResponseFinancialResponseV02;
import org.openapitools.client.model.FinancialresponseFinancialResponseV02;

import java.util.List;

/**
* Adapter class for a Financial Advice response item.
*/
@RequiredArgsConstructor
public class FinancialAdviceResponseItem implements ResponseItem<ResponseFinancialResponseV02> {
public class FinancialAdviceResponseItem implements ResponseItem<FinancialresponseFinancialResponseV02> {

private final FinancialAdviceResponseV02Item responseItem;

Expand All @@ -26,7 +26,7 @@ public int getHttpStatus() {
}

@Override
public ResponseFinancialResponseV02 getPayload() {
public FinancialresponseFinancialResponseV02 getPayload() {
return responseItem.getPayload();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import lombok.RequiredArgsConstructor;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.InquiryResponseV01Item;
import org.openapitools.client.model.ResponseInquiryResponseV01;
import org.openapitools.client.model.InquiryresponseInquiryResponseV01;

import java.util.List;

/**
* Adapter class for an Inquiry response item.
*/
@RequiredArgsConstructor
public class InquiryResponseItem implements ResponseItem<ResponseInquiryResponseV01> {
public class InquiryResponseItem implements ResponseItem<InquiryresponseInquiryResponseV01> {

private final InquiryResponseV01Item responseItem;

Expand All @@ -26,7 +26,7 @@ public int getHttpStatus() {
}

@Override
public ResponseInquiryResponseV01 getPayload() {
public InquiryresponseInquiryResponseV01 getPayload() {
return responseItem.getPayload();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import lombok.RequiredArgsConstructor;
import org.openapitools.client.model.Error;
import org.openapitools.client.model.ResponseReversalResponseV02;
import org.openapitools.client.model.ReversalResponseV02Item;
import org.openapitools.client.model.ReversalresponseReversalResponseV02;

import java.util.List;

/**
* Adapter class for a Reversal response item.
*/
@RequiredArgsConstructor
public class ReversalResponseItem implements ResponseItem<ResponseReversalResponseV02> {
public class ReversalResponseItem implements ResponseItem<ReversalresponseReversalResponseV02> {

private final ReversalResponseV02Item responseItem;

Expand All @@ -26,7 +26,7 @@ public int getHttpStatus() {
}

@Override
public ResponseReversalResponseV02 getPayload() {
public ReversalresponseReversalResponseV02 getPayload() {
return responseItem.getPayload();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.mastercard.developer.transactionapi.example.RequestExampleGenerator;
import com.mastercard.developer.transactionapi.utils.ClientUtils;
import lombok.extern.slf4j.Slf4j;
import org.openapitools.client.model.InitiationAuthorisationInitiationV02;
import org.openapitools.client.model.AuthorisationinitiationAuthorisationInitiationV02;
import org.springframework.stereotype.Service;

/**
Expand All @@ -26,7 +26,7 @@ public AuthorisationRequestSubmitter(TransactionApiClient transactionApiClient,
*/
@Override
protected void submitRequest() {
InitiationAuthorisationInitiationV02 request = getRequestExampleGenerator().buildAuthorisationRequest();
AuthorisationinitiationAuthorisationInitiationV02 request = getRequestExampleGenerator().buildAuthorisationRequest();

String correlationId = getTransactionApiClient().submitAuthorisationRequest(request);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
import com.mastercard.developer.transactionapi.config.TransactionApiProperties;
import com.mastercard.developer.transactionapi.context.RequestContextManager;
import com.mastercard.developer.transactionapi.enums.FlowType;
import org.openapitools.client.model.ResponseAuthorisationResponseV02;
import org.openapitools.client.model.AuthorisationresponseAuthorisationResponseV02;
import org.springframework.stereotype.Service;

/**
* Polls for authorisation responses from the Transaction API.
*/
@Service
public class AuthorisationResponsePoller extends ResponsePoller<ResponseAuthorisationResponseV02> {
public class AuthorisationResponsePoller extends ResponsePoller<AuthorisationresponseAuthorisationResponseV02> {

public AuthorisationResponsePoller(RequestContextManager requestContextManager, TransactionApiClient transactionApiClient, TransactionApiProperties transactionApiProperties) {
super(FlowType.AUTHORISATION, requestContextManager, transactionApiClient, transactionApiProperties);
}

@Override
protected BatchResponse<ResponseAuthorisationResponseV02> getResponses() {
protected BatchResponse<AuthorisationresponseAuthorisationResponseV02> getResponses() {
return getTransactionApiClient().getAuthorisationResponses();
}

@Override
protected String toJson(ResponseAuthorisationResponseV02 payload) {
protected String toJson(AuthorisationresponseAuthorisationResponseV02 payload) {
return payload.toJson();
}
}
Loading

0 comments on commit 09aedfe

Please sign in to comment.