Class: Leetchi::RecurrentContribution

Inherits:
Ressource
  • Object
show all
Defined in:
lib/leetchi/recurrent_contribution.rb

Overview

Recurrent Contribution are available in test environment only, soon in production.

Class Method Summary collapse

Class Method Details

.create(data) ⇒ Object

Create a recurrent contribution

  • Args :

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * [Tag]
      * UserID
      * WalletID
      * Amount
      * [ClientFeeAmount]
      * ReturnURL
      * [TemplateURL]
      * StartDate
      * FrequencyCode
      * NumberOfExecutions
      
  • Returns :

    • A recurrent contribution object



23
24
25
# File 'lib/leetchi/recurrent_contribution.rb', line 23

def self.create(data)
  post_request('recurrent-contributions', data)
end

.get(recurrent_contributions_id) ⇒ Object

Get a recurrent contribution

  • Args :

    • recurrent_contributions_id -> The id of the recurrent contribution you want to retrieve

  • Returns :

    • A recurrent contribution object



34
35
36
# File 'lib/leetchi/recurrent_contribution.rb', line 34

def self.get(recurrent_contributions_id)
  get_request(File.join('recurrent-contributions', recurrent_contributions_id.to_s))
end

.get_executions(recurrent_contributions_id) ⇒ Object

Fetch the list of a recurrent contribution executions

  • Args :

    • recurrent_contributions_id -> The id of the recurrent contribution you want to retrieve operations from

  • Returns :

    • An array of payment execution



58
59
60
# File 'lib/leetchi/recurrent_contribution.rb', line 58

def self.get_executions(recurrent_contributions_id)
  get_request(File.join('recurrent-contributions', recurrent_contributions_id.to_s, 'executions'))
end

.update(recurrent_contributions_id, data) ⇒ Object

Update a recurrent contribution

  • Args :

    • data -> A JSON with the following attributes (Square brackets for optionals):

      * IsEnabled
      * [Tag]
      
  • Returns :

    • A recurrent contribution object



47
48
49
# File 'lib/leetchi/recurrent_contribution.rb', line 47

def self.update(recurrent_contributions_id, data)
  put_request(File.join('recurrent-contributions', recurrent_contributions_id.to_s), data)
end