Untitled
unknown
swift
4 years ago
1.7 kB
10
Indexable
let product_one = YMMECommerceProduct(
sku: "123",
name: "Позиция 1",
categoryComponents: ["Продукты", "Молочные продукты", "Йогурты"],
payload: ["full_screen": "true"],
actualPrice: actualPrice,
originalPrice: .init(
fiat: .init(unit: "USD", value: .init(string: "5.78")),
internalComponents: [
.init(unit: "wood", value: .init(string: "30590000")),
.init(unit: "iron", value: .init(string: "26.92")),
.init(unit: "gold", value: .init(string: "5.5")),
]
),
promoCodes: ["BT79IYX", "UT5412EP"]
),
let product_two = YMMECommerceProduct(
sku: "456",
name: "Позиция 2",
categoryComponents: ["Продукты", "Молочные продукты", "Йогурты"],
payload: ["full_screen": "true"],
actualPrice: actualPrice,
originalPrice: .init(
fiat: .init(unit: "USD", value: .init(string: "5.78")),
internalComponents: [
.init(unit: "wood", value: .init(string: "30590000")),
.init(unit: "iron", value: .init(string: "26.92")),
.init(unit: "gold", value: .init(string: "5.5")),
]
),
promoCodes: ["BT79IYX", "UT5412EP"]
)
// Creating a referrer object.
let referrer = YMMECommerceReferrer(type: "button", identifier: "76890", screen: screen)
// Creating a cartItem object.
let addedItems = YMMECommerceCartItem(
product: [product_one, product_two]
referrer: referrer,
quantity: .init(string: "1"),
revenue: actualPriceEditor is loading...