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/serializer.rb

Defined Under Namespace

Classes: Response, Serializer

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.



53
54
55
# File 'lib/pagseguro/payment_request.rb', line 53

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.



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

def extra_amount
  @extra_amount
end

#extra_paramsObject

The extra parameters for payment request



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

def extra_params
  @extra_params
end

#max_ageObject

Set the payment request duration, in seconds.



35
36
37
# File 'lib/pagseguro/payment_request.rb', line 35

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.



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

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.



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

def notification_url
  @notification_url
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.



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

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.



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

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.



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

def shipping
  @shipping
end

Instance Method Details

#itemsObject

Products/items in this payment request.



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

def items
  @items ||= Items.new
end

#registerObject

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



74
75
76
77
# File 'lib/pagseguro/payment_request.rb', line 74

def register
  params = Serializer.new(self).to_params
  Response.new Request.post("checkout", api_version, params)
end