Class: PagSeguro::Authorizations

Inherits:
Object
  • Object
show all
Includes:
Restful
Defined in:
lib/pagseguro/authorizations.rb

Constant Summary collapse

PERMISSIONS =
{
  checkouts:            "CREATE_CHECKOUTS",
  notifications:        "RECEIVE_TRANSACTION_NOTIFICATIONS",
  searches:             "SEARCH_TRANSACTIONS",
  payments:             "DIRECT_PAYMENT",
  refunds:              "REFUND_TRANSACTIONS",
  cancels:              "CANCEL_TRANSACTIONS",
  direct_pre_approval:  "USE_DIRECT_PRE_APPROVAL",
  manage_pre_approvals: "MANAGE_PAYMENT_PRE_APPROVALS"
}

Instance Attribute Summary

Attributes included from Restful

#client

Instance Method Summary collapse

Methods included from Restful

#initialize

Instance Method Details

#create(params) ⇒ Object



18
19
20
21
22
# File 'lib/pagseguro/authorizations.rb', line 18

def create(params)
  body = build_request(params).to_xml
  response = post("/v2/authorizations/request", body, xml: :simple)
  response.authorization_request
end

#find_by_notification_code(code) ⇒ Object



24
25
26
27
# File 'lib/pagseguro/authorizations.rb', line 24

def find_by_notification_code(code)
  response = get("/v2/authorizations/notifications/#{code}", nil, xml: :simple)
  response.authorization
end

#url(code) ⇒ Object



29
30
31
# File 'lib/pagseguro/authorizations.rb', line 29

def url(code)
  url_for :site, "/v2/authorization/request.jhtml", code: code
end