class PaymentRecipes::PayPal::SOAP::Action::CaptureAuthorization

Public Instance Methods

capture_id() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 97
def capture_id
  response.do_capture_response_details.payment_info.transaction_id
end
do_capture_authorization() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 68
def do_capture_authorization
  do_capture = api.build_do_capture({
    :AuthorizationID => authorization_id,
    :Amount => amount,
    :CompleteType => "Complete" })

  store(:do_capture_response) do
    capture_response = api.do_capture(do_capture)

    unless capture_response.success?
      @error = capture_response.errors

      capture_response = nil
    end

    capture_response
  end
end
load_transaction() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 87
def load_transaction
  store(:authorization_transaction) do
    ::PaymentRecipes::PayPal::SOAP::Transaction.find(authorization_id)
  end

  store(:capture_transaction) do
    ::PaymentRecipes::PayPal::SOAP::Transaction.find(capture_id)
  end
end
perform() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 46
def perform
  prepare_soap_api

  do_capture_authorization

  if response.success?
    load_transaction
  end

  response
end
prepare_soap_api() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 58
def prepare_soap_api
  store(:api) do
    ::PaymentRecipes::PayPal::SOAP::Settings.api
  end
end
response() click to toggle source
# File lib/payment_recipes/paypal/soap/action/capture_authorization.rb, line 64
def response
  do_capture_response
end