Class: PinPays::Charges
Constant Summary collapse
- PATH =
'/charges'
Constants inherited from Api
Class Method Summary collapse
-
.capture(charge_token) ⇒ Object
Captures a previously authorized charge.
-
.create(options) ⇒ Object
Create a charge for a customer or card Options (hash) containing: (mandatory) email, description, amount, and remote_ip (mandatory, one of) customer_token, card_token, or card (a hash of card details) (optional) currency, capture.
-
.list(page = nil) ⇒ Object
Lists all charges Page - the page number to return (optional).
-
.search(criteria) ⇒ Object
Search for charges that match one or more criteria Criteria - a hash of search criteria.
-
.show(charge_token) ⇒ Object
Retrieve details of a specific charge.
Methods inherited from Api
Class Method Details
.capture(charge_token) ⇒ Object
Captures a previously authorized charge
17 18 19 |
# File 'lib/pin_pays/charges.rb', line 17 def capture(charge_token) api_response(api_put("#{PATH}/#{charge_token}/capture")) end |
.create(options) ⇒ Object
Create a charge for a customer or card Options (hash) containing:
(mandatory) email, description, amount, and remote_ip
(mandatory, one of) customer_token, card_token, or card (a hash of card details)
(optional) currency, capture
12 13 14 |
# File 'lib/pin_pays/charges.rb', line 12 def create() api_response(api_post(PATH, )) end |
.list(page = nil) ⇒ Object
Lists all charges Page - the page number to return (optional)
23 24 25 26 |
# File 'lib/pin_pays/charges.rb', line 23 def list(page = nil) = (page.nil? ? nil : { page: page }) api_paginated_response(api_get(PATH, )) end |
.search(criteria) ⇒ Object
Search for charges that match one or more criteria Criteria - a hash of search criteria
30 31 32 |
# File 'lib/pin_pays/charges.rb', line 30 def search(criteria) api_paginated_response(api_get("#{PATH}/search", criteria)) end |
.show(charge_token) ⇒ Object
Retrieve details of a specific charge
35 36 37 |
# File 'lib/pin_pays/charges.rb', line 35 def show(charge_token) api_response(api_get("#{PATH}/#{charge_token}")) end |