Class: PaymentPlan
- Inherits:
-
PaymentPlanBase
- Object
- Base
- PaymentPlanBase
- PaymentPlan
- Defined in:
- lib/rave_ruby/rave_objects/payment_plan.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #cancel_payment_plan(id) ⇒ Object
-
#create_payment_plan(data) ⇒ Object
method to create a payment plan.
- #edit_payment_plan(id, data) ⇒ Object
- #fetch_payment_plan(id, q = nil) ⇒ Object
- #list_payment_plans ⇒ Object
Methods inherited from PaymentPlanBase
#handle_cancel_response, #handle_create_response, #handle_edit_response, #handle_fetch_response, #handle_list_response
Methods inherited from Base
#check_passed_parameters, #get_request, #handle_list_bank, #initialize, #post_request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#cancel_payment_plan(id) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rave_ruby/rave_objects/payment_plan.rb', line 37 def cancel_payment_plan(id) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup payload = { "seckey" => secret_key, } payload = payload.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::PAYMENT_PLANS_ENDPOINT}/#{id}/cancel",payload) return handle_cancel_response(response) end |
#create_payment_plan(data) ⇒ Object
method to create a payment plan
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rave_ruby/rave_objects/payment_plan.rb', line 8 def create_payment_plan(data) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup data.merge!({"seckey" => secret_key.dup}) required_parameters = ["amount", "name", "interval"] check_passed_parameters(required_parameters, data) payload = data.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::PAYMENT_PLANS_ENDPOINT}/create", payload) return handle_create_response(response) end |
#edit_payment_plan(id, data) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rave_ruby/rave_objects/payment_plan.rb', line 50 def edit_payment_plan(id, data) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup data.merge!({"seckey" => secret_key.dup}) payload = data.to_json response = post_request("#{base_url}#{BASE_ENDPOINTS::PAYMENT_PLANS_ENDPOINT}/#{id}/edit",payload) return handle_edit_response(response) end |
#fetch_payment_plan(id, q = nil) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/rave_ruby/rave_objects/payment_plan.rb', line 29 def fetch_payment_plan(id,q=nil ) base_url = rave_object.base_url secret_key = rave_object.secret_key.dup response = get_request("#{base_url}#{BASE_ENDPOINTS::PAYMENT_PLANS_ENDPOINT}/query",{"seckey" => rave_object.secret_key.dup, "id" => id, "q": q}) return handle_fetch_response(response) end |
#list_payment_plans ⇒ Object
23 24 25 26 27 |
# File 'lib/rave_ruby/rave_objects/payment_plan.rb', line 23 def list_payment_plans base_url = rave_object.base_url response = get_request("#{base_url}#{BASE_ENDPOINTS::PAYMENT_PLANS_ENDPOINT}/query",{"seckey" => rave_object.secret_key.dup}) return handle_list_response(response) end |