{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/woolworths-group/main/json-schema/woolworths-group-order-digital-cards-response-schema.json",
  "title": "OrderDigitalCardsResponse",
  "description": "Real-Time Order Response",
  "x-generated": "2026-10-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/woolworths-group-wpay-gift-card-partner-openapi.yml#/components/schemas/OrderDigitalCardsResponse",
  "required": [
    "currency"
  ],
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "description": "This indicates the current order status. The value will be 'COMPLETE' in a real-time order."
    },
    "orderId": {
      "type": "string",
      "description": "Wpay order identifier (ID)."
    },
    "refno": {
      "type": "string",
      "maxLength": 55,
      "description": "The unique order reference identifier you supplied when ordering the digital gift cards."
    },
    "payments": {
      "$ref": "#/$defs/paymentsResponseObject"
    },
    "currency": {
      "$ref": "#/$defs/currencyObject"
    },
    "cards": {
      "type": "array",
      "description": "This element will be present if this is a real-time order (syncOnly is true) and the deliveryMode is API.",
      "items": {
        "$ref": "#/$defs/cardDetailsObject"
      }
    },
    "products": {
      "$ref": "#/$defs/productsMapObject",
      "description": "This field will be present only if syncOnly is true and delivery Mode is API. This field is a map of type string/object. The key is the product identifier (SKU), while the value is an object representing the product attributes."
    },
    "cancel": {
      "$ref": "#/$defs/cancelObject"
    }
  },
  "$defs": {
    "cancelObject": {
      "type": "object",
      "description": "This field is unused.",
      "properties": {
        "allowed": {
          "type": "boolean"
        },
        "allowedWithIn": {
          "type": "number"
        }
      }
    },
    "cardDetailsObject": {
      "type": "object",
      "properties": {
        "sku": {
          "type": "string",
          "description": "The gift card identifier."
        },
        "productName": {
          "type": "string",
          "description": "The name of the gift card"
        },
        "labels": {
          "type": "object",
          "required": [
            "cardNumber",
            "cardPin",
            "activationCode"
          ],
          "properties": {
            "cardNumber": {
              "type": "string",
              "description": "The human readable label for the card number"
            },
            "cardPin": {
              "type": "string",
              "description": "The human readable label for the card PIN"
            },
            "activationCode": {
              "type": "string",
              "description": "The human readable label for the card activation code"
            },
            "validity": {
              "type": "string",
              "description": "The human readable label for the card validity"
            }
          }
        },
        "cardNumber": {
          "type": "string",
          "description": "The gift card number"
        },
        "cardPin": {
          "type": "string",
          "description": "The gift card PIN"
        },
        "activationCode": {
          "type": "string",
          "description": "The gift card activation code"
        },
        "activationUrl": {
          "type": "string",
          "description": "The URL of the gift card activation page"
        },
        "barcode": {
          "type": "string",
          "description": "The gift card barcode"
        },
        "formats": {
          "type": "array",
          "description": "A list of barcode formats for this card. Each item in the list is a key/value pair.",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "description": "The barcode format.",
                "enum": [
                  "CNONLY",
                  "CA128",
                  "QRCODE",
                  "PDF417",
                  "INT2OF5",
                  "DATAMATRIX",
                  "QCGTINBARCODE-32",
                  "QCBARCODE-31-V1",
                  "TRACK2"
                ]
              },
              "value": {
                "type": "string",
                "description": "The barcode value for this format. The field type is a string, althought the content of this string is a decimal."
              }
            }
          }
        },
        "amount": {
          "type": "string",
          "description": "The amount loaded onto the card."
        },
        "validity": {
          "type": "string",
          "description": "The expiry date of the gift card in (ISO 8601) format."
        },
        "issuanceDate": {
          "type": "string",
          "description": "The date the gift card was activated in (ISO 8601) format."
        },
        "cardId": {
          "type": "number",
          "description": "This field is unused."
        },
        "theme": {
          "type": "string",
          "description": "This field is unused."
        },
        "recipientDetails": {
          "type": "object",
          "description": "This field is unused.",
          "properties": {
            "name": {
              "type": "string",
              "description": "Recipient full name"
            },
            "firstname": {
              "type": "string",
              "description": "Recipient first name"
            },
            "lastname": {
              "type": "string",
              "description": "Recipient last name"
            },
            "email": {
              "type": "string",
              "description": "Recipient email address"
            },
            "mobileNumber": {
              "type": "string",
              "description": "Recipient mobile phone number"
            },
            "status": {
              "type": "string",
              "description": "Message delivery status"
            }
          }
        }
      }
    },
    "currencyObject": {
      "type": "object",
      "description": "Contains details about the gift card currency.",
      "properties": {
        "code": {
          "type": "string",
          "description": "Currency code"
        },
        "numericCode": {
          "type": "string",
          "minLength": 3,
          "maxLength": 3,
          "description": "Currency numeric code as per https://en.wikipedia.org/wiki/ISO_4217"
        },
        "symbol": {
          "type": "string",
          "description": "Currency symbol"
        }
      }
    },
    "paymentsResponseObject": {
      "description": "The account the gift card amounts have or will be deducted from.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "The code 'svc' indicates that the payment was be made against your SVA."
          },
          "balance": {
            "type": "number",
            "description": "The payment amount for the order. This value will match the sum of 'price' times 'qty' for all cards in this order."
          }
        }
      }
    },
    "productsMapObject": {
      "type": "object",
      "required": [
        "default"
      ],
      "properties": {
        "sku": {
          "type": "string",
          "description": "The product identifier (SKU). One item in the map will be present for each unique SKU."
        }
      },
      "additionalProperties": {
        "type": "object",
        "description": "Product information, including artwork for each gift card SKU ordered.",
        "minItems": 1,
        "maxItems": 1,
        "required": [
          "cardBehaviour",
          "barcodeFormats"
        ],
        "properties": {
          "sku": {
            "type": "string",
            "description": "The product identifier (SKU). This field is a repeat of the hash map key."
          },
          "name": {
            "type": "string",
            "description": "The product name"
          },
          "balanceEnquiryInstruction": {
            "type": "string",
            "description": "This field is unused."
          },
          "specialInstruction": {
            "description": "This field is unused.",
            "oneOf": [
              {
                "type": "string",
                "default": ""
              },
              {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "This field is unused."
                  },
                  "url": {
                    "type": "string",
                    "description": "This field is unused."
                  }
                }
              }
            ],
            "type": "string"
          },
          "images": {
            "type": "object",
            "description": "This field is unused.",
            "properties": {
              "base": {
                "type": "string"
              },
              "small": {
                "type": "string"
              },
              "thumbnail": {
                "type": "string"
              },
              "mobile": {
                "type": "string"
              }
            }
          },
          "cardBehaviour": {
            "type": "string",
            "description": "This field is unused."
          }
        }
      }
    }
  }
}