Class: PagSeguro::Authorizations
- Inherits:
-
Base
- Object
- Base
- PagSeguro::Authorizations
show all
- 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 inherited from Base
#api
Instance Method Summary
collapse
Methods inherited from Base
#builder, #initialize, #parameterize, #parse, #parse_body
Instance Method Details
#create(params) ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/pagseguro/authorizations.rb', line 14
def create(params)
xml = build_request(params).to_xml
response = api.post "/v2/authorizations/request", xml do |conn|
conn.[:content_type] = FORMATS[:xml]
conn.[:accept] = FORMATS[:xml]
end
parse response.body["authorizationRequest"]
end
|
#find_by_notification_code(code) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/pagseguro/authorizations.rb', line 25
def find_by_notification_code(code)
response = api.get "/v2/authorizations/notifications/#{code}" do |conn|
conn.[:content_type] = FORMATS[:xml]
conn.[:accept] = FORMATS[:xml]
end
parse response.body["authorization"]
end
|
#url(code) ⇒ Object
34
35
36
|
# File 'lib/pagseguro/authorizations.rb', line 34
def url(code)
api.build_url :site, "/v2/authorization/request.jhtml", code: code
end
|