Class: Payr::BillsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Payr::BillsController
- Defined in:
- app/controllers/payr/bills_controller.rb
Instance Method Summary collapse
Instance Method Details
#cancelled ⇒ Object
33 34 35 |
# File 'app/controllers/payr/bills_controller.rb', line 33 def cancelled change_status params[:ref], Payr::Bill::CANCELLED, params[:error] end |
#failure ⇒ Object
48 49 50 |
# File 'app/controllers/payr/bills_controller.rb', line 48 def failure change_status params[:ref], Payr::Bill::SIGN_ERROR, params[:error] end |
#ipn ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/payr/bills_controller.rb', line 37 def ipn if params[:error] == Payr::Bill::NO_ERROR change_status params[:ref], Payr::Bill::PAID @bill.update_attribute(:error_code, Payr::Bill::NO_ERROR) else @bill = Payr::Bill.find(params[:ref]) @bill.update_attribute(:error_code, params[:error]) end render nothing: true, :status => 200, :content_type => 'text/html' end |
#paid ⇒ Object
25 26 27 |
# File 'app/controllers/payr/bills_controller.rb', line 25 def paid change_status params[:ref], Payr::Bill::PAID end |
#pay ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/payr/bills_controller.rb', line 5 def pay @bill = Payr::Bill.new(buyer_id: params[:buyer][:id], amount: params[:total_price], article_id: params[:article_id], state: Payr::Bill::UNPROCESSED, bill_reference: params[:bill_reference]) @payr = Payr::Client.new if @bill.save @paybox_params = @payr.get_paybox_params_from command_id: @bill.id, buyer_email: params[:buyer][:email], total_price: params[:total_price], callbacks: { paid: payr_bills_paid_url, refused: payr_bills_refused_url, cancelled: payr_bills_cancelled_url, ipn: payr_bills_ipn_url } end end |