Sha256: e0c71d0eada5b8ada90b5e9fb62cda38eed2da259192d031e9ecb2d6ebc0fd82
Contents?: true
Size: 1.2 KB
Versions: 62
Compression:
Stored size: 1.2 KB
Contents
module Workarea class Storefront::UserViewModel < ApplicationViewModel delegate :display_number, :month, :year, to: :default_credit_card, prefix: true def has_default_addresses? addresses.present? end def default_credit_card @default_credit_card ||= payment.default_credit_card end def has_credit_card? !!default_credit_card end def credit_cards payment.credit_cards end def recent_orders @recent_orders ||= recent_order_models.map do |order| Storefront::OrderViewModel.new( order, fulfillment_status: fulfillment_statuses[order.id] ) end end def email_signup? return @email_signup if defined?(@email_signup) @email_signup = Email.signed_up?(email) end private def recent_order_models @recent_order_models ||= Order.recent( model.id, Workarea.config.recent_order_count ) end def fulfillment_statuses @fulfillment_statuses ||= Fulfillment.find_statuses( *recent_order_models.map(&:id) ) end def payment @payment ||= Payment::Profile.lookup(PaymentReference.new(model)) end end end
Version data entries
62 entries across 62 versions & 1 rubygems