Merge Strategies

Merge Strategies

MergeOrdersStrategy

Merges both Orders. If the guest order contains items which are already in the existing Order, the guest Order quantity will replace that of the existing Order.

Signature

class MergeOrdersStrategy implements OrderMergeStrategy {
  merge(guestOrder: Order, existingOrder: Order) => OrderLine[];
}

Members

merge

method
type:
(guestOrder: Order, existingOrder: Order) => OrderLine[]

UseExistingStrategy

The guest order is discarded and the existing order is used as the active order.

Signature

class UseExistingStrategy implements OrderMergeStrategy {
  merge(guestOrder: Order, existingOrder: Order) => OrderLine[];
}

Members

merge

method
type:
(guestOrder: Order, existingOrder: Order) => OrderLine[]

UseGuestIfExistingEmptyStrategy

If the existing order is empty, then the guest order is used. Otherwise the existing order is used.

Signature

class UseGuestIfExistingEmptyStrategy implements OrderMergeStrategy {
  merge(guestOrder: Order, existingOrder: Order) => OrderLine[];
}

Members

merge

method
type:
(guestOrder: Order, existingOrder: Order) => OrderLine[]

UseGuestStrategy

Any existing order is discarded and the guest order is set as the active order.

Signature

class UseGuestStrategy implements OrderMergeStrategy {
  merge(guestOrder: Order, existingOrder: Order) => OrderLine[];
}

Members

merge

method
type:
(guestOrder: Order, existingOrder: Order) => OrderLine[]