Skip to content

Request for storing ticket

Markus Sabadello edited this page Nov 16, 2016 · 2 revisions

The webshop stores the ticket in Maria's personal cloud using the following XDI message in JXD format:

[
  {
    "@xdi": [
      "$jxd$xdi",
      "$jxd$xdi$msg",
      "$jxd$xdi$contract",
      {
        "departure": { "@id": "#departure", "@type": "@id" },
        "destination": { "@id": "#destination", "@type": "@id" },
        "city": "<#city>",
        "t": "<$t>",
        "carrier": { "@id": "#carrier", "@type": "@id" },
        "passenger": { "@id": "#passenger", "@type": "@id" },
        "ispush": { "@id": "$is$push", "@type": "@id" }
      }
    ],
    "@id": "+!:did:sov:1yvXbmgPoUm4dl66D7KhyD[$msg]@~0",
    "do": {
      "set-graph": {
        "@type": "@graph",
        "*!:uuid:972ae814-0120-4361-81dc-473f9e8f7536": {
          "departure": {
            "city": "Vienna"
          },
          "destination": {
            "city": "Paris"
          },
          "t": "Tue Oct 18 11:26:27 CEST 2016",
          "passenger": [
            "=!:did:sov:21tDAKCERh95uGgKbJNHYp"
          ],
          "carrier": [
            "+!:did:sov:QQiFNVtQCCEFqHagFOd04Q",
            "+!:did:sov:VpumqBbcVi86RvpEo8lvOn",
            "+!:did:sov:XuRwkbUmj1x6y3Pf3YX26K"
          ],
          "ispush": [
            "(+!:did:sov:4azGhZKdwv6rrUwF98lk3b/+!:did:sov:4azGhZKdwv6rrUwF98lk3b)$push$contract"
          ]
        }
      }
    },
    "contract": [
      "({$to}/$set)$contract"
    ],
    "to": [
      "{($to)}"
    ]
  }
]

Some explanations:

  • +!:did:sov:1yvXbmgPoUm4dl66D7KhyD is the Webshop, i.e. the sender of the request.
  • *!:uuid:972ae814-0120-4361-81dc-473f9e8f7536 is an identifier for the train ticket.
  • The ispush entry is a reference to the Ticket link contract that will push ticket updates to all subscribing parties.
  • The contract is a reference to the link contract for sending this request to store the ticket. It is a standard link contract that requires Maria to manually approve the request.
  • The to is the target of the request to store the ticket. This uses a variable, since Maria's identifier is not known at the time this request is created.