Sha256: 441e4e3291b2e5d2f32f37db93cabf133dab5c82b865851526e4e79343eb5823

Contents?: true

Size: 833 Bytes

Versions: 8

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

module SolidusBolt
  class PaymentMethod < SolidusSupport.payment_method_parent_class
    preference :bolt_api_key, :string
    preference :bolt_signing_secret, :string
    preference :bolt_publishable_key, :string

    def gateway_class
      ::SolidusBolt::Gateway
    end

    def payment_source_class
      ::SolidusBolt::PaymentSource
    end

    def partial_name
      'bolt'
    end

    def preferred_bolt_base_url
      bolt_config.embed_js
    end

    def preferred_bolt_api_url
      bolt_config.environment_url
    end

    def try_void(payment)
      return false unless payment.source.can_void?(payment)

      gateway.void(payment.response_code, originator: payment)
    end

    private

    def bolt_config
      @bolt_config = SolidusBolt::BoltConfiguration.fetch
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
solidus_bolt-0.7.2 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.7.1 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.7.0 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.6.0 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.5.0 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.4.0 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.3.0 app/models/solidus_bolt/payment_method.rb
solidus_bolt-0.2.0 app/models/solidus_bolt/payment_method.rb