Permalink
Browse files

2.21.0

  • Loading branch information...
1 parent f1f678c commit 8929fada07dd7903ee2472829eb89aaa5c8c06e5 @braintreeps braintreeps committed Mar 5, 2013
View
21 Braintree.Tests/SubscriptionTest.cs
@@ -75,6 +75,27 @@ public void Create_SubscriptionWithoutTrial()
}
[Test]
+ public void Create_SubscriptionWithZeroDollarPrice()
+ {
+ TestPlan plan = PlanFixture.PLAN_WITHOUT_TRIAL;
+
+ SubscriptionRequest request = new SubscriptionRequest
+ {
+ PaymentMethodToken = creditCard.Token,
+ PlanId = plan.Id,
+ Price = 0.00M
+ };
+
+ Result<Subscription> result = gateway.Subscription.Create(request);
+ Assert.IsTrue(result.IsSuccess());
+ Subscription subscription = result.Target;
+
+ Assert.AreEqual(creditCard.Token, subscription.PaymentMethodToken);
+ Assert.AreEqual(plan.Id, subscription.PlanId);
+ Assert.AreEqual(0.00M, subscription.Price);
+ }
+
+ [Test]
public void Create_SubscriptionReturnsATransactionWithSubscriptionBillingPeriod()
{
TestPlan plan = PlanFixture.PLAN_WITHOUT_TRIAL;
View
6 Braintree/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Braintree Payment Solutions")]
[assembly: AssemblyProduct("Braintree Payment Gateway Client API")]
-[assembly: AssemblyCopyright("Copyright © Braintree Payment Solutions 2010")]
+[assembly: AssemblyCopyright("Copyright © Braintree Payment Solutions 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -29,5 +29,5 @@
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.20.0.0")]
-[assembly: AssemblyFileVersion("2.20.0.0")]
+[assembly: AssemblyVersion("2.21.0.0")]
+[assembly: AssemblyFileVersion("2.21.0.0")]
View
6 Braintree/SubscriptionRequest.cs
@@ -36,7 +36,7 @@ public class SubscriptionRequest : Request
public SubscriptionOptionsRequest Options { get; set; }
public String PaymentMethodToken { get; set; }
public String PlanId { get; set; }
- public Decimal Price { get; set; }
+ public Decimal? Price { get; set; }
public Int32 TrialDuration { get; set; }
public SubscriptionDurationUnit TrialDurationUnit { get; set; }
public String MerchantAccountId { get; set; }
@@ -78,7 +78,9 @@ public virtual RequestBuilder BuildRequest(String root)
}
builder.AddElement("id", Id);
builder.AddElement("plan-id", PlanId);
- if (Price != 0) builder.AddElement("price", Price);
+ if (Price.HasValue) {
+ builder.AddElement("price", Price.Value);
+ }
builder.AddElement("add-ons", AddOns);
builder.AddElement("discounts", Discounts);
View
39 Braintree/ValidationErrorCode.cs
@@ -8,21 +8,31 @@ namespace Braintree
{
public enum ValidationErrorCode
{
+
+
ADDRESS_CANNOT_BE_BLANK = 81801,
+ ADDRESS_COMPANY_IS_INVALID = 91821,
ADDRESS_COMPANY_IS_TOO_LONG = 81802,
ADDRESS_COUNTRY_CODE_ALPHA2_IS_NOT_ACCEPTED = 91814,
ADDRESS_COUNTRY_CODE_ALPHA3_IS_NOT_ACCEPTED = 91816,
ADDRESS_COUNTRY_CODE_NUMERIC_IS_NOT_ACCEPTED = 91817,
ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED = 91803,
+ ADDRESS_EXTENDED_ADDRESS_IS_INVALID = 91823,
ADDRESS_EXTENDED_ADDRESS_IS_TOO_LONG = 81804,
+ ADDRESS_FIRST_NAME_IS_INVALID = 91819,
ADDRESS_FIRST_NAME_IS_TOO_LONG = 81805,
ADDRESS_INCONSISTENT_COUNTRY = 91815,
+ ADDRESS_LAST_NAME_IS_INVALID = 91820,
ADDRESS_LAST_NAME_IS_TOO_LONG = 81806,
+ ADDRESS_LOCALITY_IS_INVALID = 91824,
ADDRESS_LOCALITY_IS_TOO_LONG = 81807,
ADDRESS_POSTAL_CODE_INVALID_CHARACTERS = 81813,
+ ADDRESS_POSTAL_CODE_IS_INVALID = 91826,
ADDRESS_POSTAL_CODE_IS_REQUIRED = 81808,
ADDRESS_POSTAL_CODE_IS_TOO_LONG = 81809,
+ ADDRESS_REGION_IS_INVALID = 91825,
ADDRESS_REGION_IS_TOO_LONG = 81810,
+ ADDRESS_STREET_ADDRESS_IS_INVALID = 91822,
ADDRESS_STREET_ADDRESS_IS_REQUIRED = 81811,
ADDRESS_STREET_ADDRESS_IS_TOO_LONG = 81812,
ADDRESS_TOO_MANY_ADDRESSES_PER_CUSTOMER = 91818,
@@ -43,21 +53,27 @@ public enum ValidationErrorCode
CREDIT_CARD_EXPIRATION_DATE_YEAR_IS_INVALID = 81711,
CREDIT_CARD_EXPIRATION_MONTH_IS_INVALID = 81712,
CREDIT_CARD_EXPIRATION_YEAR_IS_INVALID = 81713,
+ CREDIT_CARD_INVALID_VENMO_SDK_PAYMENT_METHOD_CODE = 91727,
CREDIT_CARD_NUMBER_HAS_INVALID_LENGTH = 81716,
+ CREDIT_CARD_NUMBER_LENGTH_IS_INVALID = 81716,
CREDIT_CARD_NUMBER_IS_INVALID = 81715,
CREDIT_CARD_NUMBER_IS_REQUIRED = 81714,
CREDIT_CARD_NUMBER_MUST_BE_TEST_NUMBER = 81717,
CREDIT_CARD_OPTIONS_UPDATE_EXISTING_TOKEN_IS_INVALID = 91723,
+ CREDIT_CARD_PAYMENT_METHOD_CONFLICT = 81725,
CREDIT_CARD_TOKEN_INVALID = 91718,
+ CREDIT_CARD_TOKEN_FORMAT_IS_INVALID = 91718,
CREDIT_CARD_TOKEN_IS_IN_USE = 91719,
CREDIT_CARD_TOKEN_IS_NOT_ALLOWED = 91721,
CREDIT_CARD_TOKEN_IS_REQUIRED = 91722,
CREDIT_CARD_TOKEN_IS_TOO_LONG = 91720,
+ CREDIT_CARD_VENMO_SDK_PAYMENT_METHOD_CODE_CARD_TYPE_IS_NOT_ACCEPTED = 91726,
CUSTOMER_COMPANY_IS_TOO_LONG = 81601,
CUSTOMER_CUSTOM_FIELD_IS_INVALID = 91602,
CUSTOMER_CUSTOM_FIELD_IS_TOO_LONG = 81603,
CUSTOMER_EMAIL_IS_INVALID = 81604,
+ CUSTOMER_EMAIL_FORMAT_IS_INVALID = 81604,
CUSTOMER_EMAIL_IS_REQUIRED = 81606,
CUSTOMER_EMAIL_IS_TOO_LONG = 81605,
CUSTOMER_FAX_IS_TOO_LONG = 81607,
@@ -70,9 +86,13 @@ public enum ValidationErrorCode
CUSTOMER_ID_IS_TOO_LONG = 91612,
CUSTOMER_LAST_NAME_IS_TOO_LONG = 81613,
CUSTOMER_PHONE_IS_TOO_LONG = 81614,
+ CUSTOMER_WEBSITE_FORMAT_IS_INVALID = 81616,
CUSTOMER_WEBSITE_IS_INVALID = 81616,
CUSTOMER_WEBSITE_IS_TOO_LONG = 81615,
+ DESCRIPTOR_DYNAMIC_DESCRIPTORS_DISABLED = 92203,
+ DESCRIPTOR_INTERNATIONAL_NAME_FORMAT_IS_INVALID = 92204,
+ DESCRIPTOR_INTERNATIONAL_PHONE_FORMAT_IS_INVALID = 92205,
DESCRIPTOR_NAME_FORMAT_IS_INVALID = 92201,
DESCRIPTOR_PHONE_FORMAT_IS_INVALID = 92202,
@@ -127,6 +147,7 @@ public enum ValidationErrorCode
SUBSCRIPTION_MODIFICATION_INCONSISTENT_NUMBER_OF_BILLING_CYCLES = 92018,
SUBSCRIPTION_MODIFICATION_INHERITED_FROM_ID_IS_INVALID = 92013,
SUBSCRIPTION_MODIFICATION_INHERITED_FROM_ID_IS_REQUIRED = 92014,
+ SUBSCRIPTION_MODIFICATION_MISSING = 92024,
SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_CANNOT_BE_BLANK = 92017,
SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_IS_INVALID = 92005,
SUBSCRIPTION_MODIFICATION_NUMBER_OF_BILLING_CYCLES_MUST_BE_GREATER_THAN_ZERO = 92019,
@@ -135,8 +156,9 @@ public enum ValidationErrorCode
SUBSCRIPTION_MODIFICATION_QUANTITY_MUST_BE_GREATER_THAN_ZERO = 92010,
TRANSACTION_AMOUNT_CANNOT_BE_NEGATIVE = 81501,
- TRANSACTION_AMOUNT_IS_REQUIRED = 81502,
TRANSACTION_AMOUNT_IS_INVALID = 81503,
+ TRANSACTION_AMOUNT_FORMAT_IS_INVALID = 81503,
+ TRANSACTION_AMOUNT_IS_REQUIRED = 81502,
TRANSACTION_AMOUNT_IS_TOO_LARGE = 81528,
TRANSACTION_AMOUNT_MUST_BE_GREATER_THAN_ZERO = 81531,
TRANSACTION_BILLING_ADDRESS_CONFLICT = 91530,
@@ -151,18 +173,21 @@ public enum ValidationErrorCode
TRANSACTION_CANNOT_SUBMIT_FOR_SETTLEMENT = 91507,
TRANSACTION_CHANNEL_IS_TOO_LONG = 91550,
TRANSACTION_CREDIT_CARD_IS_REQUIRED = 91508,
- TRANSACTION_CUSTOM_FIELD_IS_INVALID = 91526,
- TRANSACTION_CUSTOM_FIELD_IS_TOO_LONG = 81527,
TRANSACTION_CUSTOMER_DEFAULT_PAYMENT_METHOD_CARD_TYPE_IS_NOT_ACCEPTED = 81509,
- TRANSACTION_CUSTOMER_ID_IS_INVALID = 91510,
TRANSACTION_CUSTOMER_DOES_NOT_HAVE_CREDIT_CARD = 91511,
+ TRANSACTION_CUSTOMER_ID_IS_INVALID = 91510,
+ TRANSACTION_CUSTOM_FIELD_IS_INVALID = 91526,
+ TRANSACTION_CUSTOM_FIELD_IS_TOO_LONG = 81527,
TRANSACTION_HAS_ALREADY_BEEN_REFUNDED = 91512,
TRANSACTION_MERCHANT_ACCOUNT_DOES_NOT_SUPPORT_REFUNDS = 91547,
TRANSACTION_MERCHANT_ACCOUNT_ID_IS_INVALID = 91513,
TRANSACTION_MERCHANT_ACCOUNT_IS_SUSPENDED = 91514,
TRANSACTION_MERCHANT_ACCOUNT_NAME_IS_INVALID = 91513, //Deprecated
+ TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_CLONING = 91544,
+ TRANSACTION_OPTIONS_VAULT_IS_DISABLED = 91525,
TRANSACTION_ORDER_ID_IS_TOO_LONG = 91501,
TRANSACTION_PAYMENT_METHOD_CONFLICT = 91515,
+ TRANSACTION_PAYMENT_METHOD_CONFLICT_WITH_VENMO_SDK = 91549,
TRANSACTION_PAYMENT_METHOD_DOES_NOT_BELONG_TO_CUSTOMER = 91516,
TRANSACTION_PAYMENT_METHOD_DOES_NOT_BELONG_TO_SUBSCRIPTION = 91527,
TRANSACTION_PAYMENT_METHOD_TOKEN_CARD_TYPE_IS_NOT_ACCEPTED = 91517,
@@ -171,8 +196,8 @@ public enum ValidationErrorCode
TRANSACTION_PROCESSOR_AUTHORIZATION_CODE_IS_INVALID = 81520,
TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_CREDITS = 91546,
TRANSACTION_PROCESSOR_DOES_NOT_SUPPORT_VOICE_AUTHORIZATIONS = 91545,
- TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG = 91537,
TRANSACTION_PURCHASE_ORDER_NUMBER_IS_INVALID = 91548,
+ TRANSACTION_PURCHASE_ORDER_NUMBER_IS_TOO_LONG = 91537,
TRANSACTION_REFUND_AMOUNT_IS_TOO_LARGE = 91521,
TRANSACTION_SETTLEMENT_AMOUNT_IS_TOO_LARGE = 91522,
TRANSACTION_SUBSCRIPTION_DOES_NOT_BELONG_TO_CUSTOMER = 91529,
@@ -183,8 +208,6 @@ public enum ValidationErrorCode
TRANSACTION_TAX_AMOUNT_IS_TOO_LARGE = 81536,
TRANSACTION_TYPE_IS_INVALID = 91523,
TRANSACTION_TYPE_IS_REQUIRED = 91524,
- TRANSACTION_UNSUPPORTED_VOICE_AUTHORIZATION = 91539,
- TRANSACTION_OPTIONS_SUBMIT_FOR_SETTLEMENT_IS_REQUIRED_FOR_CLONING = 91544,
- TRANSACTION_OPTIONS_VAULT_IS_DISABLED = 91525
+ TRANSACTION_UNSUPPORTED_VOICE_AUTHORIZATION = 91539
}
}
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.21.0
+
+* Fixes bug with zero dollar subscriptions.
+
## 2.20.0
* Adds channel field to transactions.
View
2 LICENSE
@@ -1,6 +1,6 @@
(The MIT License)
-Copyright (c) 2009-2010 Braintree Payment Solutions
+Copyright (c) 2009-2013 Braintree Payment Solutions
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
View
3 ci.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+rake --trace

0 comments on commit 8929fad

Please sign in to comment.