class MidasClient::Management

Public Class Methods

create_pos(code, description) click to toggle source

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=="
# 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() click to toggle source

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)"
   }]
}
# 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