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

Add Beta 2 plumbing for ebl issuance and surrender #80

Merged
merged 2 commits into from
Mar 26, 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
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public Set<String> getReportRoleNames(

public JsonSchemaValidator getMessageSchemaValidator(String apiProviderRole, boolean forRequest) {
String schemaFilePath =
"/standards/eblissuance/schemas/eblissuance-%s-%s.json"
"/standards/eblissuance/schemas/eblissuance-v%s-%s.json"
.formatted(
standardVersion.startsWith("2") ? "v20" : "v30", apiProviderRole.toLowerCase());
standardVersion, apiProviderRole.toLowerCase());
String schemaName =
EblIssuanceRole.isCarrier(apiProviderRole)
? (forRequest ? "issuanceRequest" : null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ private void sendIssuanceRequest(JsonNode actionPrompt) {

var jsonRequestBody =
JsonToolkit.templateFileToJsonNode(
"/standards/eblissuance/messages/eblissuance-%s-request.json"
.formatted(apiVersion.startsWith("3") ? "v30" : "v20"),
"/standards/eblissuance/messages/eblissuance-v%s-request.json"
.formatted(apiVersion),
Map.ofEntries(
Map.entry("TRANSPORT_DOCUMENT_REFERENCE_PLACEHOLDER", tdr),
Map.entry("SHIPPING_INSTRUCTION_REFERENCE_PLACEHOLDER", sir),
Expand Down Expand Up @@ -136,7 +136,7 @@ private void sendIssuanceRequest(JsonNode actionPrompt) {
}

syncCounterpartPost(
"/%s/ebl-issuance-requests".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
"/v%s/ebl-issuance-requests".formatted(apiVersion.charAt(0)),
jsonRequestBody);

addOperatorLogEntry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void sendIssuanceResponse(JsonNode actionPrompt) {
}

syncCounterpartPost(
"/%s/ebl-issuance-responses".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
"/v%s/ebl-issuance-responses".formatted(apiVersion.charAt(0)),
objectMapper
.createObjectNode()
.put("transportDocumentReference", tdr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

public class EblSurrenderComponentFactory extends AbstractComponentFactory {
public static final String STANDARD_NAME = "eBL Surrender";
public static final List<String> STANDARD_VERSIONS = List.of("2.0.0-Beta-1", "3.0.0-Beta-1");
public static final List<String> STANDARD_VERSIONS = List.of(
"2.0.0-Beta-1",
"3.0.0-Beta-1",
"3.0.0-Beta-2"
);

private static final String CARRIER_AUTH_HEADER_VALUE = UUID.randomUUID().toString();
private static final String PLATFORM_AUTH_HEADER_VALUE = UUID.randomUUID().toString();
Expand Down Expand Up @@ -114,9 +118,9 @@ public Set<String> getReportRoleNames(

public JsonSchemaValidator getMessageSchemaValidator(String apiProviderRole, boolean forRequest) {
String schemaFilePath =
"/standards/eblsurrender/schemas/eblsurrender-%s-%s.json"
"/standards/eblsurrender/schemas/eblsurrender-v%s-%s.json"
.formatted(
standardVersion.startsWith("2") ? "v20" : "v30", apiProviderRole.toLowerCase());
standardVersion, apiProviderRole.toLowerCase());
String schemaName =
EblSurrenderRole.isCarrier(apiProviderRole)
? (forRequest ? "surrenderRequestDetails" : "surrenderRequestAcknowledgement")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void sendSurrenderResponse(JsonNode actionPrompt) {
srr = UUID.randomUUID().toString();
}
syncCounterpartPost(
"/%s/ebl-surrender-responses".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
"/v%s/ebl-surrender-responses".formatted(apiVersion.charAt(0)),
objectMapper
.createObjectNode()
.put("surrenderRequestReference", srr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ private void requestSurrender(JsonNode actionPrompt) {

JsonNode jsonRequestBody =
JsonToolkit.templateFileToJsonNode(
"/standards/eblsurrender/messages/eblsurrender-api-%s-request.json"
.formatted(apiVersion.startsWith("3") ? "v30" : "v20"),
"/standards/eblsurrender/messages/eblsurrender-api-v%s-request.json"
.formatted(apiVersion),
Map.ofEntries(
Map.entry("SURRENDER_REQUEST_REFERENCE_PLACEHOLDER", srr),
Map.entry("TRANSPORT_DOCUMENT_REFERENCE_PLACEHOLDER", tdr),
Expand All @@ -97,7 +97,7 @@ private void requestSurrender(JsonNode actionPrompt) {
Map.entry("ACTION_DATE_TIME_PLACEHOLDER", Instant.now().toString())));

syncCounterpartPost(
"/%s/ebl-surrender-requests".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
"/v%s/ebl-surrender-requests".formatted(apiVersion.charAt(0)),
jsonRequestBody);

addOperatorLogEntry(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"surrenderRequestReference": "SURRENDER_REQUEST_REFERENCE_PLACEHOLDER",
"transportDocumentReference": "TRANSPORT_DOCUMENT_REFERENCE_PLACEHOLDER",
"surrenderRequestCode": "SURRENDER_REQUEST_CODE_PLACEHOLDER",
"surrenderRequestedBy": {
"eblPlatform": "EBL_PLATFORM_PLACEHOLDER",
"legalName": "legal name",
"partyCodes": [
{
"partyCode": "PARTY_CODE_PLACEHOLDER",
"codeListProvider": "EPUI",
"codeListName": "CODE_LIST_NAME_PLACEHOLDER"
}
]
}
}
Loading
Loading