Skip to content

Commit

Permalink
2.25.3
Browse files Browse the repository at this point in the history
  • Loading branch information
braintreeps committed Sep 12, 2013
1 parent 504e9b9 commit 2a21408
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 7 deletions.
1 change: 1 addition & 0 deletions Braintree.Tests/CreditCardRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void ToXml_Includes_DeviceData()
CreditCardRequest request = new CreditCardRequest();
request.DeviceData = "{\"device_session_id\":\"my_dsid\"}";

Assert.IsTrue(request.ToXml().Contains("device-data"));
Assert.IsTrue(request.ToXml().Contains("device_session_id"));
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
}
Expand Down
25 changes: 25 additions & 0 deletions Braintree.Tests/CreditCardTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,31 @@ public void Create_CreatesCreditCardWithSecurityParams()
Assert.IsTrue(result.IsSuccess());
}

[Test]
public void Create_CreatesCreditCardWithDeviceData()
{
Customer customer = gateway.Customer.Create(new CustomerRequest()).Target;

var creditCardRequest = new CreditCardRequest
{
CustomerId = customer.Id,
DeviceData = "{\"device_session_id\":\"my_dsid\"}",
CardholderName = "John Doe",
Number = "5105105105105100",
ExpirationDate = "05/12",
BillingAddress = new CreditCardAddressRequest
{
CountryName = "Greece",
CountryCodeAlpha2 = "GR",
CountryCodeAlpha3 = "GRC",
CountryCodeNumeric = "300"
}
};

Result<CreditCard> result = gateway.CreditCard.Create(creditCardRequest);
Assert.IsTrue(result.IsSuccess());
}

[Test]
public void Create_FailsToCreateCreditCardWithInvalidVenmoSdkPaymentMethodCode()
{
Expand Down
1 change: 1 addition & 0 deletions Braintree.Tests/TransactionRequestTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void ToXml_Includes_DeviceData()
TransactionRequest request = new TransactionRequest();
request.DeviceData = "{\"device_session_id\":\"my_dsid\"}";

Assert.IsTrue(request.ToXml().Contains("device-data"));
Assert.IsTrue(request.ToXml().Contains("device_session_id"));
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
}
Expand Down
34 changes: 34 additions & 0 deletions Braintree.Tests/TransactionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,40 @@ public void Sale_ReturnsSuccessfulResponse()
Assert.AreEqual("05/2009", creditCard.ExpirationDate);
}

[Test]
public void Sale_WithDeviceData()
{
var request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
CreditCard = new TransactionCreditCardRequest
{
Number = SandboxValues.CreditCardNumber.VISA,
ExpirationDate = "05/2009",
},
DeviceData = "{\"device_session_id\":\"my_dsid\"}"
};

Result<Transaction> result = gateway.Transaction.Sale(request);
Assert.IsTrue(result.IsSuccess());
Transaction transaction = result.Target;

Assert.AreEqual(1000.00, transaction.Amount);
Assert.AreEqual(TransactionType.SALE, transaction.Type);
Assert.AreEqual(TransactionStatus.AUTHORIZED, transaction.Status);
Assert.AreEqual(DateTime.Now.Year, transaction.CreatedAt.Value.Year);
Assert.AreEqual(DateTime.Now.Year, transaction.UpdatedAt.Value.Year);
Assert.IsNotNull(transaction.ProcessorAuthorizationCode);
Assert.IsNull(transaction.GatewayRejectionReason);

CreditCard creditCard = transaction.CreditCard;
Assert.AreEqual("411111", creditCard.Bin);
Assert.AreEqual("1111", creditCard.LastFour);
Assert.AreEqual("05", creditCard.ExpirationMonth);
Assert.AreEqual("2009", creditCard.ExpirationYear);
Assert.AreEqual("05/2009", creditCard.ExpirationDate);
}

[Test]
public void Sale_WithAllAttributes()
{
Expand Down
6 changes: 3 additions & 3 deletions Braintree/Braintree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Braintree</RootNamespace>
<AssemblyName>Braintree-2.25.2</AssemblyName>
<AssemblyName>Braintree-2.25.3</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkSubset>
Expand All @@ -23,7 +23,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Braintree-2.25.2.xml</DocumentationFile>
<DocumentationFile>bin\Debug\Braintree-2.25.3.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
Expand All @@ -33,7 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Braintree-2.25.2.xml</DocumentationFile>
<DocumentationFile>bin\Debug\Braintree-2.25.3.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Expand Down
2 changes: 1 addition & 1 deletion Braintree/CreditCardRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected override RequestBuilder BuildRequest(String root)
return base.BuildRequest(root).
AddElement("billing-address", BillingAddress).
AddElement("billing-address-id", BillingAddressId).
AddElement("bundled-params", DeviceData).
AddElement("device-data", DeviceData).
AddElement("customer-id", CustomerId).
AddElement("device-session-id", DeviceSessionId).
AddElement("options", Options).
Expand Down
4 changes: 2 additions & 2 deletions Braintree/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.25.2.0")]
[assembly: AssemblyFileVersion("2.25.2.0")]
[assembly: AssemblyVersion("2.25.3.0")]
[assembly: AssemblyFileVersion("2.25.3.0")]
2 changes: 1 addition & 1 deletion Braintree/TransactionRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected virtual RequestBuilder BuildRequest(String root)
RequestBuilder builder = new RequestBuilder(root);

if (Amount != 0) builder.AddElement("amount", Amount);
builder.AddElement("bundled-params", DeviceData);
builder.AddElement("device-data", DeviceData);
builder.AddElement("customer-id", CustomerId);
builder.AddElement("order-id", OrderId);
builder.AddElement("channel", Channel);
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.25.3

* Fixed typo with DeviceData.

## 2.25.2

* Fixed typo in MerchantAccount.
Expand Down

0 comments on commit 2a21408

Please sign in to comment.