Skip to content

Transaction with signers

Typ danych

Przykładowy typ danych:

data_type:
  header:
    type: object
    fields:
      TransactionId:
        type: string
      TransactionOwner:
        type: string
      Date:
        type: string
      Price:
        type: decimal
        required: false
      TypeOfVehicle:
        type: string
        required: false
      YearOfProduction:
        type: string
        required: false
      Mileage:
        type: string
        required: false
      Address:
        type: string
        required: false
      CarId:
          type: string
      IdName:
          type: string
      Queue:
        type: queue
        required: false
  invoice:
    type: array
    items:
      type: object
      fields:
        InvoiceValue:
          type: decimal
          required: false
        TaxValue:
          type: integer
          required: false
Payload na podstawie powyższego typu danych (zastosowano enkodowanie do base64):
curl --location 'https://api.pergam.in/api/v2/organisations/27611/data-types' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data '{
  "name": "LEASING",
  "yaml": "ZGF0YV90eXBlOgogIGhlYWRlcjoKICAgIHR5cGU6IG9iamVjdAogICAgZmllbGRzOgogICAgICBUcmFuc2FjdGlvbklkOgogICAgICAgIHR5cGU6IHN0cmluZwogICAgICBUcmFuc2FjdGlvbk93bmVyOgogICAgICAgIHR5cGU6IHN0cmluZwogICAgICBEYXRlOgogICAgICAgIHR5cGU6IHN0cmluZwogICAgICBQcmljZToKICAgICAgICB0eXBlOiBkZWNpbWFsCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgIFR5cGVPZlZlaGljbGU6CiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgIFllYXJPZlByb2R1Y3Rpb246CiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgIE1pbGVhZ2U6CiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgIEFkZHJlc3M6CiAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgIENhcklkOgogICAgICAgICAgdHlwZTogc3RyaW5nCiAgICAgIElkTmFtZToKICAgICAgICAgIHR5cGU6IHN0cmluZwogICAgICBRdWV1ZToKICAgICAgICB0eXBlOiBxdWV1ZQogICAgICAgIHJlcXVpcmVkOiBmYWxzZQogIGludm9pY2U6CiAgICB0eXBlOiBhcnJheQogICAgaXRlbXM6CiAgICAgIHR5cGU6IG9iamVjdAogICAgICBmaWVsZHM6CiAgICAgICAgSW52b2ljZVZhbHVlOgogICAgICAgICAgdHlwZTogZGVjaW1hbAogICAgICAgICAgcmVxdWlyZWQ6IGZhbHNlCiAgICAgICAgVGF4VmFsdWU6CiAgICAgICAgICB0eXBlOiBpbnRlZ2VyCiAgICAgICAgICByZXF1aXJlZDogZmFsc2U="
}'

Strumień danych

Przykładowy strumień danych:

{
    "name": "LEASING_CARS",
    "data_type": "LEASING",
    "technical_user_id": 67,
    "templates": [
            {
                "template_id": 6003,
                "document_name": "Agreement %headerTransactionId% [PDF]",
                "document_reference": "%headerTransactionId%",
                "document_external_id": "AG_%headerTransactionId%",
                "document_content": null,
                "is_blocked": false
            },
            {
                "template_id": 6004,
                "document_name": "Invoice %headerTransactionId% [PDF]",
                "document_reference": "%headerTransactionId%",
                "document_external_id": "IN_%headerTransactionId%",
                "document_content": null,
                "is_blocked": false
            }
  ],
  "valid_start": "2023-05-18T10:25:13.466Z",
  "valid_end": "2023-05-18T10:25:13.466Z"
}
Payload na podstawie powyższego strumienia danych:
curl --location 'https://api.pergam.in/api/v2/organisations/27611/data-streams' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data '{
    "name": "LEASING_CARS",
    "data_type": "LEASING",
    "technical_user_id": 67,
    "templates": [
            {
                "template_id": 6003,
                "document_name": "Agreement %headerTransactionId% [PDF]",
                "document_reference": "%headerTransactionId%",
                "document_external_id": "AG_%headerTransactionId%",
                "document_content": null,
                "is_blocked": false
            },
            {
                "template_id": 6004,
                "document_name": "Invoice %headerTransactionId% [PDF]",
                "document_reference": "%headerTransactionId%",
                "document_external_id": "IN_%headerTransactionId%",
                "document_content": null,
                "is_blocked": false
            }
  ],
  "valid_start": "2023-05-18T10:25:13.466Z",
  "valid_end": "2023-05-18T10:25:13.466Z"
}'

Transakcja

Przykładowy payload danych na bazie powyższego typu danych i strumienia danych:

curl --location 'https://ext-api.pergam.in/ext-api/v2/transactions' \
--header 'accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "transaction_data_stream": "LEASING_CARS",
    "transaction_name": "Leasing - Volvo V70",
    "transaction_apply": "apply_with_errors",
    "transaction_body": {
        "header": {
            "TransactionId": "Leasing_Volvo_V70_18052023",
            "TransactionOwner": "[email protected]",
            "Date": "2023-05-18",
            "Price": "220000",
            "TypeOfVehicle": "car",
            "YearOfProduction": "2019",
            "Mileage": "50km",
            "Address": "ul. Mickiewicza 1, 06-400 Ciechanów",
            "CarId": "1",
            "IdName": "VOLVO V70",
            "Queue": {
                "Signers": [
                    {
                        "Email": "[email protected]",
                        "SignMethod": "SIMPLE",
                        "Step": 1
                    },
                    {
                        "Email": "[email protected]",
                        "SignMethod": "SIMPLE",
                        "Step": 1
                    },
                ]
            }
    },
        "invoice": [
            {
                "InvoiceValue": "125640.01",
                "TaxValue": 23
            }
        ]
    }
}'