Sha256: a3f23f1f4a33bf39ecb77dbb3332dec5467ca444a1dd337f674139db8fbf4ab8

Contents?: true

Size: 611 Bytes

Versions: 3

Compression:

Stored size: 611 Bytes

Contents

module Bs2Api
  module Payment
    class Detail < Base
      attr_reader :success

      def initialize payment_id
        @payment_id = payment_id
      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)
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bs2_api-1.2.2 lib/bs2_api/payment/detail.rb
bs2_api-1.2.1 lib/bs2_api/payment/detail.rb
bs2_api-1.2.0 lib/bs2_api/payment/detail.rb