lib/workarea/klarna/gateway/order.rb in workarea-klarna-1.0.0.beta2 vs lib/workarea/klarna/gateway/order.rb in workarea-klarna-1.0.0
- old
+ new
@@ -111,10 +111,14 @@
tax_rate: tax_rate,
product_url: Workarea::Storefront::Engine.routes.url_helpers.product_url(
host: Workarea.config.host,
id: view_model.product.slug
),
+ image_url: ProductPrimaryImageUrl.new(
+ view_model.catalog_product,
+ :medium_thumb
+ ).url,
product_identifiers: { category_path: breadcrumbs&.join(' > ') }.compact
}
end
def item_tax_data(item)
@@ -209,21 +213,21 @@
[]
end
end
def gift_card_line
- amount = gift_cards.sum(&:amount)
+ amount = gift_cards.sum(&:amount) || 0.to_m
- return unless amount.to_i.positive?
+ return unless amount.positive?
{
name: 'Gift Card',
type: 'gift_card',
quantity: 1,
- unit_price: -1 * amount,
+ unit_price: -1 * amount.cents,
tax_rate: 0,
total_tax_amount: 0,
- total_amount: -1 * amount
+ total_amount: -1 * amount.cents
}
end
def merchant_urls
{