Class: PaymentRecipes::PayPal::REST::Action::CaptureAuthorization

Inherits:
Utils::Action
  • Object
show all
Defined in:
lib/payment_recipes/paypal/rest/action/capture_authorization.rb

Instance Method Summary collapse

Methods inherited from Utils::Action

#debug, debug, #ensure_presence, #execute, #failure?, #get, #initialize, #make_instance_variables_available, prepare, rules, #set, #store, #stored_variables, #success?, variable

Constructor Details

This class inherits a constructor from PaymentRecipes::Utils::Action

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/payment_recipes/paypal/rest/action/capture_authorization.rb', line 8

def perform
  if @authorization.can_be_captured?
    currency = @authorization.currency
    total = @authorization.total.to_s

    @authorization.raw_authorization.capture({:amount => { :currency => currency, :total => total } })

    @authorization.reload!
    @authorization.reload_payment!
  else
    raise Exception, "Authorization can't be captured"
  end

  @authorization
end