Class: Unit::Resource::CheckPaymentResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Unit::Resource::CheckPaymentResource
- Defined in:
- lib/unit/api_resources/check_payment_resource.rb
Class Method Summary collapse
-
.approve_payment_verification(payment_id) ⇒ UnitResponse, UnitError
Approve Check Payment Additional Verification by calling Unit’s API.
-
.cancel_payment(payment_id) ⇒ UnitResponse, UnitError
Cancel check payment.
-
.get(params) ⇒ UnitResponse, UnitError
Get a check payment by id by calling Unit’s API.
-
.get_image(request) ⇒ UnitResponse, UnitError
Get a check payment image by calling Unit’s API.
-
.list(params = nil) ⇒ UnitResponse, UnitError
Get a list of check payments by calling Unit’s API.
-
.originate_payment(request) ⇒ UnitResponse, UnitError
Originate a check payment by calling Unit’s API.
-
.return_payment(request) ⇒ UnitResponse, UnitError
Return a check payment by calling Unit’s API.
Methods inherited from BaseResource
file_response_handler, response_handler
Class Method Details
.approve_payment_verification(payment_id) ⇒ UnitResponse, UnitError
Approve Check Payment Additional Verification by calling Unit’s API
60 61 62 63 64 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 60 def approve_payment_verification(payment_id) payload = { data: { type: "additionalVerification" } }.to_json response = HttpHelper.post("#{api_url}/check-payments/#{payment_id}/approve", body: payload, headers: headers) response_handler(response) end |
.cancel_payment(payment_id) ⇒ UnitResponse, UnitError
Cancel check payment
69 70 71 72 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 69 def cancel_payment(payment_id) response = HttpHelper.post("#{api_url}/check-payments/#{payment_id}/cancel", headers: headers) response_handler(response) end |
.get(params) ⇒ UnitResponse, UnitError
Get a check payment by id by calling Unit’s API
25 26 27 28 29 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 25 def get(params) payload = params.to_hash response = HttpHelper.get("#{api_url}/check-payments/#{params.payment_id}", params: payload, headers: headers) response_handler(response) end |
.get_image(request) ⇒ UnitResponse, UnitError
Get a check payment image by calling Unit’s API
42 43 44 45 46 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 42 def get_image(request) side = request.is_front_side ? "front" : "back" response = HttpHelper.get("#{api_url}/check-payments/#{request.payment_id}/#{side}", headers: headers, response_type: "image") file_response_handler(response) end |
.list(params = nil) ⇒ UnitResponse, UnitError
Get a list of check payments by calling Unit’s API
34 35 36 37 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 34 def list(params = nil) response = HttpHelper.get("#{api_url}/check-payments", params: params.to_hash, headers: headers) response_handler(response) end |
.originate_payment(request) ⇒ UnitResponse, UnitError
Originate a check payment by calling Unit’s API
16 17 18 19 20 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 16 def originate_payment(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/check-payments", body: payload, headers: headers) response_handler(response) end |
.return_payment(request) ⇒ UnitResponse, UnitError
Return a check payment by calling Unit’s API
51 52 53 54 55 |
# File 'lib/unit/api_resources/check_payment_resource.rb', line 51 def return_payment(request) payload = request.to_json_api response = HttpHelper.post("#{api_url}/check-payments/#{request.payment_id}/return", body: payload, headers: headers) response_handler(response) end |