Class: PagSeguro::Payment
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/pagseguro/payment.rb,
lib/pagseguro/payment/serializer.rb
Defined Under Namespace
Classes: Serializer
Constant Summary
Constants inherited from Request
Instance Attribute Summary collapse
-
#bank ⇒ Object
Set the bank name.
-
#credit_card ⇒ Object
Get the payment sender.
-
#currency ⇒ Object
Set the payment currency.
-
#extra_amount ⇒ Object
Returns the value of attribute extra_amount.
-
#max_installment_no_interest ⇒ Object
Set the max installment with no interest.
-
#notification_url ⇒ Object
Determines for which url PagSeguro will send the order related notifications codes.
-
#payment_method ⇒ Object
Set the payment method.
-
#payment_mode ⇒ Object
Set the payment mode.
-
#receiver_email ⇒ Object
Returns the value of attribute receiver_email.
-
#reference ⇒ Object
Set the reference code.
-
#sender ⇒ Object
Get the payment sender.
-
#shipping ⇒ Object
Returns the value of attribute shipping.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Payment
constructor
A new instance of Payment.
-
#items ⇒ Object
Products/items in this payment request.
-
#items=(_items) ⇒ Object
Normalize the items list.
-
#transaction(account = nil) ⇒ Object
Calls the PagSeguro web service and register this request for payment.
Methods inherited from Request
Constructor Details
#initialize(options = {}) ⇒ Payment
Returns a new instance of Payment.
72 73 74 75 76 77 78 79 80 |
# File 'lib/pagseguro/payment.rb', line 72 def initialize( = {}) @currency = "BRL" @payment_mode = 'default' @notification_url = [:notification_url] @payment_method = [:payment_method] @reference = [:reference] if [:reference] @extra_amount = [:extra_amount] if [:extra_amount] @receiver_email = [:receiver_email] if [:receiver_email] end |
Instance Attribute Details
#bank ⇒ Object
Set the bank name. Optional. Bank name should be used for eft payment method to specify which the buyer should be redirect.
46 47 48 |
# File 'lib/pagseguro/payment.rb', line 46 def bank @bank end |
#credit_card ⇒ Object
Get the payment sender.
39 40 41 |
# File 'lib/pagseguro/payment.rb', line 39 def credit_card @credit_card end |
#currency ⇒ Object
Set the payment currency. Defaults to BRL.
19 20 21 |
# File 'lib/pagseguro/payment.rb', line 19 def currency @currency end |
#extra_amount ⇒ Object
Returns the value of attribute extra_amount.
50 51 52 |
# File 'lib/pagseguro/payment.rb', line 50 def extra_amount @extra_amount end |
#max_installment_no_interest ⇒ Object
Set the max installment with no interest. Optional.
54 55 56 |
# File 'lib/pagseguro/payment.rb', line 54 def max_installment_no_interest @max_installment_no_interest 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.
15 16 17 |
# File 'lib/pagseguro/payment.rb', line 15 def notification_url @notification_url end |
#payment_method ⇒ Object
Set the payment method. Payment method should be creditCard, boleto or eft.
23 24 25 |
# File 'lib/pagseguro/payment.rb', line 23 def payment_method @payment_method end |
#payment_mode ⇒ Object
Set the payment mode
26 27 28 |
# File 'lib/pagseguro/payment.rb', line 26 def payment_mode @payment_mode end |
#receiver_email ⇒ Object
Returns the value of attribute receiver_email.
41 42 43 |
# File 'lib/pagseguro/payment.rb', line 41 def receiver_email @receiver_email 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.
32 33 34 |
# File 'lib/pagseguro/payment.rb', line 32 def reference @reference end |
#sender ⇒ Object
Get the payment sender.
35 36 37 |
# File 'lib/pagseguro/payment.rb', line 35 def sender @sender end |
#shipping ⇒ Object
Returns the value of attribute shipping.
48 49 50 |
# File 'lib/pagseguro/payment.rb', line 48 def shipping @shipping end |
Instance Method Details
#items ⇒ Object
Products/items in this payment request.
57 58 59 |
# File 'lib/pagseguro/payment.rb', line 57 def items @items ||= Items.new end |
#items=(_items) ⇒ Object
Normalize the items list.
62 63 64 |
# File 'lib/pagseguro/payment.rb', line 62 def items=(_items) _items.each {|item| items << item } end |
#transaction(account = nil) ⇒ Object
Calls the PagSeguro web service and register this request for payment.
67 68 69 70 |
# File 'lib/pagseguro/payment.rb', line 67 def transaction(account = nil) params = Serializer.new(self).to_params PagSeguro::Transaction.new post('/transactions', API_V2 ,account, params).parsed_response end |