Skip to content

Define handling of multiple applicable modifiers #684

@mnoorenberghe

Description

@mnoorenberghe
  1. From what I can tell, the spec doesn't currently define which additionalDisplayItems should be shown if a UA decides to show any.
  2. More generally, handling of multiple applicable modifiers isn't clear. It looks like it's possible to have multiple methodData and modifiers with the same supportedMethods including the same data.

Consider the following example snippet:

// Credit card incurs a $3.00 processing fee.
const creditCardFee = {
  label: "Credit card processing fee",
  amount: { currency: "USD", value: "3.00" },
};

// Visa card incurs a $1.00 processing fee.
const visaFee = {
  label: "Visa processing fee",
  amount: { currency: "USD", value: "1.00" },
};

// Modifiers apply when the user chooses to pay with
// a credit card.
const modifiers = [
  {
    additionalDisplayItems: [creditCardFee],
    supportedMethods: "basic-card",
    total: {
      label: "Total due",
      amount: { currency: "USD", value: "53.00" },
    },
    data: {
      supportedTypes: ["credit"],
    },
  },
  {
    additionalDisplayItems: [visaFee],
    supportedMethods: "basic-card",
    total: {
      label: "Total due",
      amount: { currency: "USD", value: "54.00" },
    },
    data: {
      supportedNetworks: ["visa"]
    },
  },
];
Object.assign(details, { modifiers });

If multiple modifiers match the selected payment method (e.g. if the user selects a Visa card):

  • Should all applicable additional display items be shown? The first matching one? Last matching one? Most specific one (would need to be defined)
  • Which modifier's total should be used?

This seems like something that should be tested as well.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions