Class: Braspag::Payment
- Inherits:
-
Object
- Object
- Braspag::Payment
- Defined in:
- lib/braspag/api/payment.rb
Constant Summary collapse
- PAYMENTTYPE_CREDITCARD =
"CreditCard"
- PAYMENTTYPE_DEBITCARD =
"DebitCard"
- PAYMENTTYPE_ELECTRONIC_TRANSFER =
"ElectronicTransfer"
- PAYMENTTYPE_BOLETO =
"Boleto"
- PROVIDER_BRADESCO =
"Bradesco"
- PROVIDER_BANCO_DO_BRASIL =
"BancoDoBrasil"
- PROVIDER_SIMULADO =
"Simulado"
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#authenticate ⇒ Object
Returns the value of attribute authenticate.
-
#authorization_code ⇒ Object
Returns the value of attribute authorization_code.
-
#bar_code_number ⇒ Object
Returns the value of attribute bar_code_number.
-
#capture ⇒ Object
Returns the value of attribute capture.
-
#captured_amount ⇒ Object
Returns the value of attribute captured_amount.
-
#captured_date ⇒ Object
Returns the value of attribute captured_date.
-
#country ⇒ Object
Returns the value of attribute country.
-
#credit_card ⇒ Object
Returns the value of attribute credit_card.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#digitable_line ⇒ Object
Returns the value of attribute digitable_line.
-
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
-
#extra_data_collection ⇒ Object
Returns the value of attribute extra_data_collection.
-
#installments ⇒ Object
Returns the value of attribute installments.
-
#interest ⇒ Object
Returns the value of attribute interest.
-
#links ⇒ Object
Returns the value of attribute links.
-
#number ⇒ Object
Returns the value of attribute number.
-
#payment_id ⇒ Object
Returns the value of attribute payment_id.
-
#proof_of_sale ⇒ Object
Returns the value of attribute proof_of_sale.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#provider_return_code ⇒ Object
Returns the value of attribute provider_return_code.
-
#provider_return_message ⇒ Object
Returns the value of attribute provider_return_message.
-
#reason_code ⇒ Object
Returns the value of attribute reason_code.
-
#reason_message ⇒ Object
Returns the value of attribute reason_message.
-
#received_date ⇒ Object
Returns the value of attribute received_date.
-
#recurrent ⇒ Object
Returns the value of attribute recurrent.
-
#recurrent_payment ⇒ Object
Returns the value of attribute recurrent_payment.
-
#return_url ⇒ Object
Returns the value of attribute return_url.
-
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
-
#soft_descriptor ⇒ Object
Returns the value of attribute soft_descriptor.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(amount, installments: 1) ⇒ Payment
constructor
A new instance of Payment.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(amount, installments: 1) ⇒ Payment
Returns a new instance of Payment.
47 48 49 50 |
# File 'lib/braspag/api/payment.rb', line 47 def initialize(amount, installments: 1) @amount = amount @installments = installments end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def address @address end |
#amount ⇒ Object
Returns the value of attribute amount.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def amount @amount end |
#authenticate ⇒ Object
Returns the value of attribute authenticate.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def authenticate @authenticate end |
#authorization_code ⇒ Object
Returns the value of attribute authorization_code.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def @authorization_code end |
#bar_code_number ⇒ Object
Returns the value of attribute bar_code_number.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def @bar_code_number end |
#capture ⇒ Object
Returns the value of attribute capture.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def capture @capture end |
#captured_amount ⇒ Object
Returns the value of attribute captured_amount.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def captured_amount @captured_amount end |
#captured_date ⇒ Object
Returns the value of attribute captured_date.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def captured_date @captured_date end |
#country ⇒ Object
Returns the value of attribute country.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def country @country end |
#credit_card ⇒ Object
Returns the value of attribute credit_card.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def credit_card @credit_card end |
#currency ⇒ Object
Returns the value of attribute currency.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def currency @currency end |
#digitable_line ⇒ Object
Returns the value of attribute digitable_line.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def digitable_line @digitable_line end |
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def expiration_date @expiration_date end |
#extra_data_collection ⇒ Object
Returns the value of attribute extra_data_collection.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def extra_data_collection @extra_data_collection end |
#installments ⇒ Object
Returns the value of attribute installments.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def installments @installments end |
#interest ⇒ Object
Returns the value of attribute interest.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def interest @interest end |
#links ⇒ Object
Returns the value of attribute links.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def links @links end |
#number ⇒ Object
Returns the value of attribute number.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def number @number end |
#payment_id ⇒ Object
Returns the value of attribute payment_id.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def payment_id @payment_id end |
#proof_of_sale ⇒ Object
Returns the value of attribute proof_of_sale.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def proof_of_sale @proof_of_sale end |
#provider ⇒ Object
Returns the value of attribute provider.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def provider @provider end |
#provider_return_code ⇒ Object
Returns the value of attribute provider_return_code.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def provider_return_code @provider_return_code end |
#provider_return_message ⇒ Object
Returns the value of attribute provider_return_message.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def @provider_return_message end |
#reason_code ⇒ Object
Returns the value of attribute reason_code.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def reason_code @reason_code end |
#reason_message ⇒ Object
Returns the value of attribute reason_message.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def @reason_message end |
#received_date ⇒ Object
Returns the value of attribute received_date.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def received_date @received_date end |
#recurrent ⇒ Object
Returns the value of attribute recurrent.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def recurrent @recurrent end |
#recurrent_payment ⇒ Object
Returns the value of attribute recurrent_payment.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def recurrent_payment @recurrent_payment end |
#return_url ⇒ Object
Returns the value of attribute return_url.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def return_url @return_url end |
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def service_tax_amount @service_tax_amount end |
#soft_descriptor ⇒ Object
Returns the value of attribute soft_descriptor.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def soft_descriptor @soft_descriptor end |
#status ⇒ Object
Returns the value of attribute status.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def status @status end |
#type ⇒ Object
Returns the value of attribute type.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
12 13 14 |
# File 'lib/braspag/api/payment.rb', line 12 def url @url end |
Class Method Details
.from_json(data) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/braspag/api/payment.rb', line 58 def self.from_json(data) if (data != nil) payment = Payment.new(data["Amount"] || nil) payment.service_tax_amount = data["ServiceTaxAmount"] || nil payment.installments = data["Installments"] || nil payment.interest = data["Interest"] || nil payment.capture = data["Capture"] || nil payment.authenticate = data["Authenticate"] || nil payment.recurrent = data["Recurrent"] || nil payment.recurrent_payment = Braspag::RecurrentPayment.from_json(data["RecurrentPayment"] || nil) payment.credit_card = Braspag::CreditCard.from_json(data["CreditCard"] || nil) payment.proof_of_sale = data["ProofOfSale"] || nil payment. = data["AuthorizationCode"] || nil payment.soft_descriptor = data["SoftDescriptor"] || nil payment.return_url = data["ReturnUrl"] || nil payment.provider = data["Provider"] || nil payment.payment_id = data["PaymentId"] || nil payment.type = data["Type"] || nil payment.received_date = data["ReceivedDate"] || nil payment.captured_amount = data["CapturedAmount"] || nil payment.captured_date = data["CapturedDate"] || nil payment.currency = data["Currency"] || nil payment.country = data["Country"] || nil payment.reason_code = data["ReasonCode"] || nil payment. = data["ReasonMessage"] || nil payment.provider_return_code = data["ProviderReturnCode"] || nil payment. = data["ProviderReturnMessage"] || nil payment.status = data["Status"] || nil payment.links = data["Links"] || nil payment.extra_data_collection = data["ExtraDataCollection"] || nil payment.expiration_date = data["ExpirationDate"] || nil payment.url = data["Url"] || nil payment.number = data["Number"] || nil payment. = data["BarCodeNumber"] || nil payment.digitable_line = data["DigitableLine"] || nil payment.address = data["Address"] || nil return payment end end |
Instance Method Details
#to_json(*options) ⇒ Object
52 53 54 55 56 |
# File 'lib/braspag/api/payment.rb', line 52 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |