Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Return the payment method token like Braintree does, so customers/sub…

…scriptions can be cross-referenced
  • Loading branch information...
commit 707b336ddc773070d4d1882ca6e0e7a75b643621 1 parent 36f2b5e
@jferris jferris authored
View
13 lib/fake_braintree/subscription.rb
@@ -8,12 +8,13 @@ def initialize(request)
def response_hash
response_hash = {}
- response_hash["id"] = md5("#{@subscription_hash["payment_method_token"]}#{Time.now.to_f}")[0,6]
- response_hash["transactions"] = []
- response_hash["add_ons"] = []
- response_hash["discounts"] = []
- response_hash["next_billing_date"] = 1.month.from_now
- response_hash["status"] = Braintree::Subscription::Status::Active
+ response_hash["id"] = md5("#{@subscription_hash["payment_method_token"]}#{Time.now.to_f}")[0,6]
+ response_hash["transactions"] = []
+ response_hash["add_ons"] = []
+ response_hash["discounts"] = []
+ response_hash["next_billing_date"] = 1.month.from_now
+ response_hash["payment_method_token"] = @subscription_hash["payment_method_token"]
+ response_hash["status"] = Braintree::Subscription::Status::Active
response_hash
end
View
5 spec/fake_braintree/subscription_spec.rb
@@ -54,5 +54,10 @@
it "raises a Braintree:NotFoundError when it cannot find a subscription" do
expect { Braintree::Subscription.find('abc123') }.to raise_error(Braintree::NotFoundError, /abc123/)
end
+
+ it "can find the associated customer" do
+ subscription = Braintree::Subscription.find(subscription_result.subscription.id)
+ subscription.payment_method_token.should == payment_method_token
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.