Skip to content

Commit

Permalink
Merge branch 'test' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	ebl-issuance/src/main/java/org/dcsa/conformance/standards/eblissuance/party/EblIssuancePlatform.java
#	ebl-surrender/src/main/java/org/dcsa/conformance/standards/eblsurrender/party/EblSurrenderCarrier.java
  • Loading branch information
gj0dcsa committed Nov 23, 2023
2 parents 2059312 + 1692313 commit 4a2cce4
Show file tree
Hide file tree
Showing 23 changed files with 430 additions and 346 deletions.
32 changes: 23 additions & 9 deletions cdk/src/main/java/org/dcsa/conformance/cdk/ConformanceApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static void main(final String[] args) {
new ConformanceStack(
app,
StackProps.builder().env(Environment.builder().region("eu-north-1").build()).build(),
"devConformanceStack",
"dev",
"Z0720499I10UDAXMT620",
"conformance-development-1.dcsa.org",
Expand All @@ -20,15 +21,28 @@ public static void main(final String[] args) {
"arn:aws:acm:us-east-1:468100668426:certificate/b3d816d1-8224-4256-85f5-057e2a3da9e7");

new ConformanceStack(
app,
StackProps.builder().env(Environment.builder().region("eu-north-1").build()).build(),
"test",
"Z0720499I10UDAXMT620",
"conformance-development-1.dcsa.org",
"arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:35",
"arn:aws:acm:eu-north-1:468100668426:certificate/64b2b920-f435-4ebc-9874-eb97e6bd9bf9",
"arn:aws:acm:eu-north-1:468100668426:certificate/607709d1-0910-43d1-adb8-9b2fc81cfa60",
"arn:aws:acm:us-east-1:468100668426:certificate/3ae61e03-9e88-4d6c-a3ac-9ac2943d80e1");
app,
StackProps.builder().env(Environment.builder().region("eu-north-1").build()).build(),
"devtestConformanceStack",
"test", // in the dev account
"Z0720499I10UDAXMT620",
"conformance-development-1.dcsa.org",
"arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:35",
"arn:aws:acm:eu-north-1:468100668426:certificate/64b2b920-f435-4ebc-9874-eb97e6bd9bf9",
"arn:aws:acm:eu-north-1:468100668426:certificate/607709d1-0910-43d1-adb8-9b2fc81cfa60",
"arn:aws:acm:us-east-1:468100668426:certificate/3ae61e03-9e88-4d6c-a3ac-9ac2943d80e1");

new ConformanceStack(
app,
StackProps.builder().env(Environment.builder().region("eu-north-1").build()).build(),
"testConformanceStack",
"test",
"Z00173773E1E6BI3P1ZF0",
"conformance-test-1.dcsa.org",
"arn:aws:lambda:eu-north-1:580247275435:layer:LambdaInsightsExtension:35",
"arn:aws:acm:eu-north-1:346080125434:certificate/ac55dc0e-e348-4493-b6fc-19e52e6d2438",
"arn:aws:acm:eu-north-1:346080125434:certificate/bd53d408-5da2-494c-9eae-b33787823915",
"arn:aws:acm:us-east-1:346080125434:certificate/f68b8c56-20b8-40d1-9a1f-ce8c2ac14a2a");

app.synth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ public class ConformanceStack extends Stack {
public ConformanceStack(
Construct parent,
StackProps stackProps,
String stackName,
String prefix,
String hostedZoneId,
String hostedZoneName,
String lambdaInsightsArn,
String restApiCertificateArn,
String webuiApiCertificateArn,
String webuiDistCertificateArn) {
super(parent, prefix + "ConformanceStack", stackProps);
super(parent, stackName, stackProps);

UserPool userPool =
UserPool.Builder.create(this, prefix + "UserPool")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public ConformanceCheck createCheck(String expectedApiVersion) {
protected Stream<? extends ConformanceCheck> createSubChecks() {
return Stream.of(
new UrlPathCheck(
EblIssuanceRole::isCarrier, getMatchedExchangeUuid(), "/issue-ebls"),
EblIssuanceRole::isCarrier, getMatchedExchangeUuid(), "/ebl-issuance-requests"),
new ResponseStatusCheck(
EblIssuanceRole::isPlatform, getMatchedExchangeUuid(), expectedStatus),
new ApiHeaderCheck(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ConformanceCheck createCheck(String expectedApiVersion) {
protected Stream<? extends ConformanceCheck> createSubChecks() {
return Stream.of(
new UrlPathCheck(
EblIssuanceRole::isPlatform, getMatchedExchangeUuid(), "/v1/issuance-responses"),
EblIssuanceRole::isPlatform, getMatchedExchangeUuid(), "/ebl-issuance-responses"),
new ResponseStatusCheck(
EblIssuanceRole::isCarrier, getMatchedExchangeUuid(), expectedStatus),
new ApiHeaderCheck(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum IssuanceResponseCode {
ACCEPTED("ISSU"),
BLOCKED("BDOC"),
BLOCKED("BREQ"),
REFUSED("REFU");
public final String standardCode;
IssuanceResponseCode(String standardCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ private void sendIssuanceRequest(JsonNode actionPrompt) {
((ObjectNode) jsonRequestBody.get("document")).remove("issuingParty");
}

asyncCounterpartPost("/v1/issue-ebls", jsonRequestBody);
asyncCounterpartPost(
"/%s/ebl-issuance-requests".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
jsonRequestBody);

addOperatorLogEntry(
"Sent a %s issuance request for eBL with transportDocumentReference '%s' (now in state '%s')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.util.*;
import java.util.function.Consumer;
import java.util.stream.StreamSupport;
import lombok.extern.slf4j.Slf4j;
import org.dcsa.conformance.core.party.ConformanceParty;
import org.dcsa.conformance.core.party.CounterpartConfiguration;
Expand Down Expand Up @@ -41,12 +43,27 @@ public EblIssuancePlatform(

@Override
protected void exportPartyJsonState(ObjectNode targetObjectNode) {
targetObjectNode.set("eblStatesByTdr", StateManagementUtil.storeMap(objectMapper, eblStatesByTdr, EblIssuanceState::name));
ObjectMapper objectMapper = new ObjectMapper();

ArrayNode arrayNodeEblStatesById = objectMapper.createArrayNode();
eblStatesByTdr.forEach(
(key, value) -> {
ObjectNode entryNode = objectMapper.createObjectNode();
entryNode.put("key", key);
entryNode.put("value", value.name());
arrayNodeEblStatesById.add(entryNode);
});
targetObjectNode.set("eblStatesByTdr", arrayNodeEblStatesById);
}

@Override
protected void importPartyJsonState(ObjectNode sourceObjectNode) {
StateManagementUtil.restoreIntoMap(eblStatesByTdr, sourceObjectNode.get("eblStatesByTdr"), EblIssuanceState::valueOf);
StreamSupport.stream(sourceObjectNode.get("eblStatesByTdr").spliterator(), false)
.forEach(
entryNode ->
eblStatesByTdr.put(
entryNode.get("key").asText(),
EblIssuanceState.valueOf(entryNode.get("value").asText())));
}

@Override
Expand Down Expand Up @@ -74,7 +91,7 @@ private void sendIssuanceResponse(JsonNode actionPrompt) {
}

asyncCounterpartPost(
"/v1/issuance-responses",
"/%s/ebl-issuance-responses".formatted(apiVersion.startsWith("3") ? "v3" : "v2"),
objectMapper
.createObjectNode()
.put("transportDocumentReference", tdr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"transportDocumentReference": "TRANSPORT_DOCUMENT_REFERENCE_PLACEHOLDER",
"transportDocumentTypeCode": "BOL",
"documentStatus": "ISSUED",
"shippingInstructionReference": "SHIPPING_INSTRUCTION_REFERENCE_PLACEHOLDER",
"shippingInstructionsReference": "SHIPPING_INSTRUCTION_REFERENCE_PLACEHOLDER",
"carrierCode": "ASDF",
"carrierCodeListProvider": "SMDG",
"issuingParty": {
"eblPlatformIdentifier": "[email protected]",
"legalName": "legal name",
"partyName": "issuing party",
"partyContactDetails": [
{
Expand Down Expand Up @@ -66,6 +68,8 @@
"documentParties": [
{
"party": {
"eblPlatformIdentifier": "[email protected]",
"legalName": "legal name",
"partyName": "party name",
"partyContactDetails": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
],
"paths": {
"/v1/issue-ebls": {
"/v2/ebl-issuance-requests": {
"put": {
"tags": [
"Issuance EBL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
},
"servers": [
{
"url": "https://virtserver.swaggerhub.com/dcsaorg/DCSA_EBL_ISS_RSP/3.0-beta1",
"url": "https://virtserver.swaggerhub.com/dcsaorg/DCSA_EBL_ISS_RSP/2.0-beta1",
"description": "SwaggerHub API Auto Mocking"
}
],
"paths": {
"/v1/issuance-responses": {
"/v2/ebl-issuance-responses": {
"post": {
"tags": [
"Issue Response"
Expand Down Expand Up @@ -92,10 +92,10 @@
},
"issuanceResponseCode": {
"type": "string",
"description": "The platforms verdict on the issuance of the EBL identified by the `transportDocumentReference`\n\nOptions are:\n * `ISSU`: The document was successfully `ISSU` and successfully delivered to the initial possessor.\n * `BREQ`: The platform reviewed the document and believe they cannot issue the document due to an error/issue with the content of the issuance request.\n * `REFU`: The intended recipient (or their delegated EBL platform) refused to accept the delivery of the EBL for a reason that the issuing eBL platform cannot resolve. One reason could be that the `issueTo` referenced a valid eBL platform but the receiving platform did not recognise the recipient specified.\n\nRegardless of the response code, the issuance request is now considered handled. In case of successful issuance, the platform will still have some responsiblity but that is covered by other processes and APIs (e.g., the DCSA_SUR API mentioned in the description of this API). In case of failed issuance, it is up to the carrier to resolve the issue and, if needed, submit a revised issuance request.\n",
"description": "The platforms verdict on the issuance of the EBL identified by the `transportDocumentReference`\n\nOptions are:\n * `ISSU`: The document was successfully `ISSU` and successfully delivered to the initial possessor.\n * `BREQ`: The platform reviewed the document and believe they cannot issue the document due to an error/issue with the content of the issuance request.\n * `REFU`: The eBL issuance is rejected for a reason that the issuing eBL platform cannot resolve (for example when an Interoperable transfer fails, due to a reject of the receiving eBL platform via the `BENV` code from the interoperability standard). One reason could be that the `issueTo` referenced a valid eBL platform but the receiving platform did not recognise the recipient specified.\n\nRegardless of the response code, the issuance request is now considered handled. In case of successful issuance, the platform will still have some responsiblity but that is covered by other processes and APIs (e.g., the DCSA_SUR API mentioned in the description of this API). In case of failed issuance, it is up to the carrier to resolve the issue and, if needed, submit a revised issuance request.\n",
"enum": [
"ISSU",
"BDOC",
"BREQ",
"REFU"
]
},
Expand Down
Loading

0 comments on commit 4a2cce4

Please sign in to comment.