Class: MidasClient::Management
- Defined in:
- lib/midas_client/management.rb
Constant Summary
Constants included from EndPoints
EndPoints::DEVELOPMENT, EndPoints::MANAGEMENTS, EndPoints::OPERATIONS, EndPoints::PRODUCTION, EndPoints::QUERIES, EndPoints::SUBSCRIPTIONS
Instance Attribute Summary
Attributes inherited from Request
#environment, #login, #password, #query, #subscription, #transaction
Attributes included from Util
Class Method Summary collapse
-
.create_pos(code, description) ⇒ Object
This method creates an POS in midas.
-
.list_pos ⇒ Object
This method LIST all POS in MIDAS.
Methods inherited from Request
#base_result, external_request, #initialize, #request
Methods included from EndPoints
#get_env, #get_environment, #production?, #set_env
Methods included from Util
#error_log, #log, #sanitize_pci
Constructor Details
This class inherits a constructor from MidasClient::Request
Class Method Details
.create_pos(code, description) ⇒ Object
This method creates an POS in midas.
This is a is synchronous operation, using method POST
Params:
code: string - Represents the name of the POS
description: string - Description about the POS
Response:
result: {
success: true/false
code: "XXX"
message: "Some message to you"
},
accessToken: "3Lpv2ecaeBa4Kffuf0CbWfF1j6I5eg=="
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/midas_client/management.rb', line 61 def self.create_pos(code, description) # define o método de envio da requisição method = :post # monta a URL de chamada da requisição endpoint = get_env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:create_pos] # monta os parâmetros da requisição na url params = { code: code, description: description} # monta authorization base64 no header headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]} # faz a chamada a plataforma de pagamento (MIDAS) external_request(method, endpoint, params, headers) end |
.list_pos ⇒ Object
This method LIST all POS in MIDAS.
This is a is synchronous operation, using method GET
Params:
None
Response: { “result”:
"success": true,
"code": "000",
"message": "Sucesso"
,
"pointsOfSale": [
{
"code": "pdv01",
"description": "PDV de Teste 1 (Cielo)"
},
{
"code": "pdv02",
"description": "PDV de Teste 2 (Stone)"
}]
}
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/midas_client/management.rb', line 30 def self.list_pos() # define o método de envio da requisição method = :get # monta a URL de chamada da requisição endpoint = get_env[:url] + EndPoints::MANAGEMENTS[:context] + EndPoints::MANAGEMENTS[:list_pos] # monta authorization base64 no header headers={content_type: :json, accept: :json, authorization: get_env[:management_auth]} # faz a chamada a plataforma de pagamento (MIDAS) external_request(method, endpoint, {}, headers) end |