Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Relying on the ivar being set is just weird.

  • Loading branch information...
commit e4cef67622f97cb92199ab43a0ce87a845cdc9b3 1 parent 9928436
@gabebw gabebw authored
View
10 lib/fake_braintree/customer.rb
@@ -40,7 +40,7 @@ def delete
def customer_hash
hash = @customer_hash.dup
- hash["id"] ||= create_id
+ hash["id"] ||= create_id(@merchant_id)
hash["credit_cards"] = generate_credit_cards_from(hash["credit_card"])
hash
@@ -54,14 +54,14 @@ def update_customer!(hash)
customer_from_registry.merge!(hash)
end
- def customer_exists_in_registry?
- FakeBraintree.registry.customers.key?(customer_id)
- end
-
def customer_from_registry
FakeBraintree.registry.customers[customer_id]
end
+ def customer_exists_in_registry?
+ FakeBraintree.registry.customers.key?(customer_id)
+ end
+
def credit_card_is_failure?
has_credit_card? && FakeBraintree.failure?(credit_card_hash["number"])
end
View
4 lib/fake_braintree/helpers.rb
@@ -16,8 +16,8 @@ def md5(content)
Digest::MD5.hexdigest(content)
end
- def create_id
- md5("#{@merchant_id}#{Time.now.to_f}")
+ def create_id(merchant_id)
+ md5("#{merchant_id}#{Time.now.to_f}")
end
end
end
View
2  lib/fake_braintree/redirect.rb
@@ -8,7 +8,7 @@ def initialize(params, merchant_id)
hash, query = *params[:tr_data].split("|", 2)
@transparent_data = Rack::Utils.parse_query(query)
@merchant_id = merchant_id
- @id = create_id
+ @id = create_id(@merchant_id)
@params = params
end
Please sign in to comment.
Something went wrong with that request. Please try again.