Class: SEPA::Transaction
- Inherits:
-
Object
- Object
- SEPA::Transaction
- Extended by:
- Converter
- Includes:
- ActiveModel::Model
- Defined in:
- lib/sepa_rator/transaction.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_REQUESTED_DATE =
Convention SEPA: 1999-01-01 signifies “execute as soon as possible” (ASAP). When no specific date is requested, this sentinel value tells the bank to process the payment at the earliest opportunity.
Date.new(1999, 1, 1).freeze
- UETR_REGEX =
/\A[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}\z/
Instance Attribute Summary collapse
-
#additional_remittance_information ⇒ Object
Returns the value of attribute additional_remittance_information.
-
#agent_lei ⇒ Object
Returns the value of attribute agent_lei.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#batch_booking ⇒ Object
Returns the value of attribute batch_booking.
-
#bic ⇒ Object
Returns the value of attribute bic.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#iban ⇒ Object
Returns the value of attribute iban.
-
#instruction ⇒ Object
Returns the value of attribute instruction.
-
#instruction_priority ⇒ Object
Returns the value of attribute instruction_priority.
-
#name ⇒ Object
Returns the value of attribute name.
-
#purpose_code ⇒ Object
Returns the value of attribute purpose_code.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#remittance_information ⇒ Object
Returns the value of attribute remittance_information.
-
#requested_date ⇒ Object
Returns the value of attribute requested_date.
-
#structured_remittance_information ⇒ Object
Returns the value of attribute structured_remittance_information.
-
#structured_remittance_issuer ⇒ Object
Returns the value of attribute structured_remittance_issuer.
-
#structured_remittance_reference_type ⇒ Object
Returns the value of attribute structured_remittance_reference_type.
-
#uetr ⇒ Object
Returns the value of attribute uetr.
-
#ultimate_creditor_name ⇒ Object
Returns the value of attribute ultimate_creditor_name.
-
#ultimate_debtor_name ⇒ Object
Returns the value of attribute ultimate_debtor_name.
Instance Method Summary collapse
- #compatible_capabilities?(_profile) ⇒ Boolean abstract
-
#compatible_with?(profile) ⇒ Boolean
Whether this transaction can be rendered under the given profile.
-
#initialize(attributes = {}) ⇒ Transaction
constructor
A new instance of Transaction.
Methods included from Converter
Constructor Details
#initialize(attributes = {}) ⇒ Transaction
Returns a new instance of Transaction.
78 79 80 81 82 83 84 |
# File 'lib/sepa_rator/transaction.rb', line 78 def initialize(attributes = {}) super self.requested_date ||= DEFAULT_REQUESTED_DATE self.reference ||= 'NOTPROVIDED' self.batch_booking = true if batch_booking.nil? self.currency ||= 'EUR' end |
Instance Attribute Details
#additional_remittance_information ⇒ Object
Returns the value of attribute additional_remittance_information.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def additional_remittance_information @additional_remittance_information end |
#agent_lei ⇒ Object
Returns the value of attribute agent_lei.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def agent_lei @agent_lei end |
#amount ⇒ Object
Returns the value of attribute amount.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def amount @amount end |
#batch_booking ⇒ Object
Returns the value of attribute batch_booking.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def batch_booking @batch_booking end |
#bic ⇒ Object
Returns the value of attribute bic.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def bic @bic end |
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def currency @currency end |
#iban ⇒ Object
Returns the value of attribute iban.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def iban @iban end |
#instruction ⇒ Object
Returns the value of attribute instruction.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def instruction @instruction end |
#instruction_priority ⇒ Object
Returns the value of attribute instruction_priority.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def instruction_priority @instruction_priority end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def name @name end |
#purpose_code ⇒ Object
Returns the value of attribute purpose_code.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def purpose_code @purpose_code end |
#reference ⇒ Object
Returns the value of attribute reference.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def reference @reference end |
#remittance_information ⇒ Object
Returns the value of attribute remittance_information.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def remittance_information @remittance_information end |
#requested_date ⇒ Object
Returns the value of attribute requested_date.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def requested_date @requested_date end |
#structured_remittance_information ⇒ Object
Returns the value of attribute structured_remittance_information.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def structured_remittance_information @structured_remittance_information end |
#structured_remittance_issuer ⇒ Object
Returns the value of attribute structured_remittance_issuer.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def structured_remittance_issuer @structured_remittance_issuer end |
#structured_remittance_reference_type ⇒ Object
Returns the value of attribute structured_remittance_reference_type.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def structured_remittance_reference_type @structured_remittance_reference_type end |
#uetr ⇒ Object
Returns the value of attribute uetr.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def uetr @uetr end |
#ultimate_creditor_name ⇒ Object
Returns the value of attribute ultimate_creditor_name.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def ultimate_creditor_name @ultimate_creditor_name end |
#ultimate_debtor_name ⇒ Object
Returns the value of attribute ultimate_debtor_name.
13 14 15 |
# File 'lib/sepa_rator/transaction.rb', line 13 def ultimate_debtor_name @ultimate_debtor_name end |
Instance Method Details
#compatible_capabilities?(_profile) ⇒ Boolean
Subclasses override to check that fields requiring capabilities (uetr, lei, etc.) are only set when the profile advertises them.
96 97 98 |
# File 'lib/sepa_rator/transaction.rb', line 96 def compatible_capabilities?(_profile) true end |
#compatible_with?(profile) ⇒ Boolean
Returns whether this transaction can be rendered under the given profile. Delegates to ‘profile.accepts?` for profile-level rules (e.g. EPC currency restrictions) and to `#compatible_capabilities?` for capability-level checks (UETR, LEI, mandate info, …).
90 91 92 |
# File 'lib/sepa_rator/transaction.rb', line 90 def compatible_with?(profile) profile.accepts?(self) && compatible_capabilities?(profile) end |