Class: PaymentPlan

Inherits:
Base
  • Object
show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb

Instance Attribute Summary

Attributes inherited from Base

#flutterwave_object

Instance Method Summary collapse

Methods inherited from Base

#check_passed_parameters, #delete_request, #get_request, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from Base

Instance Method Details

#cancel_payment_plan(id) ⇒ Object



35
36
37
38
39
40
41
# File 'lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb', line 35

def cancel_payment_plan(id)
    base_url = flutterwave_object.base_url
    payload = {}
    payload = payload.to_json
    response = put_request("#{base_url}/payment-plans/#{id}/cancel",payload)
    return response
end

#create_payment_plan(data) ⇒ Object

method to create a payment plan



7
8
9
10
11
12
13
14
# File 'lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb', line 7

def create_payment_plan(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["amount", "name", "interval"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/payment-plans", payload) 
    return response
end

#get_a_payment_plan(id) ⇒ Object



22
23
24
25
26
# File 'lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb', line 22

def get_a_payment_plan(id)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/payment-plans/#{id}")
    return response
end

#get_payment_plansObject



16
17
18
19
20
# File 'lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb', line 16

def get_payment_plans
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/payment-plans")
    return response
end

#update_payment_plan(id, data) ⇒ Object



28
29
30
31
32
33
# File 'lib/flutterwave_sdk/flutterwave_objects/payment_plan.rb', line 28

def update_payment_plan(id, data)
    base_url = flutterwave_object.base_url 
    payload = data.to_json
    response = put_request("#{base_url}/payment-plans/#{id}",payload)
    return response
end