Skip to content

Commit

Permalink
Merge pull request #482 from bcgov/feature/trim-org-code
Browse files Browse the repository at this point in the history
Trim org ticket number
  • Loading branch information
TayGov authored Nov 22, 2022
2 parents f1c9a30 + 2a51df5 commit d005107
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ca.bc.gov.open.ecrc.model;

import org.apache.cxf.common.util.StringUtils;

/***
* Object for requesting new CRC Service
*/
Expand All @@ -22,7 +24,11 @@ public class RequestNewCRCService {
private String requestGuid;

public String getOrgTicketNumber() {
return orgTicketNumber;
if (!StringUtils.isEmpty(orgTicketNumber))
return orgTicketNumber.trim();

return null;

}

public void setOrgTicketNumber(String orgTicketNumber) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ca.bc.gov.open.ecrc.model.*;
import ca.bc.gov.open.ecrc.objects.*;
import com.google.gson.Gson;
import org.apache.cxf.common.util.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -46,7 +47,7 @@ public class EcrcServicesImpl implements EcrcServices {

public ResponseEntity<String> doAuthenticateUser(String orgTicketNumber, String requestGuid) throws EcrcServiceException {
logger.info("For request guid: [{}] Authenticating using org ticket number", requestGuid);
String doAuthenticateUserUri = String.format(ecrcProps.getDoAuthenticateUserUri(), orgTicketNumber);
String doAuthenticateUserUri = String.format(ecrcProps.getDoAuthenticateUserUri(), trimString(orgTicketNumber));
return ecrcWebMethodsService.callWebMethodsService(doAuthenticateUserUri, new DoAuthenticateUser(), requestGuid);
}

Expand All @@ -59,7 +60,7 @@ public ResponseEntity<String> getProvinceList(String requestGuid) throws EcrcSer
}

public ResponseEntity<String> getNextSessionId(String orgTicketNumber, String requestGuid) throws EcrcServiceException {
String nextSessionIdUri = String.format(ecrcProps.getGetNextSessionIdUri(), orgTicketNumber);
String nextSessionIdUri = String.format(ecrcProps.getGetNextSessionIdUri(), trimString(orgTicketNumber));
return ecrcWebMethodsService.callWebMethodsService(nextSessionIdUri, new GetNextSessionId(), requestGuid);
}

Expand All @@ -80,7 +81,7 @@ public ResponseEntity<String> updateServiceFinancialTxn(RequestUpdateServiceFina
}

public ResponseEntity<String> getServiceFeeAmount(String orgTicketNumber, String scheduleTypeCd, String scopeLevelCd, String requestGuid) throws EcrcServiceException {
String serviceFeeAmountUri = String.format(ecrcProps.getGetServiceFeeAmountUri(), orgTicketNumber, scheduleTypeCd, scopeLevelCd);
String serviceFeeAmountUri = String.format(ecrcProps.getGetServiceFeeAmountUri(), trimString(orgTicketNumber), scheduleTypeCd, scopeLevelCd);
return ecrcWebMethodsService.callWebMethodsService(serviceFeeAmountUri, new GetServiceFeeAmount(), requestGuid);
}

Expand All @@ -91,7 +92,7 @@ public ResponseEntity<String> logPaymentFailure(RequestLogPaymentFailure payment
}

public ResponseEntity<String> getNextInvoiceId(String orgTicketNumber, String requestGuid) throws EcrcServiceException {
String nextInvoiceIdUri = String.format(ecrcProps.getGetNextInvoiceIdUri(), orgTicketNumber);
String nextInvoiceIdUri = String.format(ecrcProps.getGetNextInvoiceIdUri(), trimString(orgTicketNumber));
return ecrcWebMethodsService.callWebMethodsService(nextInvoiceIdUri, new GetNextInvoiceId(), requestGuid);
}

Expand Down Expand Up @@ -266,4 +267,14 @@ private ResponseEntity<String> handlePayment(RequestNewCRCApplicant requestNewCR
return null;
}

private String trimString(String input) {

if (StringUtils.isEmpty(input)) {
return "";
}

return input.trim();

}

}

0 comments on commit d005107

Please sign in to comment.