Sha256: e97e50ca192be1fe7af21e45baa9b8c96aa5dd4e4145cf9422478369b77d9bbb
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
# frozen_string_literal: true module PagSeguro class Checkout include Restful def create(params) body = build_request(params).to_xml(encoding: "UTF-8") response = post("/v2/checkout", body, xml: :simple) response.checkout end def url(code) url_for :site, "/v2/checkout/payment.html", code: code end private def build_request(params) builder do checkout do currency "BRL" sender do ip params[:remote_ip] end if params.key?(:remote_ip) items do item do id params[:id] description { cdata(params[:description]) } amount format("%.2f", params[:amount]) quantity 1 end end shipping do addressRequired false end redirectURL params[:redirect_url] if params.key?(:redirect_url) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pagseguro_next-1.0.5 | lib/pagseguro/checkout.rb |
pagseguro_next-1.0.4 | lib/pagseguro/checkout.rb |