Module: RockRMS::Client::PaymentDetail

Included in:
RockRMS::Client
Defined in:
lib/rock_rms/resources/payment_detail.rb

Instance Method Summary collapse

Instance Method Details

#create_payment_detail(payment_type:, foreign_key: nil, card_type: nil, last_4: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rock_rms/resources/payment_detail.rb', line 9

def create_payment_detail(payment_type:, foreign_key: nil, card_type: nil, last_4: nil)
  options = {
    'CurrencyTypeValueId' => cast_payment_type(payment_type),
    'CreditCardTypeValueId' => cast_card_type(card_type),
    'ForeignKey' => foreign_key
  }
  options['AccountNumberMasked'] = "************#{last_4}" if last_4

  post(payment_detail_path, options)
end

#delete_payment_detail(id) ⇒ Object



30
31
32
# File 'lib/rock_rms/resources/payment_detail.rb', line 30

def delete_payment_detail(id)
  delete(payment_detail_path(id))
end

#list_payment_details(options = {}) ⇒ Object



4
5
6
7
# File 'lib/rock_rms/resources/payment_detail.rb', line 4

def list_payment_details(options = {})
  res = get(payment_detail_path, options)
  Response::PaymentDetail.format(res)
end

#update_payment_detail(id, foreign_key: nil, card_type: nil, last_4: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/rock_rms/resources/payment_detail.rb', line 20

def update_payment_detail(id, foreign_key: nil, card_type: nil, last_4: nil)
  options = {}

  options['CreditCardTypeValueId'] = cast_card_type(card_type) if card_type
  options['ForeignKey'] = foreign_key if foreign_key
  options['AccountNumberMasked'] = "************#{last_4}" if last_4

  patch(payment_detail_path(id), options)
end