Browse files

2.9.0

  • Loading branch information...
1 parent a97da09 commit ab80f6f3e471f63869f08c0cf9269f0d7f7708ca @braintreeps braintreeps committed Mar 25, 2011
View
1 lib/braintree/error_codes.rb
@@ -152,6 +152,7 @@ module Transaction
CannotBeVoided = "91504"
CannotRefundCredit = "91505"
CannotRefundUnlessSettled = "91506"
+ CannotRefundWithSuspendedMerchantAccount = "91538"
CannotSubmitForSettlement = "91507"
CreditCardIsRequired = "91508"
CustomFieldIsInvalid = "91526"
View
1 lib/braintree/transaction.rb
@@ -16,6 +16,7 @@ module GatewayRejectionReason
end
module Status
+ AuthorizationExpired = 'authorization_expired'
Authorizing = 'authorizing'
Authorized = 'authorized'
GatewayRejected = 'gateway_rejected'
View
3 lib/braintree/transaction_search.rb
@@ -60,7 +60,8 @@ class TransactionSearch < AdvancedSearch # :nodoc:
key_value_fields :refund
- range_fields :amount, :created_at, :authorized_at, :failed_at, :gateway_rejected_at, :processor_declined_at,
+ range_fields :amount, :created_at, :authorization_expired_at, :authorized_at,
+ :failed_at, :gateway_rejected_at, :processor_declined_at,
:settled_at, :submitted_for_settlement_at, :voided_at
end
end
View
36 spec/integration/braintree/transaction_search_spec.rb
@@ -263,9 +263,9 @@
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Authorize,
:credit_card => {
- :number => Braintree::Test::CreditCardNumbers::Visa,
- :expiration_date => "05/12"
- }
+ :number => Braintree::Test::CreditCardNumbers::Visa,
+ :expiration_date => "05/12"
+ }
)
collection = Braintree::Transaction.search do |search|
@@ -290,6 +290,15 @@
collection.maximum_size.should == 0
end
+ it "finds expired authorizations by status" do
+ collection = Braintree::Transaction.search do |search|
+ search.status.in Braintree::Transaction::Status::AuthorizationExpired
+ end
+
+ collection.maximum_size.should > 0
+ collection.first.status.should == Braintree::Transaction::Status::AuthorizationExpired
+ end
+
it "searches on source" do
transaction = Braintree::Transaction.sale!(
:amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -626,6 +635,27 @@
collection.first.id.should == transaction.id
end
+ it "finds expired authorizations in a given range" do
+ collection = Braintree::Transaction.search do |search|
+ search.authorization_expired_at.between(
+ Date.today - 2,
+ Date.today - 1
+ )
+ end
+
+ collection.maximum_size.should == 0
+
+ collection = Braintree::Transaction.search do |search|
+ search.authorization_expired_at.between(
+ Date.today - 1,
+ Date.today + 1
+ )
+ end
+
+ collection.maximum_size.should > 0
+ collection.first.status.should == Braintree::Transaction::Status::AuthorizationExpired
+ end
+
it "finds transactions gateway_rejected in a given range" do
old_merchant = Braintree::Configuration.merchant_id
old_public_key = Braintree::Configuration.public_key

0 comments on commit ab80f6f

Please sign in to comment.