Class: Sepa::DirectDebitOrder::Party
- Inherits:
-
Object
- Object
- Sepa::DirectDebitOrder::Party
- Includes:
- Helper
- Defined in:
- lib/sepa/direct_debit_order.rb
Instance Attribute Summary collapse
-
#address_line_1 ⇒ Object
Returns the value of attribute address_line_1.
-
#address_line_2 ⇒ Object
Returns the value of attribute address_line_2.
-
#contact_email ⇒ Object
Returns the value of attribute contact_email.
-
#contact_name ⇒ Object
Returns the value of attribute contact_name.
-
#contact_phone ⇒ Object
Returns the value of attribute contact_phone.
-
#country ⇒ Object
Returns the value of attribute country.
-
#name ⇒ Object
Returns the value of attribute name.
-
#postcode ⇒ Object
Returns the value of attribute postcode.
-
#town ⇒ Object
Returns the value of attribute town.
Instance Method Summary collapse
-
#initialize(name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email) ⇒ Party
constructor
A new instance of Party.
- #to_properties(prefix, opts) ⇒ Object
Methods included from Helper
#blank?, #blank_string?, #county_code
Constructor Details
#initialize(name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email) ⇒ Party
Returns a new instance of Party.
114 115 116 117 |
# File 'lib/sepa/direct_debit_order.rb', line 114 def initialize name, address_line_1, address_line_2, postcode, town, country, contact_name, contact_phone, contact_email @name, @address_line_1, @address_line_2, @postcode, @town, @country = name, address_line_1, address_line_2, postcode, town, country @contact_name, @contact_phone, @contact_email = contact_name, contact_phone, contact_email end |
Instance Attribute Details
#address_line_1 ⇒ Object
Returns the value of attribute address_line_1.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ Object
Returns the value of attribute address_line_2.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def address_line_2 @address_line_2 end |
#contact_email ⇒ Object
Returns the value of attribute contact_email.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def contact_email @contact_email end |
#contact_name ⇒ Object
Returns the value of attribute contact_name.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def contact_name @contact_name end |
#contact_phone ⇒ Object
Returns the value of attribute contact_phone.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def contact_phone @contact_phone end |
#country ⇒ Object
Returns the value of attribute country.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def country @country end |
#name ⇒ Object
Returns the value of attribute name.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def name @name end |
#postcode ⇒ Object
Returns the value of attribute postcode.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def postcode @postcode end |
#town ⇒ Object
Returns the value of attribute town.
112 113 114 |
# File 'lib/sepa/direct_debit_order.rb', line 112 def town @town end |
Instance Method Details
#to_properties(prefix, opts) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/sepa/direct_debit_order.rb', line 119 def to_properties prefix, opts cc = county_code country hsh = { "#{prefix}.name" => name } if (opts[:context] != :initiating_party) || (opts[:pain_008_001_version] != "02") hsh["#{prefix}.postal_address.address_line[0]"] = address_line_1 unless blank? address_line_1 if opts[:pain_008_001_version] == "02" candidate_adr_line_2 = "#{postcode} #{town}".strip address_line_2 = candidate_adr_line_2 unless blank? candidate_adr_line_2 hsh["#{prefix}.postal_address.address_line[1]"] = address_line_2 unless blank? address_line_2 else hsh["#{prefix}.postal_address.post_code"] = postcode unless blank? postcode hsh["#{prefix}.postal_address.town_name"] = town unless blank? town end hsh["#{prefix}.postal_address.country"] = cc unless blank? cc unless opts[:pain_008_001_version] == "02" hsh["#{prefix}.contact_details.name"] = contact_name unless blank? contact_name hsh["#{prefix}.contact_details.phone_number"] = contact_phone unless blank? contact_phone hsh["#{prefix}.contact_details.email_address"] = contact_email unless blank? contact_email end end hsh end |