Przejdź do treści

Przykłady cen produktu (ProductPricing)

Przykłady ProductPricing: osadzony w contained produktu (domyślnie), samodzielny zasób (Bundle) oraz agregacja Bundle. System kodów: price-type, product-pricing-context.

Reguły contained: DomainResource §3.


1. Ceny w contained — ProductDefinition

Typowy przypadek: ProductPricing w contained ProductDefinition. Lokalne id (pp-retail); bez identifier i product.

{
  "resourceType": "ProductDefinition",
  "id": "pd-good-001",
  "meta": { "lastModified": "2026-06-01T10:00:00Z" },
  "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/product-type", "code": "good" }] },
  "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] },
  "identifier": [
    { "system": "https://api-erp.kamsoft.pl/ns/company", "value": "TOW-001" }
  ],
  "name": "Środek czyszczący 5L",
  "attribute": [
    {
      "code": { "coding": [{ "code": "unit-of-measure" }] },
      "valueCodeableConcept": [{ "coding": [{ "code": "szt" }] }]
    },
    {
      "code": { "coding": [{ "code": "vat-rate" }] },
      "valueCodeableConcept": [{ "coding": [{ "code": "23" }] }]
    }
  ],
  "contained": [
    {
      "resourceType": "ProductPricing",
      "id": "pp-retail",
      "status": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/status", "code": "active" }] },
      "context": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/product-pricing-context", "code": "sale", "display": "Sprzedaż" }] },
      "period": { "start": "2026-01-01", "end": "2026-12-31" },
      "price": [
        {
          "type": { "coding": [{ "system": "https://api-erp.kamsoft.pl/ns/price-type", "code": "unit-price-net" }] },
          "amount": { "value": 49.99, "currency": "PLN" }
        },
        {
          "type": { "coding": [{ "code": "promotional" }] },
          "amount": { "value": 39.99, "currency": "PLN" },
          "period": { "end": "2026-03-31" }
        }
      ]
    }
  ]
}

Referencja do cen z pozycji dokumentu: ProductDefinition/pd-good-001#pp-retail.


2. Ceny partii w contained — Product

Cena wyprzedaży partii — ProductPricing w contained Product (prod-batch-001 z Product-Examples).

{
  "resourceType": "Product",
  "id": "prod-batch-001",
  "productDefinition": { "reference": "ProductDefinition/pd-good-001", "display": "Środek czyszczący 5L" },
  "identifier": [
    { "system": "https://api-erp.kamsoft.pl/ns/company", "value": "PART-2025-02-001" }
  ],
  "attribute": [
    {
      "code": { "coding": [{ "code": "batch-number" }] },
      "valueString": "PART-2025-02-001"
    },
    {
      "code": { "coding": [{ "code": "expiry-date" }] },
      "valueString": "2026-06-30"
    }
  ],
  "contained": [
    {
      "resourceType": "ProductPricing",
      "id": "pp-clearance",
      "status": { "coding": [{ "code": "active" }] },
      "context": { "coding": [{ "code": "sale" }] },
      "price": [
        {
          "type": { "coding": [{ "code": "promotional" }] },
          "amount": { "value": 29.99, "currency": "PLN" },
          "period": { "end": "2026-06-30" }
        }
      ]
    }
  ]
}

3. Zasób samodzielny (Bundle / rejestr cen)

Gdy ProductPricing jest osobną wiadomością (np. element Bundle): pole product (wymagane), opcjonalnie identifier.

{
  "resourceType": "ProductPricing",
  "id": "pp-pd-good-001-retail",
  "identifier": [{ "system": "https://api-erp.kamsoft.pl/ns/company", "value": "PRICE-TOW-001-RETAIL" }],
  "product": {
    "reference": "ProductDefinition/pd-good-001",
    "type": "ProductDefinition",
    "display": "Środek czyszczący 5L"
  },
  "status": { "coding": [{ "code": "active" }] },
  "context": { "coding": [{ "code": "sale" }] },
  "period": { "start": "2026-01-01", "end": "2026-12-31" },
  "price": [
    {
      "type": { "coding": [{ "code": "unit-price-net" }] },
      "amount": { "value": 49.99, "currency": "PLN" }
    }
  ]
}

4. Cennik wieloproduktowy — Bundle collection

{
  "resourceType": "Bundle",
  "type": "collection",
  "identifier": [{ "value": "CEN-2026-RETAIL" }],
  "comment": "Cennik detaliczny 2026",
  "response": {
    "status": "success",
    "items": [
      {
        "method": "read",
        "url": "ProductPricing/pp-pd-good-001-retail",
        "resource": {
          "resourceType": "ProductPricing",
          "id": "pp-pd-good-001-retail",
          "product": { "reference": "ProductDefinition/pd-good-001" },
          "status": { "coding": [{ "code": "active" }] },
          "price": [
            { "type": { "coding": [{ "code": "unit-price-net" }] }, "amount": { "value": 49.99, "currency": "PLN" } }
          ]
        }
      },
      {
        "method": "read",
        "url": "ProductPricing/pp-pd-good-002-retail",
        "resource": {
          "resourceType": "ProductPricing",
          "id": "pp-pd-good-002-retail",
          "product": { "reference": "ProductDefinition/pd-good-002" },
          "status": { "coding": [{ "code": "active" }] },
          "price": [
            { "type": { "coding": [{ "code": "unit-price-net" }] }, "amount": { "value": 12.50, "currency": "PLN" } }
          ]
        }
      }
    ]
  }
}

5. Odniesienia