Class: PagSeguro::PaymentRequest

Inherits:
Object
  • Object
show all
Includes:
Extensions::Credentiable, Extensions::EnsureType, Extensions::MassAssignment
Defined in:
lib/pagseguro/payment_request.rb,
lib/pagseguro/payment_request/response.rb,
lib/pagseguro/payment_request/request_serializer.rb

Defined Under Namespace

Classes: RequestSerializer, Response

Instance Attribute Summary collapse

Attributes included from Extensions::Credentiable

#credentials

Instance Method Summary collapse

Methods included from Extensions::EnsureType

#ensure_type

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#abandon_urlObject

Determines for which url PagSeguro will send the buyer when he doesn’t complete the payment.



59
60
61
# File 'lib/pagseguro/payment_request.rb', line 59

def abandon_url
  @abandon_url
end

#currencyObject

Set the payment currency. Defaults to BRL.



9
10
11
# File 'lib/pagseguro/payment_request.rb', line 9

def currency
  @currency
end

#extra_amountObject

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.



32
33
34
# File 'lib/pagseguro/payment_request.rb', line 32

def extra_amount
  @extra_amount
end

#extra_paramsObject

The extra parameters for payment request



62
63
64
# File 'lib/pagseguro/payment_request.rb', line 62

def extra_params
  @extra_params
end

#max_ageObject

Set the payment request duration, in seconds.



41
42
43
# File 'lib/pagseguro/payment_request.rb', line 41

def max_age
  @max_age
end

#max_usesObject

How many times the payment redirect uri returned by the payment web service can be accessed. Optional. After this payment request is submitted, the payment redirect uri returned by the payment web service will remain valid for the number of uses specified here.



48
49
50
# File 'lib/pagseguro/payment_request.rb', line 48

def max_uses
  @max_uses
end

#notification_urlObject

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.



55
56
57
# File 'lib/pagseguro/payment_request.rb', line 55

def notification_url
  @notification_url
end

#primary_receiverObject

Set and get primary receiver email.



15
16
17
# File 'lib/pagseguro/payment_request.rb', line 15

def primary_receiver
  @primary_receiver
end

#receiversObject

Get the payment receivers.



18
19
20
# File 'lib/pagseguro/payment_request.rb', line 18

def receivers
  @receivers
end

#redirect_urlObject

Set the redirect url. The URL that will be used by PagSeguro to redirect the user after the payment information is processed. Typically this is a confirmation page on your web site.



27
28
29
# File 'lib/pagseguro/payment_request.rb', line 27

def redirect_url
  @redirect_url
end

#referenceObject

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.



38
39
40
# File 'lib/pagseguro/payment_request.rb', line 38

def reference
  @reference
end

#senderObject

Get the payment sender.



12
13
14
# File 'lib/pagseguro/payment_request.rb', line 12

def sender
  @sender
end

#shippingObject

Get the shipping info.



21
22
23
# File 'lib/pagseguro/payment_request.rb', line 21

def shipping
  @shipping
end

Instance Method Details

#itemsObject

Products/items in this payment request.



65
66
67
# File 'lib/pagseguro/payment_request.rb', line 65

def items
  @items ||= Items.new
end

#registerObject

Calls the PagSeguro web service and register this request for payment.



87
88
89
90
91
92
93
94
95
# File 'lib/pagseguro/payment_request.rb', line 87

def register
  request = if @receivers.empty?
              Request.post('checkout', api_version, params)
            else
              Request.post_xml('checkouts', api_version, credentials, xml_params)
            end

  Response.new(request)
end