Class: PagSeguro::PaymentRequest

Inherits:
Object
  • Object
show all
Includes:
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

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.



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

def abandon_url
  @abandon_url
end

#currencyObject

Set the payment currency. Defaults to BRL.



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

def currency
  @currency
end

#emailObject

The email that identifies the request. Defaults to PagSeguro.email



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

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



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

def extra_amount
  @extra_amount
end

#extra_paramsObject

The extra parameters for payment request



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

def extra_params
  @extra_params
end

#max_ageObject

Set the payment request duration, in seconds.



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

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.



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

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.



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

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.



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

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.



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

def reference
  @reference
end

#senderObject

Get the payment sender.



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

def sender
  @sender
end

#shippingObject

Get the shipping info.



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

def shipping
  @shipping
end

#tokenObject

The token that identifies the request. Defaults to PagSeguro.token



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

def token
  @token
end

Instance Method Details

#itemsObject

Products/items in this payment request.



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

def items
  @items ||= Items.new
end

#registerObject

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



79
80
81
82
83
84
85
# File 'lib/pagseguro/payment_request.rb', line 79

def register
  params = Serializer.new(self).to_params.merge({
    email: email,
    token: token
  })
  Response.new Request.post("checkout", api_version, params)
end