Class: InterApi::ClientTeste

Inherits:
ClientProduction show all
Defined in:
lib/inter_api.rb

Constant Summary collapse

BASE_URL =
"https://cdpj-sandbox.partners.uatinter.co/"

Constants inherited from ClientProduction

InterApi::ClientProduction::MAX_RETIES, InterApi::ClientProduction::SAVE_RESPONSES

Instance Attribute Summary

Attributes inherited from ClientProduction

#chave_pix, #client_id, #client_secret, #conta_corrente, #crt, #key, #scopes, #token, #token_expires_at

Instance Method Summary collapse

Methods inherited from ClientProduction

#authenticate!, #create_payment, #create_payment_request, #get_payment, #get_payment_request, #get_refund, #get_webhook, #initialize, #refund_payment, #update_payment, #update_payment_request, #update_webhook

Constructor Details

This class inherits a constructor from InterApi::ClientProduction

Instance Method Details

#pay_pix(payment_id, amount) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/inter_api.rb', line 22

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