sepa_king 0.4.0 → 0.5.0

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: eb96b170a8acd00636509ac62a5bccc71a021c51
4
- data.tar.gz: 7891df444dd4d48f880c00de9726ab9d15aeee02
3
+ metadata.gz: 31135b499c4feea2fb23f4b0378637220e2e36ef
4
+ data.tar.gz: 5e073a7c3dd05cfba2ebb4dc88aa6bcdf803faab
5
5
  SHA512:
6
- metadata.gz: cb894f09d419a8b8343d54d901ae90c051340aecaed797895d89f61d0e90cfeb18917b33289a1dd90dfb6b51934835b00e6142f69278e2d51731f2c12f4f29e7
7
- data.tar.gz: ce5d81ca206169d78e046f2dc7bac69029989e348e29eb83e709c3af3f6140e1fe11a7d05916711afde575aa82787cafde0202f605580817f8c3466a09177885
6
+ metadata.gz: 9b7ee7b9cf4962fa4caa9d807e09bbb5b111cf307aa5dcd58d366110132e15eab841364dc30cb2e6aab3ebd1eb3373bc04eae8a8595d9c76548c0512ec3f1b86
7
+ data.tar.gz: f656ff1bba65a9e711fa1f58c169ce637c24ad2af6069c099bb16b7a61a2a10e1bd2822af841b06c1b2138e58a52cb01080c33acdda67d07721a9560e7187a6b
data/.travis.yml CHANGED
@@ -1,10 +1,12 @@
1
1
  rvm:
2
2
  - 1.9.3
3
- - 2.0.0
4
- - 2.1.1
3
+ - 2.0
4
+ - 2.1
5
+ - 2.2
5
6
  gemfile:
6
7
  - gemfiles/Gemfile-activemodel-3.0.x
7
8
  - gemfiles/Gemfile-activemodel-3.1.x
8
9
  - gemfiles/Gemfile-activemodel-3.2.x
9
10
  - gemfiles/Gemfile-activemodel-4.0.x
10
11
  - gemfiles/Gemfile-activemodel-4.1.x
12
+ - gemfiles/Gemfile-activemodel-4.2.x
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Georg Leciejewski (Sales King GmbH) & Georg Ledermann
1
+ Copyright (c) 2013-2015 Georg Leciejewski (Sales King GmbH) & Georg Ledermann
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Ruby gem for creating SEPA XML files
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/salesking/sepa_king.png)](http://travis-ci.org/salesking/sepa_king)
4
- [![Code Climate](https://codeclimate.com/github/salesking/sepa_king.png)](https://codeclimate.com/github/salesking/sepa_king)
5
- [![Coverage Status](https://coveralls.io/repos/salesking/sepa_king/badge.png)](https://coveralls.io/r/salesking/sepa_king)
6
- [![Gem Version](https://badge.fury.io/rb/sepa_king.png)](http://badge.fury.io/rb/sepa_king)
7
- [![Dependency Status](https://gemnasium.com/salesking/sepa_king.png)](https://gemnasium.com/salesking/sepa_king)
3
+ [![Build Status](https://travis-ci.org/salesking/sepa_king.svg)](http://travis-ci.org/salesking/sepa_king)
4
+ [![Code Climate](https://codeclimate.com/github/salesking/sepa_king/badges/gpa.svg)](https://codeclimate.com/github/salesking/sepa_king)
5
+ [![Coverage Status](https://coveralls.io/repos/salesking/sepa_king/badge.svg?branch=master)](https://coveralls.io/r/salesking/sepa_king?branch=master)
6
+ [![Gem Version](https://badge.fury.io/rb/sepa_king.svg)](http://badge.fury.io/rb/sepa_king)
7
+ [![Dependency Status](https://gemnasium.com/salesking/sepa_king.svg)](https://gemnasium.com/salesking/sepa_king)
8
8
 
9
9
  We love building payment applications! So after developing the [DTAUS library for Ruby](https://github.com/salesking/king_dtaus) we move on with SEPA.
10
10
 
@@ -175,7 +175,7 @@ sct.add_transaction(
175
175
 
176
176
  # OPTIONAL: Unstructured remittance information, in German "Verwendungszweck"
177
177
  # String, max. 140 char
178
- remittance_information: 'Rechnung vom 22.08.2013'
178
+ remittance_information: 'Rechnung vom 22.08.2013',
179
179
 
180
180
  # OPTIONAL: Requested execution date, in German "Ausführungstermin"
181
181
  # Date
@@ -224,6 +224,8 @@ class Payment < ActiveRecord::Base
224
224
  end
225
225
  ```
226
226
 
227
+ **Beware:** The SEPA::IBANValidator is strict - e.g. it does not allow any spaces in the IBAN.
228
+
227
229
  Also see:
228
230
  * [lib/sepa_king/validator.rb](https://github.com/salesking/sepa_king/blob/master/lib/sepa_king/validator.rb)
229
231
  * [lib/sepa_king/transaction/direct_debit_transaction.rb](https://github.com/salesking/sepa_king/blob/master/lib/sepa_king/transaction/direct_debit_transaction.rb)
@@ -249,4 +251,4 @@ https://github.com/salesking/sepa_king/graphs/contributors
249
251
 
250
252
  Released under the MIT license
251
253
 
252
- Copyright (c) 2013 Georg Leciejewski (SalesKing), Georg Ledermann (https://github.com/ledermann)
254
+ Copyright (c) 2013-2015 Georg Leciejewski (SalesKing), Georg Ledermann (https://github.com/ledermann)
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ gem 'activemodel', '~>4.2.0'
@@ -12,7 +12,7 @@ module SEPA
12
12
 
13
13
  def initialize(attributes = {})
14
14
  attributes.each do |name, value|
15
- send("#{name}=", value)
15
+ public_send("#{name}=", value)
16
16
  end
17
17
  end
18
18
  end
@@ -1,17 +1,21 @@
1
1
  # encoding: utf-8
2
2
  module SEPA
3
3
  class IBANValidator < ActiveModel::Validator
4
+ # IBAN2007Identifier (taken from schema)
5
+ REGEX = /\A[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}\z/
6
+
4
7
  def validate(record)
5
8
  field_name = options[:field_name] || :iban
6
- value = record.send(field_name)
9
+ value = record.send(field_name).to_s
7
10
 
8
- unless IBANTools::IBAN.valid?(value.to_s)
11
+ unless IBANTools::IBAN.valid?(value) && value.match(REGEX)
9
12
  record.errors.add(field_name, :invalid)
10
13
  end
11
14
  end
12
15
  end
13
16
 
14
17
  class BICValidator < ActiveModel::Validator
18
+ # AnyBICIdentifier (taken from schema)
15
19
  REGEX = /\A[A-Z]{6,6}[A-Z2-9][A-NP-Z0-9]([A-Z0-9]{3,3}){0,1}\z/
16
20
 
17
21
  def validate(record)
@@ -1,3 +1,3 @@
1
1
  module SEPA
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
@@ -14,7 +14,12 @@ describe SEPA::IBANValidator do
14
14
  end
15
15
 
16
16
  it 'should not accept an invalid IBAN' do
17
- expect(Validatable).not_to accept('', 'xxx', 'DE22500500009876543210', 'DE2150050000987654321', for: [:iban, :iban_the_terrible])
17
+ expect(Validatable).not_to accept('', 'xxx', # Oviously no IBAN
18
+ 'DE22500500009876543210', # wrong checksum
19
+ 'DE2150050000987654321', # too short
20
+ 'de87200500001234567890', # downcase characters
21
+ 'DE87 2005 0000 1234 5678 90', # spaces included
22
+ for: [:iban, :iban_the_terrible])
18
23
  end
19
24
  end
20
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepa_king
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Leciejewski
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-09 00:00:00.000000000 Z
12
+ date: 2015-06-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -172,6 +172,7 @@ files:
172
172
  - gemfiles/Gemfile-activemodel-3.2.x
173
173
  - gemfiles/Gemfile-activemodel-4.0.x
174
174
  - gemfiles/Gemfile-activemodel-4.1.x
175
+ - gemfiles/Gemfile-activemodel-4.2.x
175
176
  - lib/schema/pain.001.001.03.xsd
176
177
  - lib/schema/pain.001.002.03.xsd
177
178
  - lib/schema/pain.001.003.03.xsd
@@ -234,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
235
  version: '0'
235
236
  requirements: []
236
237
  rubyforge_project:
237
- rubygems_version: 2.2.2
238
+ rubygems_version: 2.4.8
238
239
  signing_key:
239
240
  specification_version: 4
240
241
  summary: Ruby gem for creating SEPA XML files