Class: Zspay::Sale
Overview
The Sale class manages sale-related actions within the Zspay platform. It provides methods to create a sale, retrieve sale details, and refund a sale, extending the functionality from Zspay::Resource.
Class Method Summary collapse
-
.create(sale, custom_token = nil) ⇒ OpenStruct
Creates a new sale on the Zspay platform.
-
.refund(sale_id, custom_token = nil) ⇒ OpenStruct
Processes a refund for a specific sale.
-
.show(sale_id, custom_token = nil) ⇒ OpenStruct
Retrieves details of a specific sale.
Methods inherited from Resource
delete, endpoint, get, headers, parse_body, parse_json, patch, post, put, req, req_form, req_json, success_request?
Class Method Details
.create(sale, custom_token = nil) ⇒ OpenStruct
Creates a new sale on the Zspay platform.
14 15 16 |
# File 'lib/zspay/resources/sale.rb', line 14 def create(sale, custom_token = nil) post("/vendas", sale, custom_token) end |
.refund(sale_id, custom_token = nil) ⇒ OpenStruct
Processes a refund for a specific sale.
This method sends a request to refund a previously made sale. The sale is identified by its unique ID.
34 35 36 |
# File 'lib/zspay/resources/sale.rb', line 34 def refund(sale_id, custom_token = nil) post("/vendas/#{sale_id}/estornar", {}, custom_token) end |
.show(sale_id, custom_token = nil) ⇒ OpenStruct
Retrieves details of a specific sale.
23 24 25 |
# File 'lib/zspay/resources/sale.rb', line 23 def show(sale_id, custom_token = nil) get("/vendas/#{sale_id}", custom_token) end |