Browse files

Move some methods around.

  • Loading branch information...
1 parent 29429ef commit 8f2137686fb556875fe5c8e930dcf242a8e5bda8 @gabebw gabebw committed Jan 13, 2012
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/fake_braintree/customer.rb
View
32 lib/fake_braintree/customer.rb
@@ -38,22 +38,31 @@ def delete
private
- def customer_hash
- hash = @customer_hash.dup
- hash["id"] ||= create_id(@merchant_id)
- hash["credit_cards"] = generate_credit_cards_from(hash["credit_card"])
+ def invalid?
+ credit_card_is_failure? || invalid_credit_card?
+ end
- hash
+ def create_customer_with(hash)
+ FakeBraintree.registry.customers[hash["id"]] = hash
end
- def invalid?
- credit_card_is_failure? || invalid_credit_card?
+ def add_credit_card_to_registry(new_credit_card_hash)
+ token = new_credit_card_hash["token"]
+ FakeBraintree.registry.credit_cards[token] = new_credit_card_hash
end
def update_customer!(updates_hash)
customer_from_registry.merge!(updates_hash)
end
+ def customer_hash
+ hash = @customer_hash.dup
+ hash["id"] ||= create_id(@merchant_id)
+ hash["credit_cards"] = generate_credit_cards_from(hash["credit_card"])
+
+ hash
+ end
+
def customer_from_registry
FakeBraintree.registry.customers[customer_id]
end
@@ -90,15 +99,6 @@ def credit_card_number
credit_card_hash["number"]
end
- def create_customer_with(hash)
- FakeBraintree.registry.customers[hash["id"]] = hash
- end
-
- def add_credit_card_to_registry(new_credit_card_hash)
- token = new_credit_card_hash["token"]
- FakeBraintree.registry.credit_cards[token] = new_credit_card_hash
- end
-
def generate_credit_cards_from(new_credit_card_hash)
if new_credit_card_hash.present? && new_credit_card_hash.is_a?(Hash)
new_credit_card_hash["last_4"] = new_credit_card_hash["number"][-4..-1]

0 comments on commit 8f21376

Please sign in to comment.