Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce FakeBraintree::Subscription.
- Loading branch information
Gabe Berke-Williams
committed
Nov 3, 2011
1 parent
2aaf85c
commit e4e99f8
Showing
3 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module FakeBraintree | ||
class Subscription | ||
include Helpers | ||
|
||
def initialize(request) | ||
@subscription_hash = Hash.from_xml(request.body).delete("subscription") | ||
end | ||
|
||
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 | ||
end | ||
end | ||
end |