Class: Cielo::API30::Payment
- Inherits:
-
Object
- Object
- Cielo::API30::Payment
- Defined in:
- lib/cielo/api30/payment.rb,
lib/cielo/api30/payment/status.rb
Defined Under Namespace
Modules: Status
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.
-
#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_code ⇒ Object
Returns the value of attribute return_code.
-
#return_info ⇒ Object
Returns the value of attribute return_info.
-
#return_message ⇒ Object
Returns the value of attribute return_message.
-
#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.
-
#tid ⇒ Object
Returns the value of attribute tid.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(amount, installments: 1) ⇒ Payment
constructor
A new instance of Payment.
- #success? ⇒ Boolean
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(amount, installments: 1) ⇒ Payment
Returns a new instance of Payment.
51 52 53 54 |
# File 'lib/cielo/api30/payment.rb', line 51 def initialize(amount, installments: 1) @amount = amount @installments = installments end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def address @address end |
#amount ⇒ Object
Returns the value of attribute amount.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def amount @amount end |
#authenticate ⇒ Object
Returns the value of attribute authenticate.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def authenticate @authenticate end |
#authorization_code ⇒ Object
Returns the value of attribute authorization_code.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def @authorization_code end |
#bar_code_number ⇒ Object
Returns the value of attribute bar_code_number.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def @bar_code_number end |
#capture ⇒ Object
Returns the value of attribute capture.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def capture @capture end |
#captured_amount ⇒ Object
Returns the value of attribute captured_amount.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def captured_amount @captured_amount end |
#captured_date ⇒ Object
Returns the value of attribute captured_date.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def captured_date @captured_date end |
#country ⇒ Object
Returns the value of attribute country.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def country @country end |
#credit_card ⇒ Object
Returns the value of attribute credit_card.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def credit_card @credit_card end |
#currency ⇒ Object
Returns the value of attribute currency.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def currency @currency end |
#digitable_line ⇒ Object
Returns the value of attribute digitable_line.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def digitable_line @digitable_line end |
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def expiration_date @expiration_date end |
#extra_data_collection ⇒ Object
Returns the value of attribute extra_data_collection.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def extra_data_collection @extra_data_collection end |
#installments ⇒ Object
Returns the value of attribute installments.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def installments @installments end |
#interest ⇒ Object
Returns the value of attribute interest.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def interest @interest end |
#links ⇒ Object
Returns the value of attribute links.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def links @links end |
#number ⇒ Object
Returns the value of attribute number.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def number @number end |
#payment_id ⇒ Object
Returns the value of attribute payment_id.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def payment_id @payment_id end |
#proof_of_sale ⇒ Object
Returns the value of attribute proof_of_sale.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def proof_of_sale @proof_of_sale end |
#provider ⇒ Object
Returns the value of attribute provider.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def provider @provider end |
#received_date ⇒ Object
Returns the value of attribute received_date.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def received_date @received_date end |
#recurrent ⇒ Object
Returns the value of attribute recurrent.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def recurrent @recurrent end |
#recurrent_payment ⇒ Object
Returns the value of attribute recurrent_payment.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def recurrent_payment @recurrent_payment end |
#return_code ⇒ Object
Returns the value of attribute return_code.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def return_code @return_code end |
#return_info ⇒ Object
Returns the value of attribute return_info.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def return_info @return_info end |
#return_message ⇒ Object
Returns the value of attribute return_message.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def @return_message end |
#return_url ⇒ Object
Returns the value of attribute return_url.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def return_url @return_url end |
#service_tax_amount ⇒ Object
Returns the value of attribute service_tax_amount.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def service_tax_amount @service_tax_amount end |
#soft_descriptor ⇒ Object
Returns the value of attribute soft_descriptor.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def soft_descriptor @soft_descriptor end |
#status ⇒ Object
Returns the value of attribute status.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def status @status end |
#tid ⇒ Object
Returns the value of attribute tid.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def tid @tid end |
#type ⇒ Object
Returns the value of attribute type.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
16 17 18 |
# File 'lib/cielo/api30/payment.rb', line 16 def url @url end |
Class Method Details
.from_json(data) ⇒ Object
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 101 102 103 104 |
# File 'lib/cielo/api30/payment.rb', line 62 def self.from_json(data) return if data.nil? payment = new(data["Amount"]) payment.service_tax_amount = data["ServiceTaxAmount"] payment.installments = data["Installments"] payment.interest = data["Interest"] payment.capture = data["Capture"] payment.authenticate = data["Authenticate"] payment.recurrent = data["Recurrent"] payment.recurrent_payment = RecurrentPayment.from_json(data["RecurrentPayment"]) payment.credit_card = CreditCard.from_json(data["CreditCard"]) payment.proof_of_sale = data["ProofOfSale"] payment. = data["AuthorizationCode"] payment.soft_descriptor = data["SoftDescriptor"] payment.return_url = data["ReturnUrl"] payment.provider = data["Provider"] payment.payment_id = data["PaymentId"] payment.tid = data["Tid"] payment.type = data["Type"] payment.received_date = data["ReceivedDate"] payment.captured_amount = data["CapturedAmount"] payment.captured_date = data["CapturedDate"] payment.currency = data["Currency"] payment.country = data["Country"] payment.return_code = data["ReturnCode"] payment. = data["ReturnMessage"] payment.status = data["Status"] payment.links = data["Links"] payment.extra_data_collection = data["ExtraDataCollection"] payment.expiration_date = data["ExpirationDate"] payment.url = data["Url"] payment.number = data["Number"] payment. = data["BarCodeNumber"] payment.digitable_line = data["DigitableLine"] payment.address = data["Address"] payment.return_info = ReturnInfo.new(payment.return_code) payment end |
Instance Method Details
#as_json(options = {}) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/cielo/api30/payment.rb', line 110 def as_json(={}) { ServiceTaxAmount: @service_tax_amount, Installments: @installments, Interest: @interest, Capture: @capture, Authenticate: @authenticate, Recurrent: @recurrent, RecurrentPayment: @recurrent_payment, CreditCard: @credit_card, SoftDescriptor: @soft_descriptor, ReturnUrl: @return_url, Provider: @provider, Type: @type, Amount: @amount, Currency: @currency, Country: @country, Number: @number, BarCodeNumber: @bar_code_number, DigitableLine: @digitable_line, Address: @address, ReturnInfo: @return_info } end |
#success? ⇒ Boolean
106 107 108 |
# File 'lib/cielo/api30/payment.rb', line 106 def success? Status.success?(status) end |
#to_json(*options) ⇒ Object
56 57 58 59 60 |
# File 'lib/cielo/api30/payment.rb', line 56 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |