<commit_before># encoding: utf-8
require 'mercadopago.rb'
module CatarseMercadopagos::Payment
  class MercadopagosController < ApplicationController
    skip_before_filter :verify_authenticity_token, :only => [:notifications]
    skip_before_filter :detect_locale, :only => [:notifications]
    skip_before_filter :set_locale, :only => [:notifications]
    skip_before_filter :force_http
    
    before_filter :setup_gateway
    
    SCOPE = "projects.contributions.checkout"

    layout :false

    def review
      begin
        # contribution = current_user.backs.not_confirmed.find params[:id]
        contribution = ::Contribution.find(params[:id])
        # Just to render the review form
        preferenceData = Hash["items" =>
          Array(
            Array["id"=>"sumame-proyect-#{contribution.project.id}-contribution-#{contribution.id}-user-#{current_user.id}",
           "title"=>"Aporte a la campaña #{contribution.project.name} por #{contribution.value}",
           "quantity"=>1,
           "description" => "Esta transacción es por el aporte de #{current_user.name} a la campaña #{contribution.project.name} por un valor de #{contribution.value}",
           "unit_price"=> contribution.value.to_f,
           "currency_id"=>"COP"]),
          "payer" =>{"name" => "CONT#{current_user.name}",
                "surname" => "CONT#{current_user.full_name}",
                "email" => "#{current_user.email}"},
          "back_urls" => {"success"=>"#{payment_success_mercadopagos_url(id: contribution.id)}",
                          "pending"=>"#{payment_pending_mercadopagos_url(id: contribution.id)}",
                          "failure"=>"#{payment_failure_mercadopagos_url(id: contribution.id)}"
                         },
          "notification_url" => "#{payment_notifications_mercadopagos_url(id_conribution: contribution.id)}"
          ]
        @preference = @@gateway.create_preference(preferenceData)
      rescue Exception => e
        puts "####$$$$$$$$$$$$ %%%%   #{e.inspect}"
      end
<commit_msg>with merchant_fee<commit_after># encoding: utf-8
require 'mercadopago.rb'
module CatarseMercadopagos::Payment
  class MercadopagosController < ApplicationController
    skip_before_filter :verify_authenticity_token, :only => [:notifications]
    skip_before_filter :detect_locale, :only => [:notifications]
    skip_before_filter :set_locale, :only => [:notifications]
    skip_before_filter :force_http
    
    before_filter :setup_gateway
    
    SCOPE = "projects.contributions.checkout"

    layout :false

    def review
      begin
        # contribution = current_user.backs.not_confirmed.find params[:id]
        contribution = ::Contribution.find(params[:id])
        # Just to render the review form
        preferenceData = Hash["items" =>
          Array(
            Array["id"=>"sumame-proyect-#{contribution.project.id}-contribution-#{contribution.id}-user-#{current_user.id}",
           "title"=>"Aporte a la campaña #{contribution.project.name} por #{contribution.value}",
           "quantity"=>1,
           "description" => "Esta transacción es por el aporte de #{current_user.name} a la campaña #{contribution.project.name} por un valor de #{contribution.value}",
           "unit_price"=> contribution.value.to_f,
           "currency_id"=>"COP"]),
          "payer" =>{"name" => "CONT#{current_user.name}",
                "surname" => "CONT#{current_user.full_name}",
                "email" => "#{current_user.email}"},
          "back_urls" => {"success"=>"#{payment_success_mercadopagos_url(id: contribution.id)}",
                          "pending"=>"#{payment_pending_mercadopagos_url(id: contribution.id)}",
                          "failure"=>"#{payment_failure_mercadopagos_url(id: contribution.id)}"
                         },
          "notification_url" => "#{payment_notifications_mercadopagos_url(id_conribution: contribution.id)}",
          "marketplace_fee" => "0.15"
          ]
        @preference = @@gateway.create_preference(preferenceData)
      rescue Exception => e
        puts "####$$$$$$$$$$$$ %%%%   #{e.inspect}"
      end

{'fraction_non_alphanumeric': 0.14219849551079836, 'fraction_numerical': 0.0016986168405726766, 'mean_word_length': 3.049115913555992, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, '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': '1117332', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1253, 'n_words': 207}