Class: StarkBank::PaymentPreview::UtilityPreview

Inherits:
Utils::SubResource show all
Defined in:
lib/payment_preview/utility_preview.rb

Overview

# UtilityPreview object

A UtilityPreview is used to get information from a Utility Payment you received before confirming the payment.

## Attributes (return-only):

  • amount [int]: final amount to be paid. ex: 23456 (= R$ 234.56)

  • name [string]: beneficiary full name. ex: “Light Company”

  • description [string]: utility payment description. ex: “Utility Payment - Light Company”

  • line [string]: Number sequence that identifies the payment. ex: “82660000002 8 44361143007 7 41190025511 7 00010601813 8”

  • bar_code [string]: Bar code number that identifies the payment. ex: “82660000002443611430074119002551100010601813”

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Utils::SubResource

#inspect, #to_s

Constructor Details

#initialize(amount:, name:, description:, line:, bar_code:) ⇒ UtilityPreview

Returns a new instance of UtilityPreview.



21
22
23
24
25
26
27
# File 'lib/payment_preview/utility_preview.rb', line 21

def initialize(amount:, name:, description:, line:, bar_code:)
  @amount = amount
  @name = name
  @description = description
  @line = line
  @bar_code = bar_code
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



20
21
22
# File 'lib/payment_preview/utility_preview.rb', line 20

def amount
  @amount
end

#bar_codeObject (readonly)

Returns the value of attribute bar_code.



20
21
22
# File 'lib/payment_preview/utility_preview.rb', line 20

def bar_code
  @bar_code
end

#descriptionObject (readonly)

Returns the value of attribute description.



20
21
22
# File 'lib/payment_preview/utility_preview.rb', line 20

def description
  @description
end

#lineObject (readonly)

Returns the value of attribute line.



20
21
22
# File 'lib/payment_preview/utility_preview.rb', line 20

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/payment_preview/utility_preview.rb', line 20

def name
  @name
end

Class Method Details

.resourceObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/payment_preview/utility_preview.rb', line 29

def self.resource
  {
    resource_name: 'UtilityPreview',
    resource_maker: proc { |json|
      UtilityPreview.new(
        amount: json['amount'],
        name: json['name'],
        description: json['description'],
        line: json['line'],
        bar_code: json['bar_code']
      )
    }
  }
end