Sha256: 3563e36ca98e065ea443c9ac064be8492a47c3d8101f648dcfed4d76272c42fd
Contents?: true
Size: 758 Bytes
Versions: 5
Compression:
Stored size: 758 Bytes
Contents
module Workarea decorate Payment, with: :klarna do decorated do embeds_one :klarna, class_name: "Workarea::Payment::Tender::Klarna", inverse_of: :payment delegate :redirect_url, to: :klarna, allow_nil: true end def set_klarna(attrs) build_klarna unless klarna klarna.attributes = attrs.slice( :authorization_token, :authorization_token_expires_at, :payment_method_category ) save end def clear_klarna self.klarna = nil end def eligible_for_klarna? address.present? && address.country&.continent.present? && address.country.continent.in?( Workarea.config.klarna_continent_keys.keys ) end end end
Version data entries
5 entries across 5 versions & 1 rubygems