Class: Spree::PaypalExpressCallbacksController

Inherits:
BaseController
  • Object
show all
Includes:
ActiveMerchant::Billing::Integrations
Defined in:
app/controllers/spree/paypal_express_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#notifyObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/spree/paypal_express_callbacks_controller.rb', line 8

def notify
  retrieve_details #need to retreive details first to ensure ActiveMerchant gets configured correctly.


  @notification = Paypal::Notification.new(request.raw_post)

  # we only care about eChecks (for now?)
  if @notification.params["payment_type"] == "echeck" && @notification.acknowledge && @payment && @order.total >= @payment.amount
    @payment.started_processing!
    @payment.log_entries.create(:details => @notification.to_yaml)

    case @notification.params["payment_status"]
      when "Denied"
        @payment.failure!

      when "Completed"
        @payment.complete!
    end

  end

  render :nothing => true
end