Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Define the matrix key generator (matrix pricing logic):

  1. Go to Configuration > Calculation Logic > Generic Logic. Create a new logic and set Nature to Matrix.
  2. Define the logic's elements. Create one visible element which will return a list of keys generated based on input parameters. Below is an example of keys generated from Datacenters, Terms_Payments, Tiers, Customers, and Programs elements.

...

Define a price list logic which will reference the matrix logic and retrieve the key list:

  1. Go to Configuration > Calculation Logic > Generic Logic. Create a new logic.
  2. Create an element which retrieves the secondary key using the method api.getSecondaryKey().
  3. The returned key can be split into various components which will be used to calculate the price based on their variations.

    Code Block
    languagegroovy
    def key = api.getElement("Debug")=="No" ? api.getSecondaryKey() : "B1A-36PT5-C1S"
    
    def parts = key?.tokenize("-")
    
    return [
      dc: parts[0],
      term: parts[1][0..1],
      payment: parts[1][2],
      tier: parts[1][3..4],
      program: parts[2][0],
      version: parts[2][1],
      priceType: parts[2][2]
    ]


  4. This makes it possible to extract a secondary key component for subsequent substitutions. Like this:

    Code Block
    languagegroovy
    return api.getElement("SecondaryKey")?.dc  //for Datacenter

    or

    Code Block
    languagegroovy
    return api.getElement("SecondaryKey")?.term  //for Term


  5. Subsequent logic performs substitutions to build the SKU, look up currency, and calculate prices for the price list.