Class: Checkout
Instance Attribute Summary
Attributes inherited from Base
#production, #secret_key, #url
Instance Method Summary collapse
-
#create(data) ⇒ Object
Create Hosted Checkout.
-
#get_info(id) ⇒ Object
Get Hosted Checkout Info.
-
#get_status(id) ⇒ Object
Get Hosted Checkout Status.
-
#list_checkouts(page = 1, limit = 10, order = 'ASC') ⇒ Object
List All Hosted Checkout.
Methods inherited from Base
#base_url, #check_parameters, #get_request, #initialize, #post_request, #put_request
Constructor Details
This class inherits a constructor from Base
Instance Method Details
#create(data) ⇒ Object
Create Hosted Checkout
-
Required Function Parameters:
data: { amount: int , customerEmail: string, notificationEmail: string, callbackUrl: string, successUrl: string, reference: string }
22 23 24 25 26 27 28 |
# File 'lib/bitnob/objects/checkout.rb', line 22 def create(data) required_parameters = %w[amount, customerEmail, notificationEmail, callbackUrl, successUrl, reference] checked_passed_parameters(required_parameters, data) payload = data.to_json post_request("#{base_url}#{BaseEndpoints::CHECKOUT}", payload) end |
#get_info(id) ⇒ Object
Get Hosted Checkout Info
-
Required Function Parameters: id : int
47 48 49 |
# File 'lib/bitnob/objects/checkout.rb', line 47 def get_info(id) get_request("#{base_url}#{BaseEndpoints::CHECKOUT}/info/#{id}") end |
#get_status(id) ⇒ Object
Get Hosted Checkout Status
-
Required Function Parameters: id : int
56 57 58 |
# File 'lib/bitnob/objects/checkout.rb', line 56 def get_status(id) get_request("#{base_url}#{BaseEndpoints::CHECKOUT}/status/#{id}") end |
#list_checkouts(page = 1, limit = 10, order = 'ASC') ⇒ Object
List All Hosted Checkout
-
Optional Function Parameters: page : int limit : int order: string ASC or DESC
37 38 39 40 |
# File 'lib/bitnob/objects/checkout.rb', line 37 def list_checkouts(page=1, limit=10, order='ASC') get_request("#{base_url}#{BaseEndpoints::CHECKOUT}/?order=#{order}&page=#{page}&limit=#{limit}") end |