Permalink
Browse files

2.11.0

  • Loading branch information...
1 parent a02b614 commit bd44e0208c9dad55938b2c26dd65bce51668734c @braintreeps braintreeps committed Apr 26, 2011
@@ -74,6 +74,26 @@ public void Create_SubscriptionWithoutTrial()
}
[Test]
+ public void Create_SubscriptionReturnsATransactionWithSubscriptionBillingPeriod()
+ {
+ Plan plan = Plan.PLAN_WITHOUT_TRIAL;
+
+ SubscriptionRequest request = new SubscriptionRequest
+ {
+ PaymentMethodToken = creditCard.Token,
+ PlanId = plan.Id
+ };
+
+ Result<Subscription> result = gateway.Subscription.Create(request);
+ Assert.IsTrue(result.IsSuccess());
+ Subscription subscription = result.Target;
+ Transaction transaction = subscription.Transactions[0];
+
+ Assert.AreEqual(subscription.BillingPeriodStartDate, transaction.Subscription.BillingPeriodStartDate);
+ Assert.AreEqual(subscription.BillingPeriodEndDate, transaction.Subscription.BillingPeriodEndDate);
+ }
+
+ [Test]
public void Create_ReturnsDeclinedTransaction()
{
Plan plan = Plan.PLAN_WITHOUT_TRIAL;
@@ -1799,15 +1819,15 @@ public void Update_WithDescriptor()
Descriptor = new DescriptorRequest
{
Name = "999*999",
- Phone = "9999999"
+ Phone = "1234567890"
}
};
Result<Subscription> result = gateway.Subscription.Update(createResult.Target.Id, updateRequest);
Assert.IsTrue(result.IsSuccess());
Subscription subscription = result.Target;
Assert.AreEqual("999*999", subscription.Descriptor.Name);
- Assert.AreEqual("9999999", subscription.Descriptor.Phone);
+ Assert.AreEqual("1234567890", subscription.Descriptor.Phone);
}
[Test]

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Braintree</RootNamespace>
- <AssemblyName>Braintree-2.10.0</AssemblyName>
+ <AssemblyName>Braintree-2.11.0</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkSubset>
@@ -23,7 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Debug\Braintree-2.10.0.xml</DocumentationFile>
+ <DocumentationFile>bin\Debug\Braintree-2.11.0.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -33,7 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <DocumentationFile>bin\Debug\Braintree-2.10.0.xml</DocumentationFile>
+ <DocumentationFile>bin\Debug\Braintree-2.11.0.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
View
@@ -11,8 +11,10 @@ public class Descriptor
internal Descriptor(NodeWrapper node)
{
- Name = node.GetString("name");
- Phone = node.GetString("phone");
+ if (node != null) {
+ Name = node.GetString("name");
+ Phone = node.GetString("phone");
+ }
}
}
}
@@ -29,5 +29,5 @@
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.10.0.0")]
-[assembly: AssemblyFileVersion("2.10.0.0")]
+[assembly: AssemblyVersion("2.11.0.0")]
+[assembly: AssemblyFileVersion("2.11.0.0")]
View
@@ -118,6 +118,7 @@ public class Transaction
public TransactionStatus Status { get; protected set; }
public StatusEvent[] StatusHistory { get; protected set; }
public String SubscriptionId { get; protected set; }
+ public Subscription Subscription { get; protected set; }
public Decimal? TaxAmount { get; protected set; }
public Boolean? TaxExempt { get; protected set; }
public TransactionType Type { get; protected set; }
@@ -171,6 +172,7 @@ internal Transaction(NodeWrapper node, BraintreeService service)
TaxExempt = node.GetBoolean("tax-exempt");
CustomFields = node.GetDictionary("custom-fields");
CreditCard = new CreditCard(node.GetNode("credit-card"), service);
+ Subscription = new Subscription(node.GetNode("subscription"), service);
Customer = new Customer(node.GetNode("customer"), service);
CurrencyIsoCode = node.GetString("currency-iso-code");
CvvResponseCode = node.GetString("cvv-response-code");
@@ -9,6 +9,7 @@ namespace Braintree
public class TransactionOptionsRequest : Request
{
public Boolean? StoreInVault { get; set; }
+ public Boolean? StoreInVaultOnSuccess { get; set; }
public Boolean? AddBillingAddressToPaymentMethod { get; set; }
public Boolean? StoreShippingAddressInVault { get; set; }
public Boolean? SubmitForSettlement { get; set; }
@@ -27,6 +28,7 @@ protected virtual RequestBuilder BuildRequest(String root)
{
return new RequestBuilder(root).
AddElement("store-in-vault", StoreInVault).
+ AddElement("store-in-vault-on-success", StoreInVaultOnSuccess).
AddElement("add-billing-address-to-payment-method", AddBillingAddressToPaymentMethod).
AddElement("store-shipping-address-in-vault", StoreShippingAddressInVault).
AddElement("submit-for-settlement", SubmitForSettlement);
@@ -25,6 +25,7 @@ public enum ValidationErrorCode
ADDRESS_REGION_IS_TOO_LONG = 81810,
ADDRESS_STREET_ADDRESS_IS_REQUIRED = 81811,
ADDRESS_STREET_ADDRESS_IS_TOO_LONG = 81812,
+ ADDRESS_TOO_MANY_ADDRESSES_PER_CUSTOMER = 91818,
CREDIT_CARD_BILLING_ADDRESS_CONFLICT = 91701,
CREDIT_CARD_BILLING_ADDRESS_ID_IS_INVALID = 91702,
View
@@ -1,3 +1,9 @@
+## 2.11.0
+
+* Added Subscription to Transaction
+* Added flag to store in vault only when a transaction is successful
+* Added new error code
+
## 2.10.0
* Added a new transaction state, AUTHORIZATION_EXPIRED.
View
@@ -1,6 +1,3 @@
-require "rubygems"
-load File.dirname(__FILE__) + "/cruise.rake"
-
task :default => :test
task :clean do
View
@@ -1,70 +0,0 @@
-require 'timeout'
-require 'socket'
-
-CRUISE_BUILD = "CRUISE_BUILD=#{ENV['CRUISE_BUILD']}"
-GATEWAY_ROOT = File.dirname(__FILE__) + "/../gateway" unless defined?(GATEWAY_ROOT)
-PORT = ENV['GATEWAY_PORT'] || 3000
-PID_FILE = "/tmp/gateway_server_#{PORT}.pid"
-
-desc "prep the gateway (including git clone and db reset) and run tests"
-task :cruise do
- begin
- Rake::Task["prep_gateway"].invoke
- Rake::Task["test"].invoke
- ensure
- Rake::Task["stop_gateway"].invoke
- end
-end
-
-task :prep_gateway do
- Dir.chdir(GATEWAY_ROOT) do
- sh "rake log:clear"
- sh "git pull"
- sh "env RAILS_ENV=integration #{CRUISE_BUILD} rake db:migrate:reset --trace"
- sh "env RAILS_ENV=integration #{CRUISE_BUILD} ruby script/populate_data"
- Rake::Task[:start_gateway].invoke
- end
-end
-
-task :start_gateway do
- Dir.chdir(GATEWAY_ROOT) do
- spawn_server(PID_FILE, PORT, "integration")
- end
-end
-
-task :stop_gateway do
- Dir.chdir(GATEWAY_ROOT) do
- shutdown_server(PID_FILE)
- end
-end
-
-def spawn_server(pid_file, port, environment="test")
- FileUtils.rm(pid_file) if File.exist?(pid_file)
- command = "mongrel_rails start --environment #{environment} --daemon --port #{port} --pid #{pid_file}"
-
- sh command
- puts "== waiting for web server - port: #{port}"
- TCPSocket.wait_for_service :host => "127.0.0.1", :port => port
-end
-
-def shutdown_server(pid_file)
- 10.times { unless File.exists?(pid_file); sleep 1; end }
- puts "\n== killing web server - pid: #{File.read(pid_file).to_i}"
- Process.kill "TERM", File.read(pid_file).to_i
-end
-
-TCPSocket.class_eval do
- def self.wait_for_service(options)
- Timeout::timeout(options[:timeout] || 20) do
- loop do
- begin
- socket = TCPSocket.new(options[:host], options[:port])
- socket.close
- return
- rescue Errno::ECONNREFUSED
- sleep 0.5
- end
- end
- end
- end
-end
View
@@ -1,9 +0,0 @@
-Project.configure do |project|
- project.scheduler.polling_interval = 1.minute
-
- case project.name
- when "client_library_dotnet_integration_master"
- project.build_command = "CRUISE_BUILD=#{project.name} GATEWAY_PORT=6010 rake cruise"
- project.triggered_by :gateway_master
- end
-end
View
@@ -1,70 +0,0 @@
-properties {
- $base_dir = Split-Path -Path $MyInvocation.MyCommand.ScriptBlock.File
- $sandcastle_base = "C:\Program Files (x86)\Sandcastle"
- $sandcastle_presentation = "$sandcastle_base\Presentation\vs2005"
-
- $nunit = "C:\Program Files (x86)\NUnit 2.5.2\bin\net-2.0\nunit-console.exe"
- $msbuild = "C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild"
- $mrefbuilder = "$sandcastle_base\ProductionTools\MrefBuilder.exe"
- $xsltransform = "$sandcastle_base\ProductionTools\XslTransform.exe"
- $buildassembler = "$sandcastle_base\ProductionTools\BuildAssembler.exe"
-
- $assembly = "$base_dir\Braintree\bin\Debug\Braintree-1.1.1.dll"
- $test_assembly = "$base_dir\Braintree.Tests\bin\Debug\Braintree.Tests.dll"
- $reflection = "$base_dir\reflection.xml"
- $manifest = "$base_dir\manifest.xml"
- $toc = "$base_dir\toc.xml"
-
- $production_transforms = "$sandcastle_base\ProductionTransforms"
-
- $sandcastle_config = "$base_dir\sandcastle.config"
-}
-
-task default -depends Test
-
-task Clean {
- if (Test-Path "$base_dir\Output")
- {
- Remove-Item "$base_dir\Output" -Recurse
- }
-}
-
-task Test -depends Compile {
- & $nunit .\Braintree.Tests\bin\debug\Braintree.Tests.dll
-}
-
-task Compile {
- & $msbuild
-}
-
-task GenerateDocs -depends Compile, Clean {
- mkdir "$base_dir\Output"
- mkdir "$base_dir\Output\html"
- Copy-Item "$sandcastle_presentation\configuration\sandcastle.config" $sandcastle_config
- Copy-Item "$sandcastle_presentation\icons" "$base_dir\Output" -Recurse
- Copy-Item "$sandcastle_presentation\Scripts" "$base_dir\Output" -Recurse
- Copy-Item "$sandcastle_presentation\Styles" "$base_dir\Output" -Recurse
-
- # Generate reflection.xml
- & $mrefbuilder $assembly /out:$reflection
- $reflection_transforms = "$production_transforms\ApplyVSDocModel.xsl", "$production_transforms\AddFriendlyFilenames.xsl"
- foreach ($transform in $reflection_transforms)
- {
- Copy-Item $reflection "temp.xml"
- & $xsltransform "temp.xml" /xsl:$transform /out:$reflection
- Remove-Item "temp.xml"
- }
-
- # Generate toc.xml
- & $xsltransform $reflection /xsl:"$production_transforms\CreateVSToc.xsl" /out:$toc
-
- # Generate manifest.xml
- & $xsltransform $reflection /xsl:"$production_transforms\ReflectionToManifest.xsl" /out:$manifest
-
- # Generate HTML docs
- & $buildassembler $manifest /config:$sandcastle_config
-
- Remove-Item $reflection
- Remove-Item $manifest
- Remove-Item $sandcastle_config
-}

0 comments on commit bd44e02

Please sign in to comment.