Sha256: 80bd4211eabb0d8960d87cef7fbb47421be0b791a68f7e95834a3d91d2ac6eb4
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module PagSeguro class Authorizations include Restful 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" } def create(params) xml = build_request(params).to_xml response = post_xml("/v2/authorizations/request", xml) response.authorization_request end def find_by_notification_code(code) response = get_xml("/v2/authorizations/notifications/#{code}") response.authorization end def url(code) url_for :site, "/v2/authorization/request.jhtml", code: code end private def build_request(params) builder do authorizationRequest do redirectURL params[:redirect_url] permissions do params[:permissions].each do |aliased| code PERMISSIONS[aliased] end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pagseguro_next-1.0.2 | lib/pagseguro/authorizations.rb |
pagseguro_next-1.0.1 | lib/pagseguro/authorizations.rb |