Class: StarkBank::PaymentPreview::BoletoPreview
- Inherits:
-
Utils::SubResource
- Object
- Utils::SubResource
- StarkBank::PaymentPreview::BoletoPreview
- Defined in:
- lib/payment_preview/boleto_preview.rb
Overview
# BoletoPreview object
A BoletoPreview is used to get information from a Boleto payment you received before confirming the payment.
## Attributes (return-only):
-
status [string]: current boleto status. ex: ‘active’, ‘expired’ or ‘inactive’
-
amount [int]: final amount to be paid. ex: 23456 (= R$ 234.56)
-
discount_amount [int]: discount amount to be paid. ex: 23456 (= R$ 234.56)
-
fine_amount [int]: fine amount to be paid. ex: 23456 (= R$ 234.56)
-
interest_amount [int]: interest amount to be paid. ex: 23456 (= R$ 234.56)
-
due [DateTime or string]: Boleto due date. ex: ‘2020-04-30’
-
expiration [DateTime or string]: Boleto expiration date. ex: ‘2020-04-30’
-
name [string]: beneficiary full name. ex: ‘Anthony Edward Stark’
-
tax_id [string]: beneficiary tax ID (CPF or CNPJ). ex: ‘20.018.183/0001-80’
-
receiver_name [string]: receiver (Sacador Avalista) full name. ex: ‘Anthony Edward Stark’
-
receiver_tax_id [string]: receiver (Sacador Avalista) tax ID (CPF or CNPJ). ex: ‘20.018.183/0001-80’
-
payer_name [string]: payer full name. ex: ‘Anthony Edward Stark’
-
payer_tax_id [string]: payer tax ID (CPF or CNPJ). ex: ‘20.018.183/0001-80’
-
line [string]: Number sequence that identifies the payment. ex: ‘34191.09008 63571.277308 71444.640008 5 81960000000062’
-
bar_code [string]: Bar code number that identifies the payment. ex: ‘34195819600000000621090063571277307144464000’
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#bar_code ⇒ Object
readonly
Returns the value of attribute bar_code.
-
#discount_amount ⇒ Object
readonly
Returns the value of attribute discount_amount.
-
#due ⇒ Object
readonly
Returns the value of attribute due.
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#fine_amount ⇒ Object
readonly
Returns the value of attribute fine_amount.
-
#interest_amount ⇒ Object
readonly
Returns the value of attribute interest_amount.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#payer_name ⇒ Object
readonly
Returns the value of attribute payer_name.
-
#payer_tax_id ⇒ Object
readonly
Returns the value of attribute payer_tax_id.
-
#receiver_name ⇒ Object
readonly
Returns the value of attribute receiver_name.
-
#receiver_tax_id ⇒ Object
readonly
Returns the value of attribute receiver_tax_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tax_id ⇒ Object
readonly
Returns the value of attribute tax_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(status:, amount:, discount_amount:, fine_amount:, interest_amount:, due:, expiration:, name:, tax_id:, receiver_name:, receiver_tax_id:, payer_name:, payer_tax_id:, line:, bar_code:) ⇒ BoletoPreview
constructor
A new instance of BoletoPreview.
Methods inherited from Utils::SubResource
Constructor Details
#initialize(status:, amount:, discount_amount:, fine_amount:, interest_amount:, due:, expiration:, name:, tax_id:, receiver_name:, receiver_tax_id:, payer_name:, payer_tax_id:, line:, bar_code:) ⇒ BoletoPreview
Returns a new instance of BoletoPreview.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/payment_preview/boleto_preview.rb', line 31 def initialize(status:, amount:, discount_amount:, fine_amount:, interest_amount:, due:, expiration:, name:, tax_id:, receiver_name:, receiver_tax_id:, payer_name:, payer_tax_id:, line:, bar_code:) @status = status @amount = amount @discount_amount = discount_amount @fine_amount = fine_amount @interest_amount = interest_amount @due = StarkBank::Utils::Checks.check_datetime(due) @expiration = StarkBank::Utils::Checks.check_datetime(expiration) @name = name @tax_id = tax_id @receiver_name = receiver_name @receiver_tax_id = receiver_tax_id @payer_name = payer_name @payer_tax_id = payer_tax_id @line = line = end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def amount @amount end |
#bar_code ⇒ Object (readonly)
Returns the value of attribute bar_code.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def end |
#discount_amount ⇒ Object (readonly)
Returns the value of attribute discount_amount.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def discount_amount @discount_amount end |
#due ⇒ Object (readonly)
Returns the value of attribute due.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def due @due end |
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def expiration @expiration end |
#fine_amount ⇒ Object (readonly)
Returns the value of attribute fine_amount.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def fine_amount @fine_amount end |
#interest_amount ⇒ Object (readonly)
Returns the value of attribute interest_amount.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def interest_amount @interest_amount end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def name @name end |
#payer_name ⇒ Object (readonly)
Returns the value of attribute payer_name.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def payer_name @payer_name end |
#payer_tax_id ⇒ Object (readonly)
Returns the value of attribute payer_tax_id.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def payer_tax_id @payer_tax_id end |
#receiver_name ⇒ Object (readonly)
Returns the value of attribute receiver_name.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def receiver_name @receiver_name end |
#receiver_tax_id ⇒ Object (readonly)
Returns the value of attribute receiver_tax_id.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def receiver_tax_id @receiver_tax_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def status @status end |
#tax_id ⇒ Object (readonly)
Returns the value of attribute tax_id.
30 31 32 |
# File 'lib/payment_preview/boleto_preview.rb', line 30 def tax_id @tax_id end |
Class Method Details
.resource ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/payment_preview/boleto_preview.rb', line 49 def self.resource { resource_name: 'BoletoPreview', resource_maker: proc { |json| BoletoPreview.new( status: json['status'], amount: json['amount'], discount_amount: json['discount_amount'], fine_amount: json['fine_amount'], interest_amount: json['interest_amount'], due: json['due'], expiration: json['expiration'], name: json['name'], tax_id: json['tax_id'], receiver_name: json['receiver_name'], receiver_tax_id: json['receiver_tax_id'], payer_name: json['payer_name'], payer_tax_id: json['payer_tax_id'], line: json['line'], bar_code: json['bar_code'], ) } } end |