Skip to content

ProductDetails

struct ProductDetails

The purchase line-item fields a campaign’s productScope can target.

Mirrors the backend’s PRODUCT_SCOPE_FIELDS allowlist and sdk/core’s ProductDetails exactly (sdk/core/src/types/product.ts) — a field outside this set cannot have been published on a campaign, so adding one here without a matching backend change would be dead weight.

Double, not Int, for every numeric: the wire type is a JSON number and the backend compares numerically; an Int would silently truncate a fractional unitPrice.

Decoding lives on a private wire type in RewardsDecoder.swift: a synthesized Decodable throws on a present-but-wrong-typed value even for an Optional property, which would let one reshaped field inside matchedProducts take down the whole rewards response.

Conforms to Swift.Equatable, Swift.Hashable, Swift.Sendable

Defined in: Sources/FrakSDK/Core/ProductDetails.swift:16

init(productId:sku:name:quantity:unitPrice:totalPrice:)

Section titled “init(productId:sku:name:quantity:unitPrice:totalPrice:)”
init(
productId: String? = nil,
sku: String? = nil,
name: String? = nil,
quantity: Double? = nil,
unitPrice: Double? = nil,
totalPrice: Double? = nil
)
let name: String?
let productId: String?
let quantity: Double?
let sku: String?
let totalPrice: Double?
let unitPrice: Double?

!=(::)

static func != (lhs: Self, rhs: Self) -> Bool

Returns a Boolean value indicating whether two values are not equal.

Inequality is the inverse of equality. For any values a and b, a != b implies that a == b is false.

This is the default implementation of the not-equal-to operator (!=) for any type that conforms to Equatable.

  • Parameters:
    • lhs: A value to compare.
    • rhs: Another value to compare.