CartDataManager

public protocol CartDataManager: DataManager

Cart data manager protocol.

  • cart(completion:) Default implementation

    Gets the cart.

    Parameter

    Parameter completion: The completion block.

    Default Implementation

    Gets the available shipping options for the current cart.

    Parameter

    Parameter completion: The completion block.

    Declaration

    Swift

    func cart(completion: @escaping (_ cart: CartType?, _ error: Swift.Error?) -> Void)

    Parameters

    completion

    The completion block.

  • Associated shipping option type.

    Declaration

    Swift

    associatedtype ShippingOptionType: ShippingOption
  • Associated cart type.

    Declaration

    Swift

    associatedtype CartType: Cart
  • add(items:completion:) Default implementation

    Adds the given products to the cart.

    • Parameters:
      • items: The cart items to add.
      • completion: The completion block.

    Default Implementation

    Gets the available shipping options for the current cart.

    Parameter

    Parameter completion: The completion block.

    Declaration

    Swift

    func add(items: [ParameterConvertible],

    Parameters

    items

    The cart items to add.

    completion

    The completion block.

  • update(items:completion:) Default implementation

    Updates the given products to the cart.

    • Parameters:
      • items: The cart items to update.
      • completion: The completion block.

    Default Implementation

    Gets the available shipping options for the current cart.

    Parameter

    Parameter completion: The completion block.

    Declaration

    Swift

    func update(items: [ParameterConvertible],

    Parameters

    items

    The cart items to update.

    completion

    The completion block.

  • adjustment(type:code:completion:) Default implementation

    Updates the cart with the given adjustment object (gift card, promo code, coupon…)

    • Parameters:
      • type: The type of adjustment.
      • code: The code of the adjustment.
      • completion: The completion block.

    Default Implementation

    Gets the available shipping options for the current cart.

    Parameter

    Parameter completion: The completion block.

    Declaration

    Swift

    func adjustment(type: String,

    Parameters

    type

    The type of adjustment.

    code

    The code of the adjustment.

    completion

    The completion block.

  • shippingOptions(completion:) Default implementation

    Gets the available shipping options for the current cart.

    Parameter

    Parameter completion: The completion block.

    Default Implementation

    Declaration

    Swift

    func shippingOptions(completion: @escaping (_ shippingOptions: [ShippingOptionType], _ error: Swift.Error?) -> Void)

    Parameters

    completion

    The completion block.