CartInteractor
public protocol CartInteractor
Cart interactor that can manipulate and do business logic around cart functionality.
-
Data manager used to establish network communication and retrieve data.
Declaration
Swift
var dataManager: DataManagerType
-
Cart data manager generic type.
Declaration
Swift
associatedtype DataManagerType: CartDataManager
-
Associated shipping option type.
Declaration
Swift
associatedtype ShippingOptionType: ShippingOption
-
Associated cart type.
Declaration
Swift
associatedtype CartType: Cart
-
cart(completion:)
Default implementation -
add(items:completion:)
Default implementationAdds the given products to the cart.
- Parameters:
- items: The cart items to add.
- completion: The completion block.
Default Implementation
Declaration
Swift
func add(items: [ParameterConvertible],
Parameters
items
The cart items to add.
completion
The completion block.
- Parameters:
-
update(items:completion:)
Default implementationUpdates the given products to the cart.
- Parameters:
- items: The cart items to update.
- completion: The completion block.
Default Implementation
Declaration
Swift
func update(items: [ParameterConvertible],
Parameters
items
The cart items to update.
completion
The completion block.
- Parameters:
-
adjustment(type:code:completion:)
Default implementationUpdates 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
Declaration
Swift
func adjustment(type: String,
Parameters
type
The type of adjustment.
code
The code of the adjustment.
completion
The completion block.
- Parameters:
-
shippingOptions(completion:)
Default implementationGets 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.