2013-04-01 28 views
0

我希望有人能幫我解決這個問題,這讓我陷入困境。 我在我的Rails應用程序中使用ActiveMerchant處理購物車交易與貝寶網關。通過ActiveMerchant(付款專業版)將商品數據傳遞給PayPal

交易成功,但是當我查看我的PayPal帳戶中的歷史記錄時,沒有關於與交易相關的項目的信息。偶爾會有一個項目數據會出現,但大多數情況下,細節中不會顯示任何項目。

這裏發生的事情在我結賬控制器:

def process_order    
    @items = Array.new  

    @donations.each do |d| 
     item = Hash.new   
     item[:name] = d.project.title 
     item[:quantity] = 1 
     item[:description] = "Donation from website" 
     item[:amount] = (d.pledge.to_i*100).round 
     @items << item 
    end 

    @response = GATEWAY.purchase(price_in_cents, credit_card, purchase_options) 
    if @response.success? 
     @validTransaction = true 
    end 
end 

private 

def purchase_options  
    { 
    :items => @items,  
    :ip => request.remote_ip, 
    :billing_address => { 
    :name  => params[:first_name], 
    :address1 => params[:last_name], 
    :city  => params[:city], 
    :state => params[:state], 
    :country => params[:country], 
    :zip  => params[:zip] 
    } 
    } 
end 

def validate_card 
    unless credit_card.valid? 
    credit_card.errors.full_messages.each do |message| 
     @errors += message + "<br/>" 
    end 
    end 
end 

def credit_card 
    @credit_card ||= ActiveMerchant::Billing::CreditCard.new(
    :brand    => params[:card_type], 
    :number    => params[:card_number], 
    :verification_value => params[:card_verification], 
    :month    => params[:date][:month], 
    :year    => params[:date][:year], 
    :first_name   => params[:first_name], 
    :last_name   => params[:last_name] 
) 
end 

我想這是所有相關的東西在那裏,因此,如果任何人都可以明白爲什麼這是行不通的,它會非常感激。

謝謝!

回答

0

我遇到了類似這樣的問題,這是因爲我將HTML代碼傳遞給「description」值(我的描述存儲HTML代碼)。我通過用我自己的靜態替換HTML標記的描述來解決它,並且它工作正常。

你可能想要測試更多的靜態數據,看看是什麼導致問題具體,如果你還沒有解決問題已經

相關問題