Skip to content

Commit

Permalink
Relying on the ivar being set is just weird.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Jan 13, 2012
1 parent 9928436 commit e4cef67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions lib/fake_braintree/customer.rb
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/fake_braintree/helpers.rb
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/fake_braintree/redirect.rb
Expand Up @@ -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

Expand Down

0 comments on commit e4cef67

Please sign in to comment.