accordproject / template-archive

Smart Legal Contracts & Templating System
https://accordproject.org/projects/cicero/
Apache License 2.0
280 stars 119 forks source link

Failed Curl Request in Cicero-server package #742

Closed K-Kumar-01 closed 2 years ago

K-Kumar-01 commented 2 years ago

Bug Report 🐛

Currently, the request for draft and trigger mentioned in the documentation for cicero-server is failing.

Screenshots

Screenshot from 2022-05-24 06-12-49 Screenshot from 2022-05-24 06-17-45

Expected Behavior

The requests should pass without any error and result in a successful execution with status code 200.

Current Behavior

The error displayed in the above image is shown. Cross-checking with cicero-cli on same data gave the same error. The data passed in the documentation seems to be incorrect.

Possible Solution

Update the documentation to use proper data. Sample data for proper draft request.

{
  "$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
  "buyer": "resource:org.accordproject.party.Party#Steve",
  "seller": "resource:org.accordproject.party.Party#Dan",
  "forceMajeure": true,
  "penaltyDuration": {
    "$class": "org.accordproject.time.Duration",
    "amount": 2,
    "unit": "days"
  },
  "penaltyPercentage": 10.5,
  "capPercentage": 55,
  "termination": {
    "$class": "org.accordproject.time.Duration",
    "amount": 15,
    "unit": "days"
  },
  "fractionalPart": "days",
  "contractId": "c538755a-6c9e-43ff-8767-f8915d0336a0",
  "$identifier": "c538755a-6c9e-43ff-8767-f8915d0336a0"
}

Steps to Reproduce

  1. Use Postman/Insomnia or a direct curl request for draft
  2. Repeat the procedure for trigger

Context (Environment)

Desktop

Detailed Description

Data Passed:

{
    "$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
    "contractId": "ecd6257e-2ffe-4ef1-8a5c-38ca9084a829",
    "buyer": {
        "$class": "org.accordproject.cicero.contract.AccordParty",
        "partyId": "Dan"
    },
    "seller": {
        "$class": "org.accordproject.cicero.contract.AccordParty",
        "partyId": "Steve"
    },
    "forceMajeure": true,
    "penaltyDuration": {
        "$class": "org.accordproject.time.Duration",
        "amount": 9,
        "unit": "days"
    },
    "penaltyPercentage": 1000.5,
    "capPercentage": 88,
    "termination": {
        "$class": "org.accordproject.time.Duration",
        "amount": 5,
        "unit": "weeks"
    },
    "fractionalPart": "days"
}

Proposed Data:

{
  "$class": "org.accordproject.latedeliveryandpenalty.LateDeliveryAndPenaltyContract",
  "buyer": "resource:org.accordproject.party.Party#Steve",
  "seller": "resource:org.accordproject.party.Party#Dan",
  "forceMajeure": true,
  "penaltyDuration": {
    "$class": "org.accordproject.time.Duration",
    "amount": 2,
    "unit": "days"
  },
  "penaltyPercentage": 10.5,
  "capPercentage": 55,
  "termination": {
    "$class": "org.accordproject.time.Duration",
    "amount": 15,
    "unit": "days"
  },
  "fractionalPart": "days",
  "contractId": "c538755a-6c9e-43ff-8767-f8915d0336a0",
  "$identifier": "c538755a-6c9e-43ff-8767-f8915d0336a0"
}

Here, on seeing we find that buyer and seller both are passed as objects in the former request and strings in the latter one. This is what is creating this issue.

Possible Implementation

Updating the documenation should work.

Would you like to work on the issue?

Yes

dselman commented 2 years ago

Thanks for the bug report - looks great. Would you like to submit a PR to fix the docs?

K-Kumar-01 commented 2 years ago

Thanks for the bug report - looks great. Would you like to submit a PR to fix the docs?

Yes I would love to work. I will submit a PR by tomorrow for the same.