Order
@objc(GFYOrder)
public class Order : NSObject
Represents an order placed on the site.
-
The unique identifier for this order.
Declaration
Swift
@objc public let orderNumber: String
-
The local currency used for prices. Must be “USD”, unless another currency has been agreed upon by Granify.
Declaration
Swift
@objc public let currency: Currency
-
The total value of all items in the cart before any discounts, taxes and shipping, but after sale pricing.
Declaration
Swift
@objc public let lineItemsTotal: Price
-
The total value of the items in the order after discounts but before shipping or taxes.
This should match the order total you use in your own analytics.
Declaration
Swift
@objc public let subtotal: Price
-
The total value of any taxes applied to this order.
Declaration
Swift
@objc public let totalTax: Price
-
The total value of any shipping costs applied to this order.
Declaration
Swift
@objc public let totalShipping: Price
-
The total price (after discounts) including shipping and possibly taxes.
Declaration
Swift
@objc public let total: Price
-
The products in the order and their corresponding ordered quantities.
Declaration
Swift
@objc public let lineItems: [Product : Int]
-
The total number of items in the order.
Declaration
Swift
@objc public var itemCount: Int { get }
-
A list of discounts applied to this order. If no discounts are applicable, this should be an empty array.
Declaration
Swift
@objc public let discountCodes: [DiscountCode]
-
The payment status of the order. This should always be
"paid"
unless you want to send information about fraud or cancelled orders.Declaration
Swift
@objc public let financialStatus: String
-
The default financial status value for an order.
Declaration
Swift
@objc public static let defaultFinancialStatus: String
-
init(orderNumber:
currency: lineItemsTotal: subtotal: totalTax: totalShipping: total: lineItems: discountCodes: financialStatus: ) Creates an
Order
instance with all the required order details.Declaration
Swift
@available(*, deprecated, message: "Do not pass financialStatus, it is now defaulted to 'paid'.") @objc public init(orderNumber: String, currency: Currency = Currency.usd, lineItemsTotal: Price, subtotal: Price, totalTax: Price, totalShipping: Price, total: Price, lineItems: [Product: Int], discountCodes: [DiscountCode], financialStatus: String = defaultFinancialStatus)
Parameters
orderNumber
The unique identifier for this order
currency
the local currency used for prices
lineItemsTotal
The total value of all items in the cart before any discounts, taxes and shipping, but after sale pricing
subtotal
The total value of the items in the order after discounts but before shipping or taxes
totalTax
The total value of any taxes applied to this order
totalShipping
The total value of any shipping costs applied to this order
total
The total value (after discounts) including shipping and taxes
lineItems
The products in the order and their corresponding ordered quantities
discountCodes
A list of discounts applied to this order. If no discounts are applicable, this should be an empty array.
financialStatus
The payment status of the order. Use the provided parameter default (
"paid"
) unless you want to send information about fraud or cancelled orders. -
init(orderNumber:
currency: lineItemsTotal: subtotal: totalTax: totalShipping: total: lineItems: discountCodes: ) Creates an
Order
instance with all the required order details.Declaration
Parameters
orderNumber
The unique identifier for this order
currency
the local currency used for prices
lineItemsTotal
The total value of all items in the cart before any discounts, taxes and shipping, but after sale pricing
subtotal
The total value of the items in the order after discounts but before shipping or taxes
totalTax
The total value of any taxes applied to this order
totalShipping
The total value of any shipping costs applied to this order
total
The total value (after discounts) including shipping and taxes
lineItems
The products in the order and their corresponding ordered quantities
discountCodes
A list of discounts applied to this order. If no discounts are applicable, this should be an empty array.