-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dt-718 changes for reefer #30
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ public class Shipper extends ConformanceParty { | |
|
||
private static final String SERVICE_CONTRACT_REF = "serviceContractReference"; | ||
private static final String SERVICE_REF_PUT = "serviceRefPut"; | ||
private static final String FILE_SUFFIX_REEFER = "-reefer"; | ||
public Shipper( | ||
String apiVersion, | ||
PartyConfiguration partyConfiguration, | ||
|
@@ -85,7 +86,6 @@ private void sendBookingRequest(JsonNode actionPrompt) { | |
CarrierScenarioParameters carrierScenarioParameters = | ||
CarrierScenarioParameters.fromJson(actionPrompt.get("csp")); | ||
|
||
|
||
JsonNode jsonRequestBody = replaceBookingPlaceHolders(actionPrompt); | ||
|
||
asyncCounterpartPost( | ||
|
@@ -111,10 +111,11 @@ private JsonNode replaceBookingPlaceHolders(JsonNode actionPrompt) { | |
|
||
CarrierScenarioParameters carrierScenarioParameters = | ||
CarrierScenarioParameters.fromJson(actionPrompt.get("csp")); | ||
String bookingVariant = actionPrompt.get("bookingVariant").asText(); | ||
|
||
JsonNode jsonRequestBody = | ||
JsonToolkit.templateFileToJsonNode( | ||
"/standards/booking/messages/booking-api-v20-request.json", | ||
String fileSuffix = bookingVariant.equals("reefer") ? FILE_SUFFIX_REEFER: ""; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would probably put this logic into the enum as each case has its own payload in the booking case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For simplicity, you could rename the |
||
return JsonToolkit.templateFileToJsonNode( | ||
"/standards/booking/messages/booking-api-v20%s-request.json".formatted(fileSuffix), | ||
Map.ofEntries( | ||
Map.entry( | ||
"CONTRACT_QUOTATION_REFERENCE_PLACEHOLDER", | ||
|
@@ -131,8 +132,6 @@ private JsonNode replaceBookingPlaceHolders(JsonNode actionPrompt) { | |
"POL_UNLOCATION_CODE_PLACEHOLDER", carrierScenarioParameters.polUNLocationCode()), | ||
Map.entry( | ||
"POD_UNLOCATION_CODE_PLACEHOLDER", carrierScenarioParameters.podUNLocationCode()) )); | ||
|
||
return jsonRequestBody; | ||
} | ||
|
||
private void sendCancelEntireBooking(JsonNode actionPrompt) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"receiptTypeAtOrigin": "CY", | ||
"deliveryTypeAtDestination": "CY", | ||
"cargoMovementTypeAtOrigin": "FCL", | ||
"cargoMovementTypeAtDestination": "FCL", | ||
"contractQuotationReference": "CONTRACT_QUOTATION_REFERENCE_PLACEHOLDER", | ||
"carrierExportVoyageNumber": "CARRIER_EXPORT_VOYAGE_NUMBER_PLACEHOLDER", | ||
"carrierServiceName": "CARRIER_SERVICE_NAME_PLACEHOLDER", | ||
"isPartialLoadAllowed": false, | ||
"isExportDeclarationRequired": false, | ||
"isImportLicenseRequired": false, | ||
"communicationChannelCode": "AO", | ||
"isEquipmentSubstitutionAllowed": true, | ||
"requestedEquipments": [ | ||
{ | ||
"ISOEquipmentCode": "22RT", | ||
"units": 1, | ||
"isShipperOwned": false, | ||
"commodities": [ | ||
{ | ||
"HSCodes": ["COMMODITY_HS_CODE"], | ||
"commodityType": "COMMODITY_TYPE_PLACEHOLDER", | ||
"cargoGrossWeight": 323.32, | ||
"cargoGrossWeightUnit": "KGM" | ||
} | ||
], | ||
"isNonOperatingReefer": false, | ||
"activeReeferSettings": { | ||
"temperatureSetpoint": -18, | ||
"temperatureUnit": "CEL" | ||
} | ||
} | ||
], | ||
"documentParties": [ | ||
{ | ||
"party": { | ||
"partyName": "DCSA Conformance Toolkit", | ||
"address": { | ||
"name": "Mustermann", | ||
"street": "Strawinskylaan", | ||
"streetNumber": "4117", | ||
"floor": "6", | ||
"postCode": "1077 ZX", | ||
"city": "Amsterdam", | ||
"country": "Netherlands" | ||
}, | ||
"partyContactDetails": [ | ||
{ | ||
"name": "Henrik", | ||
"phone": "+31611444666" | ||
} | ||
] | ||
}, | ||
"partyFunction": "BA", | ||
"isToBeNotified": false | ||
} | ||
], | ||
"shipmentLocations": [ | ||
{ | ||
"location": { | ||
"locationType": "UNLO", | ||
"UNLocationCode": "POL_UNLOCATION_CODE_PLACEHOLDER" | ||
}, | ||
"locationTypeCode": "POL" | ||
}, | ||
{ | ||
"location": { | ||
"locationType": "UNLO", | ||
"UNLocationCode": "POD_UNLOCATION_CODE_PLACEHOLDER" | ||
}, | ||
"locationTypeCode": "POD" | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer a single value instead of a mix of two booleans (isReeferBooking and isDGBooking), then judging by the way you use this value perhaps an enum BookingVariang { REGULAR, REEFER, DG } would help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather use the Enums than the Booleans