sepa 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 316f7e846361f530cd610c4a7855b4a4d5caedc7
4
- data.tar.gz: c21e65546b876eb0f243c0aa35c79cf425142d18
3
+ metadata.gz: d4072cdfea647ba64a6c088da670ca417343627d
4
+ data.tar.gz: dd4868a95de6fc3710df446f2e6446da288ccf2f
5
5
  SHA512:
6
- metadata.gz: 17cb2181595f131b274636a22cef58f1dab35d4efe0534cd98462d10a9852e3e474cd715998a06fee7eec7394ab3dca938a418c22159a47a036178b5aa5c1188
7
- data.tar.gz: bd89541c1a0b919301ba8fb6d4aecad8d54193f7344789a11b277c715fad849a529f0e7a069cc803406067e6ae59aac27308b6d9a35bdd463a59adb6d258bc97
6
+ metadata.gz: 1cdf86cc601beb305927a836dbbe8d78cba5e8b6482da96193d66ce450752ce46b6efa6a53ca6f7e1f46860f4ec520e4e11d212ae1d404046119a0efe5840955
7
+ data.tar.gz: 2433e3f55f8ab92ffef2e4356bf4341efb82f269db0a553de6938b1872249ce178697004ca667ba3553fe507ce34d766f2f3eb83b4d4e4a3d9a320bbe6057987
data/lib/sepa/base.rb CHANGED
@@ -1,5 +1,23 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module Sepa
3
+ class StringWithConstraint
4
+ attr_accessor :string
5
+
6
+ def initialize s
7
+ self.string = constrain s
8
+ end
9
+
10
+ def to_s
11
+ self.string
12
+ end
13
+ end
14
+
15
+ class Max70Text < StringWithConstraint
16
+ def constrain s
17
+ s[0..70]
18
+ end
19
+ end
20
+
3
21
  class Base
4
22
  include Aduki::Initializer
5
23
 
@@ -36,13 +54,17 @@ module Sepa
36
54
  gsub(/[^a-zA-Z0-9_@ \.,()'+\/\?-]/, '')
37
55
  end
38
56
 
57
+ def string_type? type_def
58
+ (type_def == :string) || (type_def.is_a?(Class) && type_def < StringWithConstraint)
59
+ end
60
+
39
61
  def to_xml builder
40
62
  self.class.attribute_defs.each do |name, meta|
41
63
  item = self.send(name)
42
64
  options = meta[:options] || { }
43
65
  attributes = build_xml_attributes options[:attributes]
44
66
  next if item == nil || (item.is_a?(Sepa::Base) && item.empty?)
45
- if meta[:type] == :string
67
+ if string_type?(meta[:type])
46
68
  builder.__send__(meta[:tag], normalize(item), attributes)
47
69
  elsif meta[:type] == :[]
48
70
  if meta[:member_type] == nil
@@ -1,6 +1,6 @@
1
1
  class Sepa::PaymentsInitiation::ContactDetails < Sepa::Base
2
2
  attribute :name_prefix , "NmPrfx"
3
- attribute :name , "Nm"
3
+ attribute :name , "Nm", Sepa::Max70Text
4
4
  attribute :phone_number , "PhneNb"
5
5
  attribute :mobile_number, "MobNb"
6
6
  attribute :fax_number , "FaxNb"
@@ -1,3 +1,5 @@
1
+ require 'sepa/payments_initiation/pain00800104/tax_authorisation'
2
+
1
3
  class Sepa::PaymentsInitiation::Pain00800104::TaxParty < Sepa::Base
2
4
  definition "Party to the transaction to which the tax applies."
3
5
  attribute :tax_identification, "TaxId"
@@ -4,7 +4,7 @@ require "sepa/payments_initiation/party_choice_identification"
4
4
 
5
5
  class Sepa::PaymentsInitiation::PartyIdentification < Sepa::Base
6
6
  definition "Set of elements used to identify a person or an organisation."
7
- attribute :name , "Nm"
7
+ attribute :name , "Nm" , Sepa::Max70Text
8
8
  attribute :postal_address , "PstlAdr" , Sepa::PaymentsInitiation::PostalAddress
9
9
  attribute :identification , "Id" , Sepa::PaymentsInitiation::PartyChoiceIdentification
10
10
  attribute :country_of_residence, "CtryOfRes"
data/lib/sepa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sepa
2
- VERSION = "0.0.17"
2
+ VERSION = "0.0.18"
3
3
  end
@@ -113,7 +113,7 @@
113
113
  </FinInstnId>
114
114
  </DbtrAgt>
115
115
  <Dbtr>
116
- <Nm>ADAMS/SAMUELMR</Nm>
116
+ <Nm>ADAMS/SAMUELMR567892_2345678_3_2345678_4_2345678_5_2345678_6_12345678_7</Nm>
117
117
  <PstlAdr>
118
118
  <PstCd>75048</PstCd>
119
119
  <TwnNm>PARIS</TwnNm>
@@ -54,7 +54,7 @@ describe Sepa::PaymentsInitiation::Pain00800104::CustomerDirectDebitInitiation d
54
54
  "payment_information[0].direct_debit_transaction_information[1].instructed_amount_currency" => "EUR",
55
55
  "payment_information[0].direct_debit_transaction_information[1].direct_debit_transaction.mandate_related_information.mandate_identification" => "mandate-id-1",
56
56
  "payment_information[0].direct_debit_transaction_information[1].debtor_agent.financial_institution_identification.bic_fi" => "FRQQWIGGA",
57
- "payment_information[0].direct_debit_transaction_information[1].debtor.name" => "ADAMS/SAMUELMR",
57
+ "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
58
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.address_line[0]" => "256, Livva de Getamire",
59
59
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.post_code" => "75048",
60
60
  "payment_information[0].direct_debit_transaction_information[1].debtor.postal_address.town_name" => "PARIS",
metadata CHANGED
@@ -1,96 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conan Dalton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-26 00:00:00.000000000 Z
11
+ date: 2014-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aduki
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: countries
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.9.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.9.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.9'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec_numbering_formatter
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: ' Generate ISO20022 XML messages. Implements a subset of pain.008.001.02
83
+ description: " Generate ISO20022 XML messages. Implements a subset of pain.008.001.02
84
84
  and pain.008.001.04 CustomerDirectDebitInitiation for now. WARNING: NO WARRANTY,
85
- USE AT YOUR OWN RISK AND PERIL. '
85
+ USE AT YOUR OWN RISK AND PERIL. "
86
86
  email:
87
87
  - conan@conandalton.net
88
88
  executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
- - .gitignore
93
- - .rspec
92
+ - ".gitignore"
93
+ - ".rspec"
94
94
  - Gemfile
95
95
  - LICENSE.txt
96
96
  - README.md
@@ -162,17 +162,17 @@ require_paths:
162
162
  - lib
163
163
  required_ruby_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - '>='
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
167
  version: '0'
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  requirements:
170
- - - '>='
170
+ - - ">="
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
174
  rubyforge_project:
175
- rubygems_version: 2.1.11
175
+ rubygems_version: 2.2.2
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: 'pain.008.001.04 and pain.008.001.02 CustomerDirectDebitInitiation ISO20022