Module jonix.onix3

Class Discount

java.lang.Object
com.tectonica.jonix.onix3.Discount
All Implemented Interfaces:
OnixComposite, OnixComposite.OnixDataComposite<JonixDiscount>, OnixTag, Serializable

public class Discount extends Object implements OnixComposite.OnixDataComposite<JonixDiscount>, Serializable

Discount composite

An optional group of data elements which together define a discount either as a percentage or as an absolute amount. Repeatable in order to specify a more complex arrangement such as a progressive or tiered discount. Used only when an ONIX message is sent within the context of a specific trading relationship.

Reference name <Discount>
Short tag <discount>
Cardinality 0…n

This tag may be included in the following composites:

Possible placements within ONIX message:

See Also:
  • Field Details

  • Constructor Details

    • Discount

      public Discount()
    • Discount

      public Discount(Element element)
  • Method Details

    • _initialize

      public void _initialize()
      Description copied from interface: OnixComposite
      This is an internal API. Since Jonix 8.0, composite objects are being populated lazily. This method initiates the population process, and is invoked internally by the accessor APIs of the composites
      Specified by:
      _initialize in interface OnixComposite
    • exists

      public boolean exists()
      Description copied from interface: OnixTag
      indicates whether this tag exists in the ONIX record
      Specified by:
      exists in interface OnixTag
      Returns:
      whether this tag (<Discount> or <discount>) is explicitly provided in the ONIX XML
    • ifExists

      public void ifExists(Consumer<Discount> action)
    • getXmlElement

      public Element getXmlElement()
      Description copied from interface: OnixComposite
      For advanced use-cases only.
      Specified by:
      getXmlElement in interface OnixComposite
      Returns:
      native representation of the XML element underlying to this tag
    • discountPercent

      public DiscountPercent discountPercent()

      A discount percentage applicable to the price carried in an occurrence of the <Price> composite. Optional and non-repeating; but either <DiscountPercent> or <DiscountAmount> or both must be present in each occurrence of the <Discount> composite.

      Jonix-Comment: this field is required
    • discountType

      public DiscountType discountType()

      An ONIX code identifying a discount type or reason. Optional, and non-repeating. When omitted, the default is a simple or rising discount (the discount is applied to all units in a qualifying order).

      Jonix-Comment: this field is optional
    • quantity

      public Quantity quantity()

      A minimum order quantity required to qualify for a specified discount. Optional, and non-repeating. Where omitted, the discount applies regardless of the order quantity (ie the minimum qualifying order quantity is 1).

      Jonix-Comment: this field is optional
    • toQuantity

      public ToQuantity toQuantity()

      A maximum order quantity eligible for a specified discount, used only in the case of ‘progressive’ discounts. Optional, but where used, must be preceded by a minimum qualifying order quantity (even if that minimum is 1). For the special case where there is no maximum (ie in the repeat of the <Discount> composite that specifies the highest progressive discount), use zero.

      Jonix-Comment: this field is optional
    • discountAmount

      public DiscountAmount discountAmount()

      A discount expressed as an absolute amount per copy. Optional and non-repeating; but either <DiscountPercent> or <DiscountAmount> or both must be present in each occurrence of the <Discount> composite. Note that when both are present, they represent two different expressions of the same discount – the discounts are not cumulative.

      Jonix-Comment: this field is optional
    • asStruct

      public JonixDiscount asStruct()
      Specified by:
      asStruct in interface OnixComposite.OnixDataComposite<JonixDiscount>