Sha256: 1f303f46e604791d7c4f72b4f81b1ad9d915ba96b2d62d3b851ea72013fa204a
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
module Bs2Api module Payment class Detail < Base attr_reader :success def initialize( payment_id, client_id: Bs2Api.configuration.client_id, client_secret: Bs2Api.configuration.client_secret, proxy: nil ) @payment_id = payment_id @client_id = client_id @client_secret = client_secret @proxy = proxy end def call response = detail_request raise Bs2Api::Errors::BadRequest, ::Util::Response.parse_error(response) unless response.ok? Bs2Api::Entities::Payment.from_response(response) end private def url "#{Bs2Api.endpoint}/pix/direto/forintegration/v1/pagamentos/#{@payment_id}" end def detail_request HTTParty.get( url, headers: headers, http_proxyaddr: @proxy&.host, http_proxyport: @proxy&.port, http_proxyuser: @proxy&.user, http_proxypass: @proxy&.password ) end def bearer_token Bs2Api::Request::Auth.token( client_id: @client_id, client_secret: @client_secret ) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems