Class: PagSeguro::TransactionRequest
- Inherits:
-
Object
- Object
- PagSeguro::TransactionRequest
- Includes:
- Extensions::EnsureType, Extensions::MassAssignment
- Defined in:
- lib/pagseguro/transaction_request.rb,
lib/pagseguro/transaction_request/response.rb,
lib/pagseguro/transaction_request/request_serializer.rb,
lib/pagseguro/transaction_request/response_serializer.rb
Direct Known Subclasses
BoletoTransactionRequest, CreditCardTransactionRequest, OnlineDebitTransactionRequest
Defined Under Namespace
Classes: RequestSerializer, Response, ResponseSerializer
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
The transaction code returned from api.
-
#created_at ⇒ Object
readonly
The created at date returned from api.
-
#currency ⇒ Object
Set the payment currency.
-
#discount_amount ⇒ Object
readonly
The discount amount returned from api.
- #errors ⇒ Object
-
#extra_amount ⇒ Object
Set the extra amount to be applied to the transaction’s total.
-
#extra_params ⇒ Object
The extra parameters for payment request.
-
#gross_amount ⇒ Object
readonly
The gross amount returned from api.
-
#installment_count ⇒ Object
readonly
The installments number returned from api.
-
#net_amount ⇒ Object
readonly
The net amount returned from api.
-
#notification_url ⇒ Object
Determines for which url PagSeguro will send the order related notifications codes.
-
#payment_link ⇒ Object
readonly
The payment link returned from api.
-
#payment_method ⇒ Object
readonly
Subclasses must implement payment_method.
-
#payment_mode ⇒ Object
Set the payment mode.
-
#reference ⇒ Object
Set the reference code.
-
#sender ⇒ Object
Get the payment sender.
-
#shipping ⇒ Object
Get the shipping info.
-
#status ⇒ Object
readonly
The transaction status returned from api.
-
#type_id ⇒ Object
readonly
The transaction type returned from api.
-
#updated_at ⇒ Object
readonly
The updated at date returned from api.
Instance Method Summary collapse
-
#create ⇒ Object
Calls the PagSeguro web service and create this request for payment.
-
#items ⇒ Object
Products/items in this payment request.
- #update_attributes(attrs) ⇒ Object
Methods included from Extensions::EnsureType
Methods included from Extensions::MassAssignment
Instance Attribute Details
#code ⇒ Object
The transaction code returned from api.
41 42 43 |
# File 'lib/pagseguro/transaction_request.rb', line 41 def code @code end |
#created_at ⇒ Object
The created at date returned from api
68 69 70 |
# File 'lib/pagseguro/transaction_request.rb', line 68 def created_at @created_at end |
#currency ⇒ Object
Set the payment currency. Defaults to BRL.
8 9 10 |
# File 'lib/pagseguro/transaction_request.rb', line 8 def currency @currency end |
#discount_amount ⇒ Object
The discount amount returned from api.
59 60 61 |
# File 'lib/pagseguro/transaction_request.rb', line 59 def discount_amount @discount_amount end |
#errors ⇒ Object
80 81 82 |
# File 'lib/pagseguro/transaction_request.rb', line 80 def errors @errors ||= Errors.new end |
#extra_amount ⇒ Object
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.
19 20 21 |
# File 'lib/pagseguro/transaction_request.rb', line 19 def extra_amount @extra_amount end |
#extra_params ⇒ Object
The extra parameters for payment request.
38 39 40 |
# File 'lib/pagseguro/transaction_request.rb', line 38 def extra_params @extra_params end |
#gross_amount ⇒ Object
The gross amount returned from api.
56 57 58 |
# File 'lib/pagseguro/transaction_request.rb', line 56 def gross_amount @gross_amount end |
#installment_count ⇒ Object
The installments number returned from api.
65 66 67 |
# File 'lib/pagseguro/transaction_request.rb', line 65 def installment_count @installment_count end |
#net_amount ⇒ Object
The net amount returned from api.
62 63 64 |
# File 'lib/pagseguro/transaction_request.rb', line 62 def net_amount @net_amount end |
#notification_url ⇒ Object
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.
32 33 34 |
# File 'lib/pagseguro/transaction_request.rb', line 32 def notification_url @notification_url end |
#payment_link ⇒ Object
The payment link returned from api.
47 48 49 |
# File 'lib/pagseguro/transaction_request.rb', line 47 def payment_link @payment_link end |
#payment_method ⇒ Object
Subclasses must implement payment_method
53 54 55 |
# File 'lib/pagseguro/transaction_request.rb', line 53 def payment_method @payment_method end |
#payment_mode ⇒ Object
Set the payment mode.
35 36 37 |
# File 'lib/pagseguro/transaction_request.rb', line 35 def payment_mode @payment_mode end |
#reference ⇒ Object
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.
25 26 27 |
# File 'lib/pagseguro/transaction_request.rb', line 25 def reference @reference end |
#sender ⇒ Object
Get the payment sender.
11 12 13 |
# File 'lib/pagseguro/transaction_request.rb', line 11 def sender @sender end |
#shipping ⇒ Object
Get the shipping info.
14 15 16 |
# File 'lib/pagseguro/transaction_request.rb', line 14 def shipping @shipping end |
#status ⇒ Object
The transaction status returned from api.
50 51 52 |
# File 'lib/pagseguro/transaction_request.rb', line 50 def status @status end |
#type_id ⇒ Object
The transaction type returned from api.
44 45 46 |
# File 'lib/pagseguro/transaction_request.rb', line 44 def type_id @type_id end |
#updated_at ⇒ Object
The updated at date returned from api
71 72 73 |
# File 'lib/pagseguro/transaction_request.rb', line 71 def updated_at @updated_at end |
Instance Method Details
#create ⇒ Object
Calls the PagSeguro web service and create this request for payment. Return boolean.
101 102 103 104 105 106 107 |
# File 'lib/pagseguro/transaction_request.rb', line 101 def create request = Request.post("transactions", api_version, params) response = Response.new(request, self) response.serialize response.success? end |
#items ⇒ Object
Products/items in this payment request.
76 77 78 |
# File 'lib/pagseguro/transaction_request.rb', line 76 def items @items ||= Items.new end |
#update_attributes(attrs) ⇒ Object
109 110 111 |
# File 'lib/pagseguro/transaction_request.rb', line 109 def update_attributes(attrs) attrs.map { |name, value| send("#{name}=", value) } end |