Sha256: 8c6b644d04965cdada3cad1e5f8f9ead2ccba9bcb7d1e40bd496703ad895958e
Contents?: true
Size: 565 Bytes
Versions: 5
Compression:
Stored size: 565 Bytes
Contents
module Workarea class SetupKlarnaSession delegate :order, :payment, to: :@checkout def initialize(checkout) @checkout = checkout end def perform return unless payment.eligible_for_klarna? session = Payment::KlarnaSession.find_or_initialize_by(id: order.id) if session.persisted? Klarna.gateway.update_session(order, session.session_id) else response = Klarna.gateway.create_session(order) return unless response.success? session.update!(response.body) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems