<commit_before>Spree::CheckoutController.class_eval do
  private

  def completion_route
    if is_omnikassa_payment?
      url_for :controller => 'omnikassa',
              :action => 'start',
              :payment_id => payment.id,
              :token => @order.token
    else
      # This is the original completion route
      spree.order_path(@order)
    end
  end

  def payment
    @order.payments.first
  end

  def is_omnikassa_payment?
    payment_method = @order.payments.last.payment_method
    payment_method.class == Spree::BillingIntegration::Omnikassa
  end
end<commit_msg>Make sure we pick the last payment<commit_after>Spree::CheckoutController.class_eval do
  private

  def completion_route
    if is_omnikassa_payment?
      url_for :controller => 'omnikassa',
              :action => 'start',
              :payment_id => payment.id,
              :token => @order.token
    else
      # This is the original completion route
      spree.order_path(@order)
    end
  end

  def payment
    @order.payments.first
  end

  def is_omnikassa_payment?
    payment_method = @order.payments.order(id: :desc).last.payment_method
    payment_method.class == Spree::BillingIntegration::Omnikassa
  end
end
{'fraction_non_alphanumeric': 0.0860655737704918, 'fraction_numerical': 0.0, 'mean_word_length': 2.8275862068965516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6435559', 'n_tokens_mistral': 382, 'n_tokens_neox': 369, 'n_words': 82}