Class: Bills

Inherits:
Base show all
Defined in:
lib/flutterwave_sdk/flutterwave_objects/bills.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

#create_bill_payment(data) ⇒ Object



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

def create_bill_payment(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["country", "customer", "amount", "recurrence", "type"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/bills", payload) 
    return response
end

#create_bulk_bill_payments(data) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 15

def create_bulk_bill_payments(data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["bulk_reference", "callback_url", "bulk_data"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/bulk-bills", payload) 
    return response
end

#create_order_using_billing_code_and_productid(id, product_id, data) ⇒ Object



79
80
81
82
83
84
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 79

def create_order_using_billing_code_and_productid(id, product_id, data)
    base_url = flutterwave_object.base_url 
    payload = data.to_json
    response = post_request("#{base_url}/biller/#{id}/products/#{product_id}/orders", payload) 
    return response
end

#get_amount_for_a_product(id, product_id) ⇒ Object



60
61
62
63
64
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 60

def get_amount_for_a_product(id, product_id)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/billers/#{id}/products/#{product_id}")
    return response
end

#get_bill_categoriesObject



48
49
50
51
52
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 48

def get_bill_categories
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/bill-categories")
    return response
end

#get_bill_payment_agenciesObject



54
55
56
57
58
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 54

def get_bill_payment_agencies
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/billers")
    return response
end

#get_bill_payments(data) ⇒ Object



66
67
68
69
70
71
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 66

def get_bill_payments(data)
    base_url = flutterwave_object.base_url
    payload = data.to_json
    response = get_request("#{base_url}/bills", payload)
    return response
end

#get_products_under_an_agency(id) ⇒ Object



73
74
75
76
77
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 73

def get_products_under_an_agency(id)
    base_url = flutterwave_object.base_url
    response = get_request("#{base_url}/billers/#{id}/products")
    return response
end

#get_status_of_a_bill_payment(reference) ⇒ Object



24
25
26
27
28
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 24

def get_status_of_a_bill_payment(reference)
    base_url = flutterwave_object.base_url 
    response = get_request("#{base_url}/bills/#{reference}") 
    return response
end

#update_bills_order(reference, data) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 30

def update_bills_order(reference, data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["bulk_reference", "callback_url", "bulk_data"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/product-orders/#{reference}", payload) 
    return response
end

#validate_bill_service(item_code, data) ⇒ Object



39
40
41
42
43
44
45
46
# File 'lib/flutterwave_sdk/flutterwave_objects/bills.rb', line 39

def validate_bill_service(item_code, data)
    base_url = flutterwave_object.base_url 
    required_parameters = ["code", "customer"]
    check_passed_parameters(required_parameters, data)
    payload = data.to_json
    response = post_request("#{base_url}/bill-items/#{item_code}/validate", payload) 
    return response
end