Permalink
Browse files

2.13.0

  • Loading branch information...
1 parent 5b9ed46 commit e5f9faa904a42975a124c50c1df896f64d2f8f54 @braintreeps braintreeps committed Nov 3, 2011
View
@@ -1,3 +1,8 @@
+== 2.13.0
+
+* Added new error code for merchant accounts that do not support refunds
+* Added GEMSPEC file
+
== 2.12.0
* Added ability to retrieve all Plans, AddOns and Discounts
View
@@ -18,23 +18,8 @@ Spec::Rake::SpecTask.new("spec:integration") do |t|
t.spec_files = FileList["spec/integration/**/*_spec.rb"]
end
-require File.dirname(__FILE__) + "/lib/braintree/version.rb"
-gem_spec = Gem::Specification.new do |s|
- s.name = "braintree"
- s.summary = "Braintree Gateway Ruby Client Library"
- s.description = "Ruby library for integrating with the Braintree Gateway"
- s.version = Braintree::Version::String
- s.author = "Braintree"
- s.email = "code@getbraintree.com"
- s.homepage = "http://www.braintreepayments.com/"
- s.rubyforge_project = "braintree"
- s.has_rdoc = false
- s.files = FileList["README.rdoc", "LICENSE", "{lib,spec}/**/*.rb", "lib/**/*.crt"]
- s.add_dependency "builder", ">= 2.0.0"
-end
-
task :gem do
- Gem::Builder.new(gem_spec).build
+ exec('gem build braintree.gemspec')
end
require File.dirname(__FILE__) + "/lib/braintree/configuration.rb"
View
@@ -0,0 +1,5 @@
+# braintree-ruby.gems generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator
+builder -v2.1.2
+libxml-ruby -v1.1.3
+rake_commit -v0.11.0
+rspec -v1.2.9
View
@@ -0,0 +1,17 @@
+$:.push File.expand_path("../lib", __FILE__)
+require 'braintree/version'
+
+Gem::Specification.new do |s|
+ s.name = "braintree"
+ s.summary = "Braintree Gateway Ruby Client Library"
+ s.description = "Ruby library for integrating with the Braintree Gateway"
+ s.version = Braintree::Version::String
+ s.author = "Braintree"
+ s.email = "code@getbraintree.com"
+ s.homepage = "http://www.braintreepayments.com/"
+ s.rubyforge_project = "braintree"
+ s.has_rdoc = false
+ s.files = Dir.glob ["README.rdoc", "LICENSE", "{lib,spec}/**/*.rb", "lib/**/*.crt", "*.gemspec"]
+ s.add_dependency "builder", ">= 2.0.0"
+end
+
View
@@ -14,60 +14,60 @@
require "builder"
-require File.dirname(__FILE__) + "/braintree/exceptions"
+require "braintree/exceptions"
-require File.dirname(__FILE__) + "/braintree/base_module"
-require File.dirname(__FILE__) + "/braintree/modification"
+require "braintree/base_module"
+require "braintree/modification"
-require File.dirname(__FILE__) + "/braintree/add_on"
-require File.dirname(__FILE__) + "/braintree/add_on_gateway"
-require File.dirname(__FILE__) + "/braintree/address/country_names"
-require File.dirname(__FILE__) + "/braintree/address"
-require File.dirname(__FILE__) + "/braintree/address_gateway"
-require File.dirname(__FILE__) + "/braintree/advanced_search"
-require File.dirname(__FILE__) + "/braintree/configuration"
-require File.dirname(__FILE__) + "/braintree/credit_card"
-require File.dirname(__FILE__) + "/braintree/credit_card_gateway"
-require File.dirname(__FILE__) + "/braintree/credit_card_verification"
-require File.dirname(__FILE__) + "/braintree/customer"
-require File.dirname(__FILE__) + "/braintree/customer_gateway"
-require File.dirname(__FILE__) + "/braintree/customer_search"
-require File.dirname(__FILE__) + "/braintree/descriptor"
-require File.dirname(__FILE__) + "/braintree/digest"
-require File.dirname(__FILE__) + "/braintree/discount"
-require File.dirname(__FILE__) + "/braintree/discount_gateway"
-require File.dirname(__FILE__) + "/braintree/error_codes"
-require File.dirname(__FILE__) + "/braintree/error_result"
-require File.dirname(__FILE__) + "/braintree/errors"
-require File.dirname(__FILE__) + "/braintree/gateway"
-require File.dirname(__FILE__) + "/braintree/http"
-require File.dirname(__FILE__) + "/braintree/plan"
-require File.dirname(__FILE__) + "/braintree/plan_gateway"
-require File.dirname(__FILE__) + "/braintree/settlement_batch_summary"
-require File.dirname(__FILE__) + "/braintree/settlement_batch_summary_gateway"
-require File.dirname(__FILE__) + "/braintree/resource_collection"
-require File.dirname(__FILE__) + "/braintree/subscription"
-require File.dirname(__FILE__) + "/braintree/subscription_gateway"
-require File.dirname(__FILE__) + "/braintree/subscription_search"
-require File.dirname(__FILE__) + "/braintree/successful_result"
-require File.dirname(__FILE__) + "/braintree/test/credit_card_numbers"
-require File.dirname(__FILE__) + "/braintree/test/transaction_amounts"
-require File.dirname(__FILE__) + "/braintree/transaction"
-require File.dirname(__FILE__) + "/braintree/transaction/address_details"
-require File.dirname(__FILE__) + "/braintree/transaction/credit_card_details"
-require File.dirname(__FILE__) + "/braintree/transaction/customer_details"
-require File.dirname(__FILE__) + "/braintree/transaction/subscription_details"
-require File.dirname(__FILE__) + "/braintree/transaction_gateway"
-require File.dirname(__FILE__) + "/braintree/transaction_search"
-require File.dirname(__FILE__) + "/braintree/transaction/status_details"
-require File.dirname(__FILE__) + "/braintree/transparent_redirect"
-require File.dirname(__FILE__) + "/braintree/transparent_redirect_gateway"
-require File.dirname(__FILE__) + "/braintree/util"
-require File.dirname(__FILE__) + "/braintree/validation_error"
-require File.dirname(__FILE__) + "/braintree/validation_error_collection"
-require File.dirname(__FILE__) + "/braintree/version"
-require File.dirname(__FILE__) + "/braintree/xml"
-require File.dirname(__FILE__) + "/braintree/xml/generator"
-require File.dirname(__FILE__) + "/braintree/xml/libxml"
-require File.dirname(__FILE__) + "/braintree/xml/rexml"
-require File.dirname(__FILE__) + "/braintree/xml/parser"
+require "braintree/add_on"
+require "braintree/add_on_gateway"
+require "braintree/address/country_names"
+require "braintree/address"
+require "braintree/address_gateway"
+require "braintree/advanced_search"
+require "braintree/configuration"
+require "braintree/credit_card"
+require "braintree/credit_card_gateway"
+require "braintree/credit_card_verification"
+require "braintree/customer"
+require "braintree/customer_gateway"
+require "braintree/customer_search"
+require "braintree/descriptor"
+require "braintree/digest"
+require "braintree/discount"
+require "braintree/discount_gateway"
+require "braintree/error_codes"
+require "braintree/error_result"
+require "braintree/errors"
+require "braintree/gateway"
+require "braintree/http"
+require "braintree/plan"
+require "braintree/plan_gateway"
+require "braintree/settlement_batch_summary"
+require "braintree/settlement_batch_summary_gateway"
+require "braintree/resource_collection"
+require "braintree/subscription"
+require "braintree/subscription_gateway"
+require "braintree/subscription_search"
+require "braintree/successful_result"
+require "braintree/test/credit_card_numbers"
+require "braintree/test/transaction_amounts"
+require "braintree/transaction"
+require "braintree/transaction/address_details"
+require "braintree/transaction/credit_card_details"
+require "braintree/transaction/customer_details"
+require "braintree/transaction/subscription_details"
+require "braintree/transaction_gateway"
+require "braintree/transaction_search"
+require "braintree/transaction/status_details"
+require "braintree/transparent_redirect"
+require "braintree/transparent_redirect_gateway"
+require "braintree/util"
+require "braintree/validation_error"
+require "braintree/validation_error_collection"
+require "braintree/version"
+require "braintree/xml"
+require "braintree/xml/generator"
+require "braintree/xml/libxml"
+require "braintree/xml/rexml"
+require "braintree/xml/parser"
@@ -31,6 +31,7 @@ def delete(customer_or_customer_id, address_id)
def find(customer_or_customer_id, address_id)
customer_id = _determine_customer_id(customer_or_customer_id)
+ raise ArgumentError if address_id.nil? || address_id.strip.to_s == ""
response = @config.http.get("/customers/#{customer_id}/addresses/#{address_id}")
Address._new(@gateway, response[:address])
rescue NotFoundError
@@ -101,7 +101,7 @@ def server # :nodoc:
when :production
"www.braintreegateway.com"
when :qa
- "qa-master.braintreegateway.com"
+ "qa.braintreegateway.com"
when :sandbox
"sandbox.braintreegateway.com"
end
@@ -41,6 +41,7 @@ def expiring_between(start_date, end_date, options = {})
end
def find(token)
+ raise ArgumentError if token.nil? || token.strip.to_s == ""
response = @config.http.get "/payment_methods/#{token}"
CreditCard._new(@gateway, response[:credit_card])
rescue NotFoundError
@@ -33,7 +33,7 @@ def delete(customer_id)
def find(customer_id)
raise ArgumentError, "customer_id contains invalid characters" unless customer_id.to_s =~ /\A[\w-]+\z/
- raise ArgumentError, "customer_id cannot be blank" if customer_id.to_s == ""
+ raise ArgumentError, "customer_id cannot be blank" if customer_id.nil?|| customer_id.strip.to_s == ""
response = @config.http.get("/customers/#{customer_id}")
Customer._new(@gateway, response[:customer])
rescue NotFoundError
@@ -174,7 +174,8 @@ module Transaction
CustomerIdIsInvalid = "91510"
HasAlreadyBeenRefunded = "91512"
MerchantAccountIdIsInvalid = "91513"
- MerchantAccountIsSuspended = "91514"
+ MerchantAccountIsSuspended = "91515"
+ MerchantAccountDoesNotSupportRefunds = "91547"
MerchantAccountNameIsInvalid = "91513" # Deprecated
OrderIdIsTooLong = "91501"
PaymentMethodConflict = "91515"
@@ -24,6 +24,7 @@ def create(attributes)
end
def find(id)
+ raise ArgumentError if id.nil? || id.strip.to_s == ""
response = @config.http.get "/subscriptions/#{id}"
Subscription._new(@gateway, response[:subscription])
rescue NotFoundError
@@ -39,6 +39,8 @@ module Source
module Type # :nodoc:
Credit = "credit" # :nodoc:
Sale = "sale" # :nodoc:
+
+ All = constants.map { |c| const_get(c) }
end
attr_reader :avs_error_response_code, :avs_postal_code_response_code, :avs_street_address_response_code
@@ -31,6 +31,7 @@ def credit(attributes)
end
def find(id)
+ raise ArgumentError if id.nil? || id.strip.to_s == ""
response = @config.http.get "/transactions/#{id}"
Transaction._new(@gateway, response[:transaction])
rescue NotFoundError
@@ -56,7 +56,7 @@ class TransactionSearch < AdvancedSearch # :nodoc:
Transaction::Source::ControlPanel,
Transaction::Source::Recurring
]
- multiple_value_field :type
+ multiple_value_field :type, :allows => Transaction::Type::All
key_value_fields :refund
View
@@ -1,7 +1,7 @@
module Braintree
module Version
Major = 2
- Minor = 12
+ Minor = 13
Tiny = 0
String = "#{Major}.#{Minor}.#{Tiny}"
@@ -88,7 +88,7 @@
it "rejects when the certificate isn't verified by our certificate authority (self-signed)" do
config = Braintree::Configuration.instantiate
config.stub(:ssl?).and_return(true)
- config.stub(:port).and_return(8443)
+ config.stub(:port).and_return(SSL_TEST_PORT)
start_ssl_server do
expect do
@@ -104,7 +104,7 @@
File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "ssl", "geotrust_global.crt"))
)
config.stub(:ssl?).and_return(true)
- config.stub(:port).and_return(8443)
+ config.stub(:port).and_return(SSL_TEST_PORT)
start_ssl_server do
expect do
@@ -381,6 +381,17 @@
end
end
+ context "invalid search" do
+ it "raises an exception on invalid transaction type" do
+ expect do
+ collection = Braintree::Transaction.search do |search|
+ search.customer_id.is "9171566"
+ search.type.is "settled"
+ end
+ end.to raise_error(ArgumentError)
+ end
+ end
+
context "range fields" do
context "amount" do
it "searches on amount" do
@@ -1,5 +1,6 @@
unless defined?(INTEGRATION_SPEC_HELPER_LOADED)
INTEGRATION_SPEC_HELPER_LOADED = true
+ SSL_TEST_PORT = ENV['SSL_TEST_PORT'] || 8443
require File.dirname(__FILE__) + "/../spec_helper"
require File.dirname(__FILE__) + "/../hacks/tcp_socket"
@@ -10,11 +11,12 @@ def start_ssl_server
FileUtils.rm(web_server_pid_file) if File.exist?(web_server_pid_file)
command = File.expand_path(File.join(File.dirname(__FILE__), "..", "script", "httpsd.rb"))
`#{command} #{web_server_pid_file}`
- TCPSocket.wait_for_service :host => "127.0.0.1", :port => 8443
+ TCPSocket.wait_for_service :host => "127.0.0.1", :port => SSL_TEST_PORT
yield
10.times { unless File.exists?(web_server_pid_file); sleep 1; end }
+ ensure
Process.kill "INT", File.read(web_server_pid_file).to_i
end
View
@@ -12,7 +12,7 @@
pid_file = ARGV[0]
s = WEBrick::HTTPServer.new(
- :Port => 8443,
+ :Port => (ENV['SSL_TEST_PORT'] || 8443),
:Logger => WEBrick::Log::new(nil, WEBrick::Log::ERROR),
:DocumentRoot => File.join(File.dirname(__FILE__)),
:ServerType => WEBrick::Daemon,
@@ -66,6 +66,18 @@
Braintree::Address.find("spaces not allowed", "address_id")
end.to raise_error(ArgumentError, "customer_id contains invalid characters")
end
+
+ it "raises an error if address_id is blank" do
+ expect do
+ Braintree::Address.find("customer_id", "")
+ end.to raise_error(ArgumentError)
+ end
+
+ it "raises an error if address_id is blank" do
+ expect do
+ Braintree::Address.find("customer_id", nil)
+ end.to raise_error(ArgumentError)
+ end
end
describe "self.new" do
@@ -195,6 +195,11 @@
Braintree::Configuration.environment = :sandbox
Braintree::Configuration.instantiate.server.should == "sandbox.braintreegateway.com"
end
+
+ it "is qa.braintreegateway.com for qa" do
+ Braintree::Configuration.environment = :qa
+ Braintree::Configuration.instantiate.server.should == "qa.braintreegateway.com"
+ end
end
describe "ssl?" do
@@ -119,6 +119,26 @@
end
end
+ describe "self.find" do
+ it "raises error if passed empty string" do
+ expect do
+ Braintree::CreditCard.find("")
+ end.to raise_error(ArgumentError)
+ end
+
+ it "raises error if passed invalid string" do
+ expect do
+ Braintree::CreditCard.find("\t")
+ end.to raise_error(ArgumentError)
+ end
+
+ it "raises error if passed nil" do
+ expect do
+ Braintree::CreditCard.find(nil)
+ end.to raise_error(ArgumentError)
+ end
+ end
+
describe "inspect" do
it "includes the token first" do
output = Braintree::CreditCard._new(:gateway, :token => "cc123").inspect
Oops, something went wrong.

0 comments on commit e5f9faa

Please sign in to comment.