module Picpay::Request

Attributes

authorization_id[RW]

Public Instance Methods

headers() click to toggle source
# File lib/picpay/request.rb, line 11
def headers
  header = {
      'Content-Type' => 'application/json',
      'x-picpay-token' => picpay_token,
  }
end
headers_seller() click to toggle source
# File lib/picpay/request.rb, line 18
def headers_seller
  header = {
      'Content-Type' => 'application/json',
      'x-seller-token' => seller_token,
  }
end
payments() click to toggle source
# File lib/picpay/request.rb, line 25
def payments
  begin
    response = Faraday.post(api_url, data_payment.to_json, headers)
    response
  rescue Faraday::Error::ConnectionFailed => error
    error.message.inspect
  end
end
payments_cancellations(reference_id, authorization_id) click to toggle source
# File lib/picpay/request.rb, line 34
def payments_cancellations(reference_id, authorization_id)
  begin
    url = "#{api_url}/#{reference_id}/cancellations"
    response = Faraday.post(url, {authorizationId: authorization_id}.to_json, headers)
    response
  rescue Faraday::Error::ConnectionFailed => error
    error.message.inspect
  end
end
payments_status(reference_id) click to toggle source
# File lib/picpay/request.rb, line 44
def payments_status(reference_id)
  begin
    url = "#{api_url}/#{reference_id}/status"
    response = Faraday.get(url, {}, headers)
    response
  rescue Faraday::Error::ConnectionFailed => error
    error.message.inspect
  end
end