class PagSeguro::TransactionRequest
Attributes
The transaction code returned from api.
The created at date returned from api
Set the payment currency. Defaults to BRL.
The discount amount returned from api.
Set the extra amount to be applied to the transaction's total. This value can be used to add an extra charge to the transaction or provide a discount, if negative.
The extra parameters for payment request.
The gross amount returned from api.
The installments number returned from api.
The net amount returned from api.
Determines for which url PagSeguro
will send the order related notifications codes. Optional. Any change happens in the transaction status, a new notification request will be send to this url. You can use that for update the related order.
The payment link returned from api.
The payment method returned from api.
Set the payment mode.
Set and get primary receiver email.
Get the payment receivers.
Set the reference code. Optional. You can use the reference code to store an identifier so you can associate the PagSeguro
transaction to a transaction in your system. Tipically this is the order id.
Get the payment sender.
Get the shipping info.
The transaction status returned from api.
The transaction type returned from api.
The updated at date returned from api
Public Instance Methods
Calls the PagSeguro
web service and create this request for payment. Return boolean.
# File lib/pagseguro/transaction_request.rb, line 108 def create request = if receivers.empty? Request.post('transactions', api_version, params) else Request.post_xml('transactions/', nil, credentials, xml_params) end Response.new(request, self).serialize end
# File lib/pagseguro/transaction_request.rb, line 87 def errors @errors ||= Errors.new end
Products/items in this payment request.
# File lib/pagseguro/transaction_request.rb, line 83 def items @items ||= Items.new end
Set the receivers.
# File lib/pagseguro/transaction_request.rb, line 123 def receivers=(receivers) @receivers = receivers.map do |receiver| ensure_type(Receiver, receiver) end end
Set the payment sender.
# File lib/pagseguro/transaction_request.rb, line 97 def sender=(sender) @sender = ensure_type(Sender, sender) end
Set the shipping info.
# File lib/pagseguro/transaction_request.rb, line 102 def shipping=(shipping) @shipping = ensure_type(Shipping, shipping) end
# File lib/pagseguro/transaction_request.rb, line 118 def update_attributes(attrs) attrs.map { |name, value| send("#{name}=", value) } end
Private Instance Methods
# File lib/pagseguro/transaction_request.rb, line 161 def api_version 'v2' end
# File lib/pagseguro/transaction_request.rb, line 135 def before_initialize self.currency = "BRL" self.extra_params = [] self.receivers = [] end
Used to set response items from api.
# File lib/pagseguro/transaction_request.rb, line 150 def items=(items) @items = Items.new items.map { |item| @items << item } end
# File lib/pagseguro/transaction_request.rb, line 141 def params RequestSerializer.new(self).to_params end
Used to set the payment method from api.
# File lib/pagseguro/transaction_request.rb, line 156 def payment_method=(payment_method) @payment_method = ensure_type(PaymentMethod, payment_method) end
# File lib/pagseguro/transaction_request.rb, line 145 def xml_params RequestSerializer.new(self).to_xml_params end