Sha256: cbd1495a59395f9b801489d1e6b74fd44c9c08b0cc6ca54e3ff16403411fb092

Contents?: true

Size: 887 Bytes

Versions: 6

Compression:

Stored size: 887 Bytes

Contents

module Workarea
  decorate Storefront::Checkout::PaymentViewModel, with: 'gift_cards' do
    # Whether or not to show current gift card information.
    # True if the current payment is a valid gift card.
    #
    # @return [Boolean]
    #
    def show_gift_card?
      payment.gift_card?
    end

    # Can the current gift card cover the entire order
    # total? Used for rendering gift card messaging.
    #
    # @return [Boolean]
    #
    def order_covered_by_gift_card?
      gift_card_balance >= total_after_store_credit
    end

    # Can store credit or gift card cover the entire
    # order total? Override this method in order to prevent
    # a default credit card from being selected if
    # not necessary to complete the order.
    #
    # @return [Boolean]
    #
    def order_covered_by_advance_payments?
      super || order_covered_by_gift_card?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-gift_cards-3.4.11 app/view_models/workarea/storefront/checkout/payment_view_model.decorator
workarea-gift_cards-3.4.10 app/view_models/workarea/storefront/checkout/payment_view_model.decorator
workarea-gift_cards-3.4.9 app/view_models/workarea/storefront/checkout/payment_view_model.decorator
workarea-gift_cards-3.4.8 app/view_models/workarea/storefront/checkout/payment_view_model.decorator
workarea-gift_cards-3.4.7 app/view_models/workarea/storefront/checkout/payment_view_model.decorator
workarea-gift_cards-3.4.6 app/view_models/workarea/storefront/checkout/payment_view_model.decorator