Sha256: 87a9797bf09bb8e1eb525cd474f0e83c1bfc7f2e2eacbe2db9cd35223e8714be

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

module Spree
  class Gateway::BraintreeVzeroHostedFields < Spree::Gateway::BraintreeVzeroBase
    include ::Spree::Gateway::BraintreeVzero::LegacyRailsPatch

    preference :checkout_form_id, :string, default: 'checkout_form_payment'
    preference :error_messages_container_id, :string, default: 'content'
    preference :number_selector, :string, default: '#hosted-fields-number'
    preference :number_placeholder, :string, default: 'Card Number'
    preference :cvv_selector, :string, default: '#hosted-fields-cvv'
    preference :cvv_placeholder, :string, default: 'Cvv code'
    preference :expiration_date_selector, :string, default: '#hosted-fields-expiration-date'
    preference :expiration_date_placeholder, :string, default: 'Card Expiration Date'
    preference :store_payments_in_vault, :select, default: -> { { values: [:do_not_store, :store_only_on_success, :store_all] } }
    preference :'3dsecure', :boolean_select, default: false

    after_save :disable_dropin_gateways, if: proc {
      active? && (attributes_after_save.keys & %w[active id]).any?
    }

    def method_type
      'braintree_vzero_hosted_fields'
    end

    private

    def disable_dropin_gateways
      Spree::Gateway::BraintreeVzeroDropInUi.update_all(active: false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_braintree_vzero-3.6.0 app/models/spree/gateway/braintree_vzero_hosted_fields.rb