<commit_before>class SolidusPaypalBraintree::CheckoutsController < Spree::CheckoutController
  PERMITTED_ORDER_PARAMS = [
  ].freeze

  PERMITTED_PAYMENT_PARAMS = [
    :payment_method_id,
    source_attributes: [
      :nonce,
      :payment_type
    ]
  ].freeze

  def update
    @order.payments.create!(payment_params)

    render text: 'ok'
  end

  def order_params
    params.require(:order).permit(PERMITTED_ORDER_PARAMS)
  end

  def payment_params
    params.
      require(:order).
      require(:payments_attributes).
      first.
      permit(PERMITTED_PAYMENT_PARAMS)
  end
end<commit_msg>Stop using deprecated payment create<commit_after>class SolidusPaypalBraintree::CheckoutsController < Spree::CheckoutController
  PERMITTED_ORDER_PARAMS = [
  ].freeze

  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 text: "ok"
    else
      render text: "not-ok"
    end
  end

  def order_params
    params.require(:order).permit(PERMITTED_ORDER_PARAMS)
  end

  def payment_params
    params.
      require(:order).
      require(:payments_attributes).
      first.
      permit(PERMITTED_PAYMENT_PARAMS)
  end
end
{'fraction_non_alphanumeric': 0.08616780045351474, 'fraction_numerical': 0.0, 'mean_word_length': 3.284789644012945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643562', 'n_tokens_mistral': 457, 'n_tokens_neox': 445, 'n_words': 74}