Permalink
Browse files

2.8.0

  • Loading branch information...
1 parent 6490977 commit a97da097a934fe23c02d2242aa2dff1fe406198a @braintreeps braintreeps committed Feb 22, 2011
View
@@ -1,3 +1,9 @@
+== 2.8.0
+
+* Added next_billing_date and transaction_id to subscription search
+* Added address_country_name to customer search
+* Added new error codes
+
== 2.7.0
* Added advanced vault search for customers and payment methods
@@ -1,6 +1,7 @@
module Braintree
class CustomerSearch < AdvancedSearch # :nodoc:
text_fields(
+ :address_country_name,
:address_extended_address,
:address_first_name,
:address_last_name,
@@ -111,6 +111,7 @@ module Subscription
PlanIdIsInvalid = "91904"
PriceCannotBeBlank = "81903"
PriceFormatIsInvalid = "81904"
+ PriceIsTooLarge = "81923"
StatusIsCanceled = "81905"
TokenFormatIsInvalid = "81906"
TrialDurationFormatIsInvalid = "81907"
@@ -120,6 +121,7 @@ module Subscription
module Modification
AmountCannotBeBlank = "92003"
AmountIsInvalid = "92002"
+ AmountIsTooLarge = "92023"
CannotEditModificationsOnPastDueSubscription = "92022"
CannotUpdateAndRemove = "92015"
ExistingIdIsIncorrectKind = "92020"
@@ -2,10 +2,10 @@ module Braintree
class SubscriptionSearch < AdvancedSearch # :nodoc:
multiple_value_field :in_trial_period
multiple_value_field :ids
- text_fields :id
+ text_fields :id, :transaction_id
multiple_value_or_text_field :plan_id
multiple_value_field :status, :allows => Subscription::Status::All
multiple_value_field :merchant_account_id
- range_fields :price, :days_past_due, :billing_cycles_remaining
+ range_fields :price, :days_past_due, :billing_cycles_remaining, :next_billing_date
end
end
View
@@ -1,7 +1,7 @@
module Braintree
module Version
Major = 2
- Minor = 7
+ Minor = 8
Tiny = 0
String = "#{Major}.#{Minor}.#{Tiny}"
@@ -55,6 +55,7 @@
:address_extended_address => "Suite 3",
:address_locality => "Chicago",
:address_region => "Illinois",
+ :address_country_name => "United States of America",
:payment_method_token => cctoken,
:cardholder_name => "Tim Tool",
:credit_card_expiration_date => "05/2010",
@@ -1286,6 +1286,49 @@
end
end
+ describe "transaction_id" do
+ it "returns matching results" do
+ matching_subscription = Braintree::Subscription.create(
+ :payment_method_token => @credit_card.token,
+ :plan_id => SpecHelper::TriallessPlan[:id]
+ ).subscription
+
+ non_matching_subscription = Braintree::Subscription.create(
+ :payment_method_token => @credit_card.token,
+ :plan_id => SpecHelper::TriallessPlan[:id]
+ ).subscription
+
+ collection = Braintree::Subscription.search do |search|
+ search.transaction_id.is matching_subscription.transactions.first.id
+ end
+
+ collection.should include(matching_subscription)
+ collection.should_not include(non_matching_subscription)
+ end
+ end
+
+ describe "next_billing_date" do
+ it "returns matching results" do
+ matching_subscription = Braintree::Subscription.create(
+ :payment_method_token => @credit_card.token,
+ :plan_id => SpecHelper::TriallessPlan[:id]
+ ).subscription
+
+ non_matching_subscription = Braintree::Subscription.create(
+ :payment_method_token => @credit_card.token,
+ :plan_id => SpecHelper::TrialPlan[:id]
+ ).subscription
+
+ five_days_from_now = Time.now + (5 * 24 * 60 * 60)
+ collection = Braintree::Subscription.search do |search|
+ search.next_billing_date >= five_days_from_now
+ end
+
+ collection.should include(matching_subscription)
+ collection.should_not include(non_matching_subscription)
+ end
+ end
+
it "returns multiple results" do
(110 - Braintree::Subscription.search.maximum_size).times do
Braintree::Subscription.create(:payment_method_token => @credit_card.token, :plan_id => SpecHelper::TrialPlan[:id])

0 comments on commit a97da09

Please sign in to comment.