Sha256: 67012afd5458d6431d30d936227ac852f10bb3c873fdaf8f8c411ba7b512a11e

Contents?: true

Size: 610 Bytes

Versions: 8

Compression:

Stored size: 610 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

8 entries across 8 versions & 1 rubygems

Version Path
bs2_api-1.1.7 lib/bs2_api/payment/detail.rb
bs2_api-1.1.6 lib/bs2_api/payment/detail.rb
bs2_api-1.1.5 lib/bs2_api/payment/detail.rb
bs2_api-1.1.4 lib/bs2_api/payment/detail.rb
bs2_api-1.1.3 lib/bs2_api/payment/detail.rb
bs2_api-1.1.2 lib/bs2_api/payment/detail.rb
bs2_api-1.1.1 lib/bs2_api/payment/detail.rb
bs2_api-1.1.0 lib/bs2_api/payment/detail.rb