virtual_merchant 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,25 +15,25 @@ class VMCreditCard
15
15
  end
16
16
 
17
17
  def from_swipe(swipe)
18
- self.track2 = self.extract_track_2(swipe)
19
- self.card_number = self.extract_card_number(swipe)
20
- self.expiration = self.extract_expiration(swipe)
21
- self.name_on_card = self.extract_name(swipe)
18
+ self.track2 = extract_track_2(swipe)
19
+ self.number = extract_card_number(swipe)
20
+ self.expiration = extract_expiration(swipe)
21
+ self.name_on_card = extract_name(swipe)
22
22
  end
23
23
 
24
- def self.extract_card_number(swipe)
24
+ def extract_card_number(swipe)
25
25
  card_number = swipe[2.. swipe.index('^')-1]
26
26
  card_number = card_number.split(' ').join('')
27
27
  end
28
28
 
29
- def self.extract_expiration(swipe)
29
+ def extract_expiration(swipe)
30
30
  secondCarrot = swipe.index("^", swipe.index("^")+1)
31
31
  card_expiration_year = swipe[secondCarrot+1..secondCarrot+2]
32
32
  card_expiration_month = swipe[(secondCarrot + 3)..(secondCarrot + 4)]
33
33
  card_expiration = card_expiration_month.to_s + card_expiration_year.to_s
34
34
  end
35
35
 
36
- def self.extract_name(swipe)
36
+ def extract_name(swipe)
37
37
  secondCarrot = swipe.index("^", swipe.index("^")+1)
38
38
  if swipe.index('/')
39
39
  first_name_on_card = swipe[swipe.index('/')+1..secondCarrot-1]
@@ -50,7 +50,7 @@ class VMCreditCard
50
50
  name_on_card = first_name_on_card + " " + last_name_on_card
51
51
  end
52
52
 
53
- def self.extract_track_2(swipe)
53
+ def extract_track_2(swipe)
54
54
  # Magtek reader: Track 2 starts with a semi-colon and goes to the end
55
55
  # I think that is standard for all readers, but not positive. -LQ
56
56
  track2 = swipe.slice(swipe.index(";"), swipe.length)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtual_merchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: