Class: PaymentRecipes::PayPal::REST::Action::RefundSale

Inherits:
Utils::Action
  • Object
show all
Defined in:
lib/payment_recipes/paypal/rest/action/refund_sale.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
# File 'lib/payment_recipes/paypal/rest/action/refund_sale.rb', line 8

def perform
  if @sale.can_be_refunded?
    @sale.raw_sale.refund({})

    @sale.reload!
    @sale.reload_payment!
  else
    raise Exception, "Sale can't be refunded"
  end

  @sale
end