Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing field #62

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 28 additions & 2 deletions src/main/java/apiCalls/Utils/volBuilders/OverviewBuilder.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

package apiCalls.Utils.volBuilders;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand All @@ -12,25 +13,35 @@
"receivedDate",
"targetCompletionDate",
"overrideOppositionDate",
"tracking"
"tracking",
"applicationReferredToPi"
})
public class OverviewBuilder {

@JsonProperty("id")
private String id;

@JsonProperty("version")
private int version;

@JsonProperty("leadTcArea")
private String leadTcArea;

@JsonProperty("receivedDate")
private Object receivedDate;

@JsonProperty("targetCompletionDate")
private Object targetCompletionDate;

@JsonProperty("overrideOppositionDate")
private String overrideOppositionDate;

@JsonProperty("tracking")
private TrackingBuilder tracking;

@JsonProperty("applicationReferredToPi")
private String applicationReferredToPi;

@JsonProperty("id")
public String getId() {
return id;
Expand Down Expand Up @@ -136,10 +147,25 @@ public OverviewBuilder withTracking(TrackingBuilder tracking) {
return this;
}

@JsonProperty("applicationReferredToPi")
public String getApplicationReferredToPi() {
return applicationReferredToPi;
}

@JsonProperty("applicationReferredToPi")
public void setApplicationReferredToPi(String applicationReferredToPi) {
this.applicationReferredToPi = applicationReferredToPi;
}

public OverviewBuilder withApplicationReferredToPi(String applicationReferredToPi) {
this.applicationReferredToPi = applicationReferredToPi;
return this;
}

@Override
public String toString() {
return "id:" + getId() + ",version:" + getVersion() + ",leadTcArea:" + getLeadTcArea()
+ ",receivedDate:" + getReceivedDate() + ",targetCompletionDate:" + getTargetCompletionDate() + ",overrideOppositionDate:" + getOverrideOppositionDate()
+ "tracking:" + getTracking();
+ ",tracking:" + getTracking() + ",applicationReferredToPi:" + getApplicationReferredToPi();
}
}
44 changes: 37 additions & 7 deletions src/main/java/apiCalls/actions/GrantLicence.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,45 @@ public synchronized void createOverview() throws HttpException {
int applicationVersion = Integer.parseInt(fetchApplicationInformation(application.getApplicationId(), "version", "1"));
int applicationTrackingVersion = Integer.parseInt(fetchApplicationInformation(application.getApplicationId(), "applicationTracking.version", "1"));

TrackingBuilder tracking = new TrackingBuilder().withId(trackingId).withVersion(applicationTrackingVersion).withAddressesStatus(status).withBusinessDetailsStatus(status).withBusinessTypeStatus(status)
.withCommunityLicencesStatus(status).withConditionsUndertakingsStatus(status).withConvictionsPenaltiesStatus(status).withFinancialEvidenceStatus(status)
.withFinancialHistoryStatus(status).withLicenceHistoryStatus(status).withOperatingCentresStatus(status).withPeopleStatus(status).withSafetyStatus(status)
.withTransportManagersStatus(status).withTypeOfLicenceStatus(status).withDeclarationsInternalStatus(status).withVehiclesDeclarationsStatus(status).withVehiclesStatus(status).withVehiclesPsvStatus(status)
// Fetch the applicationReferredToPi value from the application information
String applicationReferredToPi = fetchApplicationInformation(application.getApplicationId(), "applicationReferredToPi", null);
if (applicationReferredToPi == null || (!applicationReferredToPi.equals("Y") && !applicationReferredToPi.equals("1"))) {
applicationReferredToPi = "N"; // Set to "N" if null or not "Y" or "1"
}

TrackingBuilder tracking = new TrackingBuilder()
.withId(trackingId)
.withVersion(applicationTrackingVersion)
.withAddressesStatus(status)
.withBusinessDetailsStatus(status)
.withBusinessTypeStatus(status)
.withCommunityLicencesStatus(status)
.withConditionsUndertakingsStatus(status)
.withConvictionsPenaltiesStatus(status)
.withFinancialEvidenceStatus(status)
.withFinancialHistoryStatus(status)
.withLicenceHistoryStatus(status)
.withOperatingCentresStatus(status)
.withPeopleStatus(status)
.withSafetyStatus(status)
.withTransportManagersStatus(status)
.withTypeOfLicenceStatus(status)
.withDeclarationsInternalStatus(status)
.withVehiclesDeclarationsStatus(status)
.withVehiclesStatus(status)
.withVehiclesPsvStatus(status)
.withTaxiPhvStatus(status);
OverviewBuilder overview = new OverviewBuilder().withId(application.getApplicationId()).withVersion(applicationVersion).withLeadTcArea(transportArea).withOverrideOppositionDate(overrideOption)
.withTracking(tracking);
apiResponse = RestUtils.put(overview, overviewResource, header());

OverviewBuilder overview = new OverviewBuilder()
.withId(application.getApplicationId())
.withVersion(applicationVersion)
.withLeadTcArea(transportArea)
.withTracking(tracking)
.withOverrideOppositionDate(overrideOption)
.withApplicationReferredToPi(applicationReferredToPi);


apiResponse = RestUtils.put(overview, overviewResource, header());
Utils.checkHTTPStatusCode(apiResponse, HttpStatus.SC_OK);
}

Expand Down