Платежный шлюз Braintree `confirm_payment_url'

я сталкиваюсь с ошибкой при попытке включить драгоценный камень мозгового дерева в мое приложение для рельсов 3. что действительно странно, так это то, что я смог успешно установить его в одном приложении в своей системе, а затем, когда я пытаюсь запустить его в другом приложении, получаю следующую ошибку:

undefined local variable or method `confirm_payment_url' for #<#<Class:0x103a2bf08>:0x103a2a298>

вот код по умолчанию, который я использую:

<h1>Payment: $<%= h @amount %></h1>

<% if @result -%>
  <div style="color: red;"><%= h @result.errors.size %> error(s)</div>
<% end -%>

<%= form_for :transaction,
     :params => @result && @result.params[:transaction],
     :errors => @result && @result.errors.for(:transaction),
     :builder => ApplicationHelper::BraintreeFormBuilder,
     :url => Braintree::TransparentRedirect.url,
     :html => {:autocomplete => "off"} do |f| -%>
  <%= field_set_tag "Customer" do -%>
    <%= f.fields_for :customer do |c| -%>
  <div><%= c.label :first_name, "First Name" %></div>
  <div><%= c.text_field :first_name %></div>
  <div><%= c.label :last_name, "Last Name" %></div>
  <div><%= c.text_field :last_name %></div>
  <div><%= c.label :email, "Email" %></div>
  <div><%= c.text_field :email %></div>
 <% end -%>
 <% end -%>
 <%= field_set_tag "Credit Card" do -%>
 <%= f.fields_for :credit_card do |c| -%>
  <div><%= c.label :number, "Number" %></div>
  <div><%= c.text_field :number %></div>
  <div><%= c.label :expiration_date, "Expiration Date (MM/YY)" %></div>
  <div><%= c.text_field :expiration_date %></div>
  <div><%= c.label :cvv, "CVV" %></div>
  <div><%= c.text_field :cvv %></div>
<% end -%>
<% end -%>
<%= hidden_field_tag :tr_data, Braintree::TransparentRedirect.transaction_data(
   :redirect_url => confirm_payment_url,         
   :transaction => {:type => "sale", :amount => @amount}
    ) %>
  <%= f.submit "Submit" %>
<% end -%>

а вот контроллер платежей

  def confirm

@result = Braintree::TransparentRedirect.confirm(request.query_string)
if @result.success?
  render :action => "confirm"
else
  @amount = calculate_amount
  render :action => "new"
end
end

какие изменения могут привести к такому результату, когда одно приложение rails распознает этот метод, а другое нет? действительно ломаю голову над этим. Спасибо за вашу помощь.


person Andrew    schedule 07.08.2011    source источник
comment
Чем отличаются эти два приложения? Это одни и те же версии Rails?   -  person Devin M    schedule 08.08.2011


Ответы (1)


Вы никогда не определяете confirm_payment_url у вас, скорее всего, есть ошибка в маршрутах ваших приложений, однако сегодня трудно без дополнительной информации.

В документации, предоставленной Braintree для прозрачного перенаправления, кажется, что это URL-адрес, на который вы хотите отправить клиента обратно после обработки платежа, и что confirm_payment_url не предоставляется Braintree. Вы можете ознакомиться с документацией, на которую я ссылаюсь, здесь.

person Devin M    schedule 08.08.2011
comment
да - мои маршруты отсутствовали: match 'payments/confirm' =› 'payments#confirm', :as =› :confirm_payment, что было странно, потому что у меня все еще было совпадение 'payments/new', :to =› 'payments#new' , :as =› :new_payment спасибо за помощь! - person Andrew; 09.08.2011
comment
В любое время рад, что смог помочь. - person Devin M; 09.08.2011