sepa 0.0.19 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d75033937c180d496d10dc6fdfc6fb66b52d8784
4
- data.tar.gz: 9a9a5c484fcdde9e1498b27345f8cb758279b96f
2
+ SHA256:
3
+ metadata.gz: a183c8a185ca6b9077d42eb3269bbb757e81809dec8607ef13bd0609a5da2027
4
+ data.tar.gz: 37e39aeb120fa65b65eff4355f4948e9a1182b75cf915ceef6f19b216f5a0560
5
5
  SHA512:
6
- metadata.gz: 37b47194ed56a516a6e162b113d5db6f929913e0ad434f446fdff69f35e0e12320c747f679f7c286ce6adc401085406082127680009b5b5803e77ce834527875
7
- data.tar.gz: 02a182a32f13c526a0a5364523c99ffec035b1b220cf1cdc15c482dbb658e6c185527c937748b8313d6d9f08577f6f159b39a50656ab8835882dc37f2495b727
6
+ metadata.gz: f103db3c12ca1bf92df6482019c8b096120949a70554bb0aaef52c9c289098c8ca56c27ee5382333e5a2b402c9354dfffb1b1cdc05e51769d0f6a5962c30ed1a
7
+ data.tar.gz: 3a34cd26af6a2743351b9aa9d4dc1430f0413e7f085ea4e9c2112972091f68ac8907b8189e98b73c517662ddece1929d9489a237569a9818d7d371f617d58093
data/lib/sepa/base.rb CHANGED
@@ -16,9 +16,21 @@ module Sepa
16
16
  end
17
17
  end
18
18
 
19
+ class Max140Text < StringWithConstraint
20
+ def constrain s
21
+ s ? s.to_s.strip[0...140] : ''
22
+ end
23
+ end
24
+
19
25
  class Max70Text < StringWithConstraint
20
26
  def constrain s
21
- s ? s.to_s.strip[0..70] : ''
27
+ s ? s.to_s.strip[0...70] : ''
28
+ end
29
+ end
30
+
31
+ class Max35Text < StringWithConstraint
32
+ def constrain s
33
+ s ? s.to_s.strip[0...35] : ''
22
34
  end
23
35
  end
24
36
 
@@ -30,7 +30,7 @@ class Sepa::DirectDebitOrder
30
30
 
31
31
  def county_code name
32
32
  return "" if blank?(name)
33
- name = name.upcase
33
+ name = name.upcase.strip
34
34
  return name if name.match(/^[A-Z]{2}$/)
35
35
  country = ISO3166::Country.find_country_by_name(name)
36
36
  country ? country.alpha2 : ""
@@ -130,7 +130,7 @@ class Sepa::DirectDebitOrder
130
130
  hsh["#{prefix}.postal_address.post_code"] = postcode unless blank? postcode
131
131
  hsh["#{prefix}.postal_address.town_name"] = town unless blank? town
132
132
  end
133
- hsh["#{prefix}.postal_address.country"] = cc unless blank? cc
133
+ hsh["#{prefix}.postal_address.country"] = cc unless blank? cc
134
134
 
135
135
  unless opts[:pain_008_001_version] == "02"
136
136
  hsh["#{prefix}.contact_details.name"] = contact_name unless blank? contact_name
@@ -1,7 +1,7 @@
1
1
  require "sepa/payments_initiation/pain00800104/direct_debit_transaction_information"
2
2
 
3
3
  class Sepa::PaymentsInitiation::Pain00800104::PaymentInformation < Sepa::Base
4
- attribute :payment_information_identification , "PmtInfId"
4
+ attribute :payment_information_identification , "PmtInfId" , Sepa::Max35Text
5
5
  attribute :payment_method , "PmtMtd"
6
6
  attribute :batch_booking , "BtchBookg"
7
7
  attribute :number_of_transactions , "NbOfTxs"
@@ -1,9 +1,9 @@
1
1
  class Sepa::PaymentsInitiation::Pain00800104::RemittanceInformationChoice < Sepa::Base
2
- attribute :unstructured_remittance_information , "Ustrd"
2
+ attribute :unstructured_remittance_information , "Ustrd", Sepa::Max70Text
3
3
  # don't think this is commonly used; would probably need a class
4
4
  attribute :structured_remittance_information , "Strd"
5
5
 
6
6
  def empty?
7
- [unstructured_remittance_information, structured_remittance_information].compact == []
7
+ [unstructured_remittance_information, structured_remittance_information].compact.join.strip == ""
8
8
  end
9
- end
9
+ end
data/lib/sepa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sepa
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.21"
3
3
  end
data/sepa.gemspec CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency 'builder'
19
19
  gem.add_dependency 'aduki'
20
20
  gem.add_dependency 'countries', "~> 0.9.3"
21
- gem.add_development_dependency 'rspec', '~> 2.9'
22
- gem.add_development_dependency 'rspec_numbering_formatter'
21
+ gem.add_development_dependency 'rspec'
23
22
 
24
23
  gem.files = `git ls-files`.split($/)
25
24
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -44,7 +44,8 @@ describe Sepa::DirectDebitOrder do
44
44
  sepa_now = Time.local(1992, 2, 28, 18, 30, 0, 0, 0)
45
45
  Time.stub(:now).and_return sepa_now
46
46
 
47
- creditor = Sepa::DirectDebitOrder::Party.new "Mon École", "3, Livva de Getamire", nil, "75022", "Paris", "Frankreich", "M. le Directeur", "+33 999 999 999", "directeur@monecole.softify.com"
47
+ # leading/trailing whitespace breaks country recognition
48
+ creditor = Sepa::DirectDebitOrder::Party.new "Mon École", "3, Livva de Getamire", nil, "75022", "Paris", " Frankreich ", "M. le Directeur", "+33 999 999 999", "directeur@monecole.softify.com"
48
49
  creditor_account = Sepa::DirectDebitOrder::BankAccount.new "FRGOO GOOY ADDA 9999 999", "FRGGYELLOW99"
49
50
  sepa_identifier = sepa_identifier_class.new "FR123ZZZ010203"
50
51
  payment = Sepa::DirectDebitOrder::CreditorPayment.new creditor, creditor_account, "MONECOLE_PAYMENTS_20130703", Date.parse("2013-07-10"), sepa_identifier, [dd00, dd01, dd10, dd11, dd20, dd21, dd30, dd31]
@@ -83,7 +83,7 @@
83
83
  <PstCd>30005</PstCd>
84
84
  <TwnNm>RENNES</TwnNm>
85
85
  <Ctry>FR</Ctry>
86
- <AdrLine>64, Livva de Getamire 2345678 30 345678 40 345678 50 345678 60 345678 7</AdrLine>
86
+ <AdrLine>64, Livva de Getamire 345678 30 345678 40 345678 50 345678 60 345678 7</AdrLine>
87
87
  </PstlAdr>
88
88
  <CtctDtls>
89
89
  <Nm>Conan DALTON</Nm>
@@ -116,7 +116,7 @@
116
116
  </FinInstnId>
117
117
  </DbtrAgt>
118
118
  <Dbtr>
119
- <Nm>ADAMS/SAMUELMR567892_2345678_3_2345678_4_2345678_5_2345678_6_12345678_7</Nm>
119
+ <Nm>ADAMS/SAMUELMR567892_2345678_3_2345678_4_2345678_5_2345678_6_2345678_7</Nm>
120
120
  <PstlAdr>
121
121
  <PstCd>75048</PstCd>
122
122
  <TwnNm>PARIS</TwnNm>
@@ -41,7 +41,7 @@ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation d
41
41
  "payment_information[0].direct_debit_transaction_information[0].direct_debit_transaction.mandate_related_information.mandate_identification" => "mandate-id-0",
42
42
  "payment_information[0].direct_debit_transaction_information[0].debtor_agent.financial_institution_identification.bic_fi" => "FRZZPPKOOKOO",
43
43
  "payment_information[0].direct_debit_transaction_information[0].debtor.name" => "DALTON/CONANMR",
44
- "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.address_line[0]" => "64, Livva de Getamire 2345678 30 345678 40 345678 50 345678 60 345678 70 345678 80",
44
+ "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.address_line[0]" => "64, Livva de Getamire 345678 30 345678 40 345678 50 345678 60 345678 70 345678 80",
45
45
  "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.post_code" => "30005",
46
46
  "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.town_name" => "RENNES",
47
47
  "payment_information[0].direct_debit_transaction_information[0].debtor.postal_address.country" => "FR",
@@ -55,7 +55,7 @@ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation d
55
55
  "payment_information[0].direct_debit_transaction_information[1].instructed_amount_currency" => "EUR",
56
56
  "payment_information[0].direct_debit_transaction_information[1].direct_debit_transaction.mandate_related_information.mandate_identification" => "mandate-id-1",
57
57
  "payment_information[0].direct_debit_transaction_information[1].debtor_agent.financial_institution_identification.bic_fi" => "FRQQWIGGA",
58
- "payment_information[0].direct_debit_transaction_information[1].debtor.name" => " ADAMS/SAMUELMR567892_2345678_3_2345678_4_2345678_5_2345678_6_12345678_7_2345678_should-be-truncated-at-70-chars ",
58
+ "payment_information[0].direct_debit_transaction_information[1].debtor.name" => " ADAMS/SAMUELMR567892_2345678_3_2345678_4_2345678_5_2345678_6_2345678_7_2345678_should-be-truncated-at-70-chars ",
59
59
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.address_line[0]" => "256, Livva de Getamire",
60
60
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.post_code" => "75048",
61
61
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.town_name" => "PARIS",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -54,20 +54,6 @@ dependencies:
54
54
  version: 0.9.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2.9'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.9'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec_numbering_formatter
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -173,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
159
  - !ruby/object:Gem::Version
174
160
  version: '0'
175
161
  requirements: []
176
- rubyforge_project:
177
- rubygems_version: 2.2.2
162
+ rubygems_version: 3.0.3.1
178
163
  signing_key:
179
164
  specification_version: 4
180
165
  summary: 'pain.008.001.04 and pain.008.001.02 CustomerDirectDebitInitiation ISO20022