<commit_before>class PaymentNotificationsController < ApplicationController
    protect_from_forgery :except => [:create]
    before_filter :authenticate_user!, :only => :index
    def create
        PaymentNotification.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id] )
        @cart = Cart.find(params[:invoice])
        @cart.order_email = params[:payer_email]
        @cart.save
        render :nothing => true
    end

    def index
        @payment_notifications = PaymentNotification.all
    end
end<commit_msg>error guard on IPNs not related to cart transactions<commit_after>class PaymentNotificationsController < ApplicationController
    protect_from_forgery :except => [:create]
    before_filter :authenticate_user!, :only => :index
    def create
        if params[:txn_type] == 'cart'
            PaymentNotification.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id] )
            @cart = Cart.find(params[:invoice])
            @cart.order_email = params[:payer_email]
            @cart.save
            render :nothing => true
        end
    end

    def index
        @payment_notifications = PaymentNotification.all
    end
end
{'fraction_non_alphanumeric': 0.10812883435582822, 'fraction_numerical': 0.0, 'mean_word_length': 3.379194630872483, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '249462', 'n_tokens_mistral': 359, 'n_tokens_neox': 350, 'n_words': 81}