Sha256: 8e2c18ca5698b6fb1bce779ea6e631184e7d1d759df7a95ab94ec082e1f91492

Contents?: true

Size: 914 Bytes

Versions: 3

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

require "bigdecimal/util"
require "securerandom"
require "rqrcode"
# require "debug"
require "ac"

require_relative "inter_api/version"
require "inter_api/client_production"
require "inter_api/payment"
require "inter_api/payment_error"

module InterApi
  class Error < StandardError; end

  class ClientTeste < ClientProduction
    BASE_URL = "https://cdpj-sandbox.partners.uatinter.co/"

    def pay_pix payment_id, amount
      body = {
        valor: format("%.2f", amount)
      }
      response = post("/pix/v2/cob/pagar/#{payment_id}", headers: build_headers, sslcert: @crt, sslkey: @key, body: JSON.dump(body)) { |response| validate_response(response, "e2e") }
      response.json
    end
  end

  class Client
    def self.new **args
      if args.delete(:test_mode)
        ClientTeste.new(**args)
      else
        ClientProduction.new(**args)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
inter_api-1.2.2 lib/inter_api.rb
inter_api-1.2.1 lib/inter_api.rb
inter_api-1.2.0 lib/inter_api.rb