Class: Payments::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/payments/cli.rb

Constant Summary collapse

CLIENT =
Client.v1

Instance Method Summary collapse

Instance Method Details

#get_account_donation_transaction_detail_report(settlement_id, account_id) ⇒ Object



31
32
33
34
35
# File 'lib/payments/cli.rb', line 31

def (settlement_id, )
  response = CLIENT.(settlement_id, )

  pp response.body.map(&:to_hash)
end

#get_donation_transaction_detail_report(settlement_id) ⇒ Object



24
25
26
27
28
# File 'lib/payments/cli.rb', line 24

def get_donation_transaction_detail_report(settlement_id)
  response = CLIENT.get_donation_transaction_detail_report(settlement_id)

  pp response.body.map(&:to_hash)
end

#get_merchant(merchant_id) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/payments/cli.rb', line 10

def get_merchant(merchant_id)
  response = CLIENT.get_merchant(merchant_id)
  response = response.body

  table = []
  table << ["ID", response.merchant_id]
  table << ["Name", response.name]
  table << ["Region Code", response.region_code]
  table << ["Financial Contexts", response.financial_context_ids.join(", ")]

  print_table table
end

#get_pricing_schedule(financial_context_id, merchant_id) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/payments/cli.rb', line 50

def get_pricing_schedule(financial_context_id, merchant_id)
  response = CLIENT.get_pricing_schedule(financial_context_id, merchant_id)

  table = []
  table << ["Financial Context", financial_context_id]
  table << ["Merchant", merchant_id]

  print_table table
end

#get_receipt_number(order_id) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/payments/cli.rb', line 38

def get_receipt_number(order_id)
  response = CLIENT.get_receipt_number(order_id)

  table = []
  table << ["Region Code", response.region_code]
  table << ["Receipt Number", response.receipt_number]
  table << ["Order ID", response.order_id]

  print_table table
end