Class: SepaFileParser::Pain008::PaymentInformation
- Inherits:
-
Object
- Object
- SepaFileParser::Pain008::PaymentInformation
- Defined in:
- lib/sepa_file_parser/pain008/payment_information.rb
Instance Attribute Summary collapse
-
#xml_data ⇒ Object
readonly
Returns the value of attribute xml_data.
Class Method Summary collapse
Instance Method Summary collapse
- #account ⇒ Object
- #entries ⇒ Object
- #identification ⇒ Object
-
#initialize(xml_data) ⇒ PaymentInformation
constructor
A new instance of PaymentInformation.
- #requested_collection_date ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(xml_data) ⇒ PaymentInformation
Returns a new instance of PaymentInformation.
9 10 11 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 9 def initialize(xml_data) @xml_data = xml_data end |
Instance Attribute Details
#xml_data ⇒ Object (readonly)
Returns the value of attribute xml_data.
7 8 9 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 7 def xml_data @xml_data end |
Class Method Details
.parse(xml) ⇒ Object
39 40 41 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 39 def self.parse(xml) self.new(Nokogiri::XML(xml).xpath('PmtInf')) end |
Instance Method Details
#account ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 21 def account @account ||= SepaFileParser::Account.from_pain_data( xml_data, entries.first.currency, 'Cdtr', ) end |
#entries ⇒ Object
29 30 31 32 33 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 29 def entries @entries ||= xml_data.xpath('DrctDbtTxInf').map do |x| SepaFileParser::PainEntry.new(x) end end |
#identification ⇒ Object
13 14 15 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 13 def identification @identification ||= xml_data.xpath('PmtInfId/text()').text end |
#requested_collection_date ⇒ Object
17 18 19 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 17 def requested_collection_date @requested_collection_date ||= Time.parse(xml_data.xpath('ReqdColltnDt/text()').text) end |
#source ⇒ Object
35 36 37 |
# File 'lib/sepa_file_parser/pain008/payment_information.rb', line 35 def source xml_data.to_s end |