Perishable Goods

perishable-goods@0.13.0 Contract ^0.20.0 f85ce0ac0d404d0d9596201eac71e52e7561888c7fbc4abbdb38e4c4259baf10

This clause specifies penalties if the transport conditions (temperature and humidity) for a package are breached.

Download Archive Open in Template Studio

Perishable Goods

This clause specifies penalties if the transport conditions (temperature and humidity) for a package are breached.

Template Text

Grammar

On receipt of the shipment {{shipment}} the importer {{importer}} pays the grower {{grower}} {{unitPrice}} per {{unit}}. The shipment must contain between {{minUnits}} and {{maxUnits}} {{unit}} of {{product}}.

Shipping containers used must be temperature and humidity controlled, and sensor readings must be logged at least {{sensorReadingFrequency}} per {{duration}}.

Shipments that arrive after {{dueDate}} are to be considered spoiled and must be arranged to be returned to or disposed of by grower at cost to grower.

Temperature readings for the shipment must be between {{minTemperature}} and {{maxTemperature}}.

Humidity readings for the shipment must be between {{minHumidity}} and {{maxHumidity}}.

Shipments that have a temperature or humidity reading outside the agreed range have a price penalty applied calculated using the Formula for Breach Penalty Calculation below. The breach penalty factor to be used is {{penaltyFactor}}.

Formula for Breach Penalty Calculation:
penalty = number of shipment units x difference between sensor reading and agreed range x breach penalty factor

Sample

On receipt of the shipment "SHIP_001" the importer "DAN" pays the grower "PETER" 1.50 USD per KG. The shipment must contain between 3000 and 3500 KG of "Grade I, Size 4, Zutano Mexican Avocados".

Shipping containers used must be temperature and humidity controlled, and sensor readings must be logged at least 1 per hours.

Shipments that arrive after 07/02/2018 are to be considered spoiled and must be arranged to be returned to or disposed of by grower at cost to grower.

Temperature readings for the shipment must be between 2 and 13.

Humidity readings for the shipment must be between 70 and 90.

Shipments that have a temperature or humidity reading outside the agreed range have a price penalty applied calculated using the Formula for Breach Penalty Calculation below. The breach penalty factor to be used is 0.2.

Formula for Breach Penalty Calculation:
   penalty = number of shipment units x difference between sensor reading and agreed range x breach penalty factor

Sample Data

{
    "$class": "org.accordproject.perishablegoods.PerishableGoodsContract",
    "contractId": "4b413e27-3b2f-4b94-bc4a-07bfed661b55",
    "grower": {
        "$class": "org.accordproject.cicero.contract.AccordParty",
        "partyId": "PETER"
    },
    "importer": {
        "$class": "org.accordproject.cicero.contract.AccordParty",
        "partyId": "DAN"
    },
    "shipment": "SHIP_001",
    "dueDate": "2018-07-02T00:00:00.000-05:00",
    "unitPrice": {
        "$class": "org.accordproject.money.MonetaryAmount",
        "doubleValue": 1.5,
        "currencyCode": "USD"
    },
    "unit": "KG",
    "minUnits": 3000,
    "maxUnits": 3500,
    "product": "Grade I, Size 4, Zutano Mexican Avocados",
    "sensorReadingFrequency": 1,
    "duration": "hours",
    "minTemperature": 2,
    "maxTemperature": 13,
    "minHumidity": 70,
    "maxHumidity": 90,
    "penaltyFactor": 0.2
}

Template Model

Model Dependencies

Template Logic

Find the full logic for this template on on GitHub.

State Types

Type Sample JSON
org.accordproject.cicero.contract.AccordContractState
{
    "$class": "org.accordproject.cicero.contract.AccordContractState",
    "stateId": "01d17ec1-ff3f-11e9-b361-efc0ae54bdd6"
}

Request Types

Type Sample JSON
org.accordproject.perishablegoods.ShipmentReceived
{
    "$class": "org.accordproject.perishablegoods.ShipmentReceived",
    "unitCount": 51349,
    "shipment": "resource:org.accordproject.perishablegoods.Shipment#5579",
    "transactionId": "01d157b0-ff3f-11e9-b361-efc0ae54bdd6",
    "timestamp": "2019-11-04T15:09:29.003-05:00"
}

Response Types

Type Sample JSON
org.accordproject.perishablegoods.PriceCalculation
{
    "$class": "org.accordproject.perishablegoods.PriceCalculation",
    "totalPrice": {
        "$class": "org.accordproject.money.MonetaryAmount",
        "doubleValue": 255.451,
        "currencyCode": "SRD"
    },
    "penalty": {
        "$class": "org.accordproject.money.MonetaryAmount",
        "doubleValue": 4.27,
        "currencyCode": "BIF"
    },
    "late": true,
    "shipment": "resource:org.accordproject.perishablegoods.Shipment#2935",
    "transactionId": "01d17ec0-ff3f-11e9-b361-efc0ae54bdd6",
    "timestamp": "2019-11-04T15:09:29.004-05:00"
}

Events Types

Type Sample JSON
org.accordproject.cicero.runtime.PaymentObligation
{
    "$class": "org.accordproject.cicero.runtime.PaymentObligation",
    "amount": {
        "$class": "org.accordproject.money.MonetaryAmount",
        "doubleValue": 33.766,
        "currencyCode": "STN"
    },
    "description": "Non non magna.",
    "contract": "resource:org.accordproject.perishablegoods.PerishableGoodsContract#0850",
    "promisor": "resource:org.accordproject.cicero.contract.AccordParty#9269",
    "promisee": "resource:org.accordproject.cicero.contract.AccordParty#2279",
    "deadline": "2019-11-04T15:09:29.004-05:00",
    "eventId": "01d17ec2-ff3f-11e9-b361-efc0ae54bdd6",
    "timestamp": "2019-11-04T15:09:29.004-05:00"
}

Technical Integration

Please refer to the Cicero documentation for details and examples of how to integrate a call to a Cicero template into your application.

View the Latest code for this template on GitHub.