package lulu import "github.com/shopspring/decimal" // Cost is the cost of a print job. type Cost struct { Fees []Fee `json:"fees"` LineItemCosts []LineItemCost `json:"line_item_costs"` ShipCost FulfillmentCost `json:"shipping_cost"` FulfillmentCost FulfillmentCost `json:"fulfillment_cost"` TotalTax decimal.Decimal `json:"total_tax"` TotalCostExclTax decimal.Decimal `json:"total_cost_excl_tax"` TotalCostInclTax decimal.Decimal `json:"total_cost_incl_tax"` TotalDiscount decimal.Decimal `json:"total_discount"` Currency string `json:"currency"` } type Fee struct { Currency string `json:"currency"` Type string `json:"fee_type"` Sku string `json:"sku"` TaxRate decimal.Decimal `json:"tax_rate"` TotalCostExclTax decimal.Decimal `json:"total_cost_excl_tax"` TotalCostInclTax decimal.Decimal `json:"total_cost_incl_tax"` TotalTax decimal.Decimal `json:"total_tax"` } type FulfillmentCost struct { TotalCostExclTax decimal.Decimal `json:"total_cost_excl_tax"` TotalCostInclTax decimal.Decimal `json:"total_cost_incl_tax"` TotalTax decimal.Decimal `json:"total_tax"` TaxRate decimal.Decimal `json:"tax_rate"` } type LineItemCost struct { CostExclDiscounts decimal.Decimal `json:"cost_excl_discounts"` TotalTax decimal.Decimal `json:"total_tax"` TaxRate decimal.Decimal `json:"tax_rate"` Quantity uint `json:"quantity"` TotalCostExclTax decimal.Decimal `json:"total_cost_excl_tax"` TotalCostExclDiscounts decimal.Decimal `json:"total_cost_excl_discounts"` TotalCostInclTax decimal.Decimal `json:"total_cost_incl_tax"` Discounts []Discount `json:"discounts"` UnitTierCost decimal.Decimal `json:"unit_tier_cost"` } type Discount struct { Amount decimal.Decimal `json:"amount"` Description string `json:"description"` } type CostLineItem struct { NPages uint `json:"page_count"` Mfg PkgId `json:"pod_package_id"` Quantity uint `json:"quantity"` } type costReq struct { Items []CostLineItem `json:"line_items"` ShipAddr ShippingAddress `json:"shipping_address"` ShipOpt ShippingLevel `json:"shipping_option"` } type costResp struct { AddressValidation ShippingAddressValidation `json:"shipping_address"` Fees []Fee `json:"fees"` LineItemCosts []LineItemCost `json:"line_item_costs"` ShipCost FulfillmentCost `json:"shipping_cost"` FulfillmentCost FulfillmentCost `json:"fulfillment_cost"` TotalTax decimal.Decimal `json:"total_tax"` TotalCostExclTax decimal.Decimal `json:"total_cost_excl_tax"` TotalCostInclTax decimal.Decimal `json:"total_cost_incl_tax"` TotalDiscount decimal.Decimal `json:"total_discount_amount"` Currency string `json:"currency"` } func (resp costResp) cost() Cost { return Cost{ Fees: resp.Fees, LineItemCosts: resp.LineItemCosts, ShipCost: resp.ShipCost, FulfillmentCost: resp.FulfillmentCost, TotalTax: resp.TotalTax, TotalCostExclTax: resp.TotalCostExclTax, TotalCostInclTax: resp.TotalCostInclTax, TotalDiscount: resp.TotalDiscount, Currency: resp.Currency, } }