Class: Easypay::NotificationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Easypay::NotificationsController
- Defined in:
- app/controllers/easypay/notifications_controller.rb
Instance Method Summary collapse
Instance Method Details
#notification_from_payment ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/easypay/notifications_controller.rb', line 35 def notification_from_payment #ep_cin=8103&ep_user=OUTITUDE&ep_doc=TESTOUTITUDE0088690520120712152503 payment_detail = Easypay::Client.new.get_payment_detail("", params[:ep_doc]) @payment_reference = PaymentReference.find_by_ep_reference_and_ep_key(payment_detail[:ep_reference], payment_detail[:t_key]) if @payment_reference.present? and !@payment_reference.ep_status.match('finalized') @payment_reference.update_attributes(:ep_doc => payment_detail[:ep_doc], :ep_payment_type => payment_detail[:ep_payment_type], :ep_value_fixed => payment_detail[:ep_value_fixed], :ep_value_var => payment_detail[:ep_value_var], :ep_value_tax => payment_detail[:ep_value_tax], :ep_value_transf => payment_detail[:ep_value_transf], :ep_date_transf => payment_detail[:ep_date_transf], :ep_date_read => payment_detail[:ep_date_read], :ep_status_read => payment_detail[:ep_status_read], :o_obs => payment_detail[:o_obs], :ep_date => payment_detail[:ep_date], :ep_status => 'finalized') redirect_to payment_notify_url(:payable_id => @payment_reference.payable_id) end end |
#notification_to_forward ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/easypay/notifications_controller.rb', line 17 def notification_to_forward # e=10611&r=810302231&v=7&s=ok&k=C36D4995CBF3574ADD8664BA26514181C9EA8737&t_key=CCCSOKCSO payment_reference = PaymentReference.find_by_ep_reference_and_ep_key(params[:r], params[:t_key]) if params[:s].starts_with? "ok" and params[:k].present? and payment_reference.present? payment_reference.update_attribute(:o_key, params[:k]) unless payment_reference.nil? payment_detail = Easypay::Client.new.request_payment(params[:e], params[:r], params[:v], params[:k]) payment_reference.update_attributes(:ep_last_status => payment_detail[:ep_status], :ep_message => payment_detail[:ep_message]) unless payment_reference.nil? elsif payment_reference.present? payment_reference.update_attribute(:ep_last_status, params[:s]) end redirect_to payment_redirect_url(:status => params[:s], :ep_key => params[:t_key]) end |
#simple_notification ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/easypay/notifications_controller.rb', line 8 def simple_notification # c=PT&e=10611&r=810302231&v=7&l=PT&t_key= @payment_reference = PaymentReference.find_by_ep_reference_and_ep_value(params[:r], params[:v]) @atts = params respond_to do |format| format.xml end end |