pub struct BasketItem {
pub id: String,
pub ean: String,
pub name: LocalizedName,
pub amount_info: AmountInfo,
pub pricing: Option<Pricing>,
pub allow_substitutes: bool,
pub product_details: ProductDetails,
}Fields§
§id: StringThe basket’s own item id, and what SET-ITEM-AMOUNT / REMOVE-ITEM take.
For ordinary products this is observably equal to the EAN, but the
frontend keys items by (localStoreId, ean), so that equality is not
something to depend on for store-local products. Always resolve it from a
get_cart read.
ean: String§name: LocalizedName§amount_info: AmountInfo§pricing: Option<Pricing>§allow_substitutes: bool§product_details: ProductDetailsImplementations§
Source§impl BasketItem
impl BasketItem
Sourcepub fn is_known_product(&self) -> bool
pub fn is_known_product(&self) -> bool
Whether K-Ruoka actually has a product record for this EAN.
ADD-ITEM accepts any EAN and cheerfully puts an item named “Tuntematon
tuote” / “Unknown product” in the basket, so a typo’d barcode silently
pollutes the cart while reporting success.
The discriminator is the presence of productDetails.attributes, not
pricing: attributes means “we have a record of this product”, while
availability means “you can get it here”. A real product that is simply
out of stock still has attributes, so keying off pricing == null would
risk rejecting valid adds. Observed live – two real EANs carried
[attributes, availability, category, soldBy], the phantom only
[availability].
Trait Implementations§
Source§impl Clone for BasketItem
impl Clone for BasketItem
Source§fn clone(&self) -> BasketItem
fn clone(&self) -> BasketItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more