Skip to content
This repository
Browse code

Relying on the ivar being set is just weird.

  • Loading branch information...
commit e4cef67622f97cb92199ab43a0ce87a845cdc9b3 1 parent 9928436
Gabe Berke-Williams authored January 13, 2012
10  lib/fake_braintree/customer.rb
@@ -40,7 +40,7 @@ def delete
40 40
 
41 41
     def customer_hash
42 42
       hash = @customer_hash.dup
43  
-      hash["id"] ||= create_id
  43
+      hash["id"] ||= create_id(@merchant_id)
44 44
       hash["credit_cards"] = generate_credit_cards_from(hash["credit_card"])
45 45
 
46 46
       hash
@@ -54,14 +54,14 @@ def update_customer!(hash)
54 54
       customer_from_registry.merge!(hash)
55 55
     end
56 56
 
57  
-    def customer_exists_in_registry?
58  
-      FakeBraintree.registry.customers.key?(customer_id)
59  
-    end
60  
-
61 57
     def customer_from_registry
62 58
       FakeBraintree.registry.customers[customer_id]
63 59
     end
64 60
 
  61
+    def customer_exists_in_registry?
  62
+      FakeBraintree.registry.customers.key?(customer_id)
  63
+    end
  64
+
65 65
     def credit_card_is_failure?
66 66
       has_credit_card? && FakeBraintree.failure?(credit_card_hash["number"])
67 67
     end
4  lib/fake_braintree/helpers.rb
@@ -16,8 +16,8 @@ def md5(content)
16 16
       Digest::MD5.hexdigest(content)
17 17
     end
18 18
 
19  
-    def create_id
20  
-      md5("#{@merchant_id}#{Time.now.to_f}")
  19
+    def create_id(merchant_id)
  20
+      md5("#{merchant_id}#{Time.now.to_f}")
21 21
     end
22 22
   end
23 23
 end
2  lib/fake_braintree/redirect.rb
@@ -8,7 +8,7 @@ def initialize(params, merchant_id)
8 8
       hash, query = *params[:tr_data].split("|", 2)
9 9
       @transparent_data = Rack::Utils.parse_query(query)
10 10
       @merchant_id = merchant_id
11  
-      @id = create_id
  11
+      @id = create_id(@merchant_id)
12 12
       @params = params
13 13
     end
14 14
 

0 notes on commit e4cef67

Please sign in to comment.
Something went wrong with that request. Please try again.