Class: SlimpayClient::DirectDebit

Inherits:
Resource show all
Defined in:
lib/slimpay_client/direct_debit.rb

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Methods inherited from Base

#generate_api_methods, #initialize

Constructor Details

This class inherits a constructor from SlimpayClient::Resource

Instance Method Details

#get_one(reference = 1) ⇒ Object

Override the Resource#get_one method because the url is not the same for DirectDebits



5
6
7
8
9
10
# File 'lib/slimpay_client/direct_debit.rb', line 5

def get_one(reference = 1)
  url = "#{@endpoint}/#{@resource_name}/#{reference}"
  response = HTTParty.get(url, headers: options)
  generate_api_methods(JSON.parse(response.body))
  SlimpayClient.answer(response)
end

#make_payment(debit_hash = default_debit_hash) ⇒ Object

Alias method for create_direct_debits

Arguments
debit_hash: (Hash) Your payment informations. See API DirectDebit documentation for details.

/!\ Amount as to be rounded to maximum 2 numbers after comma.
If not you'll receive an error : { "code" : 100, "message" : "Internal error : Rounding necessary" }


18
19
20
# File 'lib/slimpay_client/direct_debit.rb', line 18

def make_payment(debit_hash = default_debit_hash)
  self.create_direct_debits(debit_hash)
end