Sha256: 0a89733fe3d0ecbf0615acb74f8426ae36ca3f0b9759c982c2e1c029a4fc26a9
Contents?: true
Size: 948 Bytes
Versions: 1
Compression:
Stored size: 948 Bytes
Contents
# frozen_string_literal: true module PagSeguro class Plans include Restful def create(params) xml = build_request(params).to_xml post_xml("/pre-approvals/request", xml) end def update(code, params) params[:amount_per_payment] = to_money params[:amount_per_payment] params = parameterize params put("/pre-approvals/request/#{code}/payment", params) end private def to_money(value) format "%.2f", value.to_f end def build_request(params) builder do preApprovalRequest do reference params[:reference] preApproval do charge params[:charge] name { cdata(params[:name]) } details { cdata(params[:details]) } period params[:period] amountPerPayment format("%.2f", params[:amount_per_payment]) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagseguro_next-1.0.2 | lib/pagseguro/plans.rb |