diff --git a/java-samples/corda5-negotiation-cordapp/README.md b/java-samples/corda5-negotiation-cordapp/README.md index 96ecef6..54860d4 100644 --- a/java-samples/corda5-negotiation-cordapp/README.md +++ b/java-samples/corda5-negotiation-cordapp/README.md @@ -87,13 +87,15 @@ check the result. Enter Bob's hash id and the modify flow ID which is "ModifyFlo #### Step 4: Accept the new proposal from bob `AcceptFlow` In this step, Alice will accept the new proposal from Bob. Goto `POST /flow/{holdingidentityshorthash}`, enter Alice's identity short hash and request body, we also need to -provide the proposalId, which is same as the proposal ID used in ModifyFlow body. +provide the proposalId, which is same as the proposal ID used in ModifyFlow body and also Alice's own details +(this is because the Accept smart contract requires this information) ``` { "clientRequestId": "AcceptFlow", "flowClassName": "com.r3.developers.samples.negotiation.workflows.accept.AcceptFlowRequest", "requestBody": { - "proposalID": "" + "proposalID": "", + "acceptor": "CN=Alice, OU=Test Dept, O=R3, L=London, C=GB" } } ``` diff --git a/java-samples/corda5-negotiation-cordapp/contracts/src/main/java/com/r3/developers/samples/negotiation/Trade.java b/java-samples/corda5-negotiation-cordapp/contracts/src/main/java/com/r3/developers/samples/negotiation/Trade.java index bf5efb3..50dea88 100644 --- a/java-samples/corda5-negotiation-cordapp/contracts/src/main/java/com/r3/developers/samples/negotiation/Trade.java +++ b/java-samples/corda5-negotiation-cordapp/contracts/src/main/java/com/r3/developers/samples/negotiation/Trade.java @@ -18,31 +18,19 @@ public class Trade implements ContractState { private final int amount; private final Member buyer; private final Member seller; - private final UUID proposalID; + private final UUID tradeID; private final MemberX500Name acceptor; public List participants; - - @ConstructorForDeserialization - public Trade(int amount, Member buyer, Member seller, UUID proposalID, MemberX500Name acceptor, List participants) { - this.amount = amount; - this.buyer = buyer; - this.seller = seller; - this.proposalID = proposalID; - this.acceptor = acceptor; - this.participants = participants; - } - public Trade(int amount, Member buyer, Member seller, MemberX500Name acceptor, List participants) { this.amount = amount; this.buyer = buyer; this.seller = seller; this.acceptor = acceptor; - this.proposalID = UUID.randomUUID(); + this.tradeID = UUID.randomUUID(); this.participants = participants; } - public int getAmount() { return amount; } @@ -55,8 +43,8 @@ public Member getBuyer() { return buyer; } - public UUID getProposalID() { - return proposalID; + public UUID getTradeID() { + return tradeID; } public MemberX500Name getAcceptor() { return acceptor; diff --git a/java-samples/corda5-negotiation-cordapp/workflows/src/main/java/com/r3/developers/samples/negotiation/workflows/accept/AcceptFlowRequest.java b/java-samples/corda5-negotiation-cordapp/workflows/src/main/java/com/r3/developers/samples/negotiation/workflows/accept/AcceptFlowRequest.java index 1a9d766..530a1d5 100644 --- a/java-samples/corda5-negotiation-cordapp/workflows/src/main/java/com/r3/developers/samples/negotiation/workflows/accept/AcceptFlowRequest.java +++ b/java-samples/corda5-negotiation-cordapp/workflows/src/main/java/com/r3/developers/samples/negotiation/workflows/accept/AcceptFlowRequest.java @@ -88,7 +88,7 @@ public String call(@NotNull ClientRequestBody requestBody) { UtxoSignedTransaction signedTransaction = transactionBuilder.toSignedTransaction(); FlowSession counterPartySession = flowMessaging.initiateFlow(counterParty.getName()); flowEngine.subFlow(new FinalizeFlow.FinalizeRequest(signedTransaction, List.of(counterPartySession))); - return output.getProposalID().toString(); + return output.getTradeID().toString(); } catch (Exception e) { throw new CordaRuntimeException(e.getMessage()); }