Skip to content

Commit

Permalink
Remove my .NET habits
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwok-he-Chu committed Nov 16, 2023
1 parent c08c159 commit 49aab18
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ResponseEntity<CreatePaymentResponse> createPayment(@RequestBody CreatePa
table.setPaymentStatus(PaymentStatus.PaymentInProgress);

try {
var response = posPaymentService.sendPaymentRequestAsync(serviceId, poiId, saleId, request.getCurrency(), request.getAmount());
var response = posPaymentService.sendPaymentRequest(serviceId, poiId, saleId, request.getCurrency(), request.getAmount());

if (response == null || response.getSaleToPOIResponse() == null || response.getSaleToPOIResponse().getPaymentResponse() == null) {
table.setPaymentStatus(PaymentStatus.NotPaid);
Expand Down Expand Up @@ -145,7 +145,7 @@ public ResponseEntity<CreateReversalResponse> createReversal(@RequestBody Create
}

try {
var response = posReversalService.sendReversalRequestAsync(ReversalReasonType.MERCHANT_CANCEL, table.getPaymentStatusDetails().getSaleTransactionId(), table.getPaymentStatusDetails().getPoiTransactionId(), poiId, saleId);
var response = posReversalService.sendReversalRequest(ReversalReasonType.MERCHANT_CANCEL, table.getPaymentStatusDetails().getSaleTransactionId(), table.getPaymentStatusDetails().getPoiTransactionId(), poiId, saleId);

if (response == null || response.getSaleToPOIResponse() == null || response.getSaleToPOIResponse().getReversalResponse() == null) {
return ResponseEntity
Expand Down Expand Up @@ -196,7 +196,7 @@ public ResponseEntity abort(@PathVariable String tableName) throws IOException,
return ResponseEntity.notFound().build();
}

var abortResponse = posAbortService.sendAbortRequestAsync(table.getPaymentStatusDetails().getServiceId(), poiId, saleId);
var abortResponse = posAbortService.sendAbortRequest(table.getPaymentStatusDetails().getServiceId(), poiId, saleId);

return ResponseEntity.ok().body(abortResponse);
} catch (IOException | ApiException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class PosAbortService {
@Autowired
private TerminalCloudApiService terminalCloudAPIService;

public TerminalAPIResponse sendAbortRequestAsync(String serviceId, String poiId, String saleId) throws IOException, ApiException {
public TerminalAPIResponse sendAbortRequest(String serviceId, String poiId, String saleId) throws IOException, ApiException {
TerminalAPIRequest request = getAbortRequest(serviceId, poiId, saleId);
return terminalCloudAPIService.getTerminalCloudApi().sync(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public PosPaymentService() throws DatatypeConfigurationException {
dataTypeFactory = DatatypeFactory.newInstance();
}

public TerminalAPIResponse sendPaymentRequestAsync(String serviceId, String poiId, String saleId, String currency, BigDecimal amount) throws IOException, ApiException {
public TerminalAPIResponse sendPaymentRequest(String serviceId, String poiId, String saleId, String currency, BigDecimal amount) throws IOException, ApiException {
TerminalAPIRequest request = getPaymentRequest(serviceId, poiId, saleId, currency, amount);
return terminalCloudAPIService.getTerminalCloudApi().sync(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.GregorianCalendar;
import java.util.UUID;

@Service
public class PosReversalService {
Expand All @@ -26,7 +24,7 @@ public PosReversalService() throws DatatypeConfigurationException {
dataTypeFactory = DatatypeFactory.newInstance();
}

public TerminalAPIResponse sendReversalRequestAsync(ReversalReasonType reversalReasonType, String saleTransactionId, String poiTransactionId, String poiId, String saleId) throws IOException, ApiException {
public TerminalAPIResponse sendReversalRequest(ReversalReasonType reversalReasonType, String saleTransactionId, String poiTransactionId, String poiId, String saleId) throws IOException, ApiException {
TerminalAPIRequest request = getReversalRequest(reversalReasonType, saleTransactionId, poiTransactionId, poiId, saleId);
return terminalCloudAPIService.getTerminalCloudApi().sync(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.GregorianCalendar;
import java.util.UUID;

@Service
public class PosTransactionStatusService {
@Autowired
private TerminalCloudApiService terminalCloudAPIService;

public TerminalAPIResponse sendTransactionStatusRequestAsync(String serviceId, String poiId, String saleId) throws IOException, ApiException {
public TerminalAPIResponse sendTransactionStatusRequest(String serviceId, String poiId, String saleId) throws IOException, ApiException {
TerminalAPIRequest request = getTransactionStatusRequest(serviceId, poiId, saleId);
return terminalCloudAPIService.getTerminalCloudApi().sync(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

Expand Down Expand Up @@ -60,7 +59,7 @@ public String transactionstatus(@PathVariable String tableName, Model model) thr
return "transactionstatus";
}

var response = posTransactionStatusService.sendTransactionStatusRequestAsync(table.getPaymentStatusDetails().getServiceId(), applicationProperty.getPoiId(), applicationProperty.getSaleId());
var response = posTransactionStatusService.sendTransactionStatusRequest(table.getPaymentStatusDetails().getServiceId(), applicationProperty.getPoiId(), applicationProperty.getSaleId());

if (response == null ||
response.getSaleToPOIResponse() == null ||
Expand Down

0 comments on commit 49aab18

Please sign in to comment.