bankscrap-bbva 2.0.1 → 2.0.2

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
2
  SHA1:
3
- metadata.gz: 34df67e80fb703b3062b1ddb00ec2be8ad25b285
4
- data.tar.gz: bd806c0c5b61626262b542f0f2dd0e91f5c2562d
3
+ metadata.gz: 7375bc2b29f82081f0b061f7813d19a1ead36407
4
+ data.tar.gz: 60c6fc4d6460586b7294bf8d17e32782a010c0e8
5
5
  SHA512:
6
- metadata.gz: ccb5d6536cb19ca254d51708175c2a88f87dadcccb8a80f5dc156c309f48a3038b8d2812958f5b5d3e3f30a187bc015ce0863a37059fd864a1ddcf4496b40c00
7
- data.tar.gz: 35c34f71df5a9cee1dfa2f261ba657e9b72c78de72a848b8a1972cb2c630a4a5274eeb1bc63c393337e115b3486e1b15742c53675d0348e58bf107818f2d4ed0
6
+ metadata.gz: d28029fd657bab4a7c0b5353d065b6500ee42580b5cd4625277e2292e01244ce4c9feb35509d1bb9788f6a1f227b4b7528884e6a4d39528195457204182de726
7
+ data.tar.gz: 06b763f267465d31e60e8bfd641e01428edba1c922676c3757a653c813cb9bb2143dd338b380953da7f66e33f4a1f7c5deb01d0e05b18c2e83fd30cddb11e81e
@@ -106,16 +106,21 @@ module Bankscrap
106
106
 
107
107
  private
108
108
 
109
- # As far as we know there are two types of identifiers BBVA uses
109
+ # As far as we know there are three types of identifiers BBVA uses
110
110
  # 1) A number of 7 characters that gets passed to the API as it is
111
- # 2) A DNI number, this needs to transformed before it get passed to the API
111
+ # 2) A DNI number, this needs to be transformed before it gets passed to the API
112
112
  # Example: "49021740T" will become "0019-049021740T"
113
+ # 3) A NIE number, this needs to be transformed before it gets passed to the API
114
+ # Example: "X1234567T" will become "0019-X1234567T"
113
115
  def format_user(user)
114
116
  user.upcase!
115
117
 
116
118
  if user =~ /^[0-9]{8}[A-Z]$/
117
119
  # It's a DNI
118
120
  "0019-0#{user}"
121
+ elsif user =~ /^[X-Y]([0-9]{6}|[0-9]{7})[A-Z]$/
122
+ # It's a NIE
123
+ "0019-#{user}"
119
124
  else
120
125
  user
121
126
  end
@@ -1,5 +1,5 @@
1
1
  module Bankscrap
2
2
  module BBVA
3
- VERSION = '2.0.1'.freeze
3
+ VERSION = '2.0.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bankscrap-bbva
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Cuevas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bankscrap