Class: Pike13::CLI::Commands::Desk::Payment

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/cli/commands/desk/payment.rb

Instance Method Summary collapse

Methods inherited from Base

base_usage, format_options, handle_argument_error, printable_commands

Methods included from ThorNestedSubcommand

included

Instance Method Details

#configurationObject



19
20
21
22
23
24
# File 'lib/pike13/cli/commands/desk/payment.rb', line 19

def configuration
  handle_error do
    result = Pike13::Desk::Payment.configuration
    output(result)
  end
end

#get(id) ⇒ Object



10
11
12
13
14
15
# File 'lib/pike13/cli/commands/desk/payment.rb', line 10

def get(id)
  handle_error do
    result = Pike13::Desk::Payment.find(id)
    output(result)
  end
end

#void(payment_id) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pike13/cli/commands/desk/payment.rb', line 29

def void(payment_id)
  handle_error do
    invoice_item_ids_to_cancel = options[:invoice_item_ids] || []
    result = Pike13::Desk::Payment.void(
      payment_id: payment_id,
      invoice_item_ids_to_cancel: invoice_item_ids_to_cancel
    )
    output(result)
    success_message "Payment #{payment_id} voided successfully"
  end
end