Sha256: 1b8e9f29eb894709c0b3d09f7911a565f210a43b39fe9db43de5f0b44093c5fc

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 Bytes

Contents

class SolidusPaypalBraintree::CheckoutsController < Spree::CheckoutController
  PERMITTED_PAYMENT_PARAMS = [
    :payment_method_id,
    source_attributes: [
      :nonce,
      :payment_type
    ]
  ].freeze

  def update
    @payment = Spree::PaymentCreate.new(@order, payment_params).build

    if @payment.save
      render plain: "ok"
    else
      render plain: "not-ok"
    end
  end

  def payment_params
    params.
      require(:order).
      require(:payments_attributes).
      first.
      permit(PERMITTED_PAYMENT_PARAMS)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_paypal_braintree-0.4.0 lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
solidus_paypal_braintree-0.3.0 lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
solidus_paypal_braintree-0.2.0 lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb
solidus_paypal_braintree-0.1.0 lib/controllers/frontend/solidus_paypal_braintree/checkouts_controller.rb