Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2.20.0

  • Loading branch information...
commit f1f678c046ee1b9362d0445243c9c3d9fd8e4a45 1 parent 16caab1
@braintreeps braintreeps authored
View
36 Braintree.Tests/CreditCardVerificationTest.cs
@@ -127,6 +127,42 @@ public void Search_OnMultipleValueFields()
Assert.AreEqual(2, collection.MaximumCount);
}
+
+ [Test]
+ public void CardTypeIndicators()
+ {
+ String name = Guid.NewGuid().ToString("n");
+ var createRequest = new CustomerRequest
+ {
+ CreditCard = new CreditCardRequest
+ {
+ CardholderName = name,
+ Number = CreditCardNumbers.CardTypeIndicators.Unknown,
+ ExpirationDate = "05/12",
+ Options = new CreditCardOptionsRequest
+ {
+ VerifyCard = true
+ }
+ }
+ };
+
+ gateway.Customer.Create(createRequest);
+
+ CreditCardVerificationSearchRequest searchRequest = new CreditCardVerificationSearchRequest().
+ CreditCardCardholderName.Is(name);
+
+ ResourceCollection<CreditCardVerification> collection = gateway.CreditCardVerification.Search(searchRequest);
+
+ CreditCardVerification verification = collection.FirstItem;
+
+ Assert.AreEqual(verification.CreditCard.Prepaid, Braintree.CreditCardPrepaid.UNKNOWN);
+ Assert.AreEqual(verification.CreditCard.Debit, Braintree.CreditCardDebit.UNKNOWN);
+ Assert.AreEqual(verification.CreditCard.DurbinRegulated, Braintree.CreditCardDurbinRegulated.UNKNOWN);
+ Assert.AreEqual(verification.CreditCard.Commercial, Braintree.CreditCardCommercial.UNKNOWN);
+ Assert.AreEqual(verification.CreditCard.Healthcare, Braintree.CreditCardHealthcare.UNKNOWN);
+ Assert.AreEqual(verification.CreditCard.Payroll, Braintree.CreditCardPayroll.UNKNOWN);
+
+ }
}
}
View
29 Braintree.Tests/TransactionTest.cs
@@ -1037,6 +1037,7 @@ public void Sale_WithAllAttributes()
TransactionRequest request = new TransactionRequest
{
Amount = SandboxValues.TransactionAmount.AUTHORIZE,
+ Channel = "MyShoppingCartProvider",
OrderId = "123",
Recurring = true,
CreditCard = new TransactionCreditCardRequest
@@ -1094,6 +1095,7 @@ public void Sale_WithAllAttributes()
Assert.AreEqual(1000.00, transaction.Amount);
Assert.AreEqual(TransactionStatus.AUTHORIZED, transaction.Status);
+ Assert.AreEqual("MyShoppingCartProvider", transaction.Channel);
Assert.AreEqual("123", transaction.OrderId);
Assert.IsTrue(transaction.Recurring.Value);
Assert.IsNull(transaction.GetVaultCreditCard());
@@ -2599,6 +2601,7 @@ public void CloneTransaction()
TransactionCloneRequest cloneRequest = new TransactionCloneRequest
{
Amount = 123.45M,
+ Channel = "MyShoppingCartProvider",
Options = new TransactionOptionsCloneRequest
{
SubmitForSettlement = false
@@ -2610,6 +2613,7 @@ public void CloneTransaction()
Transaction cloneTransaction = cloneResult.Target;
Assert.AreEqual(123.45, cloneTransaction.Amount);
+ Assert.AreEqual("MyShoppingCartProvider", cloneTransaction.Channel);
Assert.AreEqual(TransactionStatus.AUTHORIZED, cloneTransaction.Status);
Assert.IsNull(cloneTransaction.GetVaultCreditCard());
Assert.IsNull(cloneTransaction.GetVaultCustomer());
@@ -2688,5 +2692,30 @@ public void CloneTransaction_WithValidationErrors()
Assert.IsFalse(cloneResult.IsSuccess());
Assert.AreEqual(ValidationErrorCode.TRANSACTION_CANNOT_CLONE_CREDIT, cloneResult.Errors.ForObject("Transaction").OnField("Base")[0].Code);
}
+
+ [Test]
+ public void CardTypeIndicators()
+ {
+ TransactionRequest request = new TransactionRequest
+ {
+ Amount = SandboxValues.TransactionAmount.AUTHORIZE,
+ CreditCard = new TransactionCreditCardRequest
+ {
+ Number = CreditCardNumbers.CardTypeIndicators.Unknown,
+ ExpirationDate = "12/2015",
+ }
+ };
+
+ Result<Transaction> result = gateway.Transaction.Credit(request);
+ Assert.IsTrue(result.IsSuccess());
+ Transaction transaction = result.Target;
+
+ Assert.AreEqual(transaction.CreditCard.Prepaid, Braintree.CreditCardPrepaid.UNKNOWN);
+ Assert.AreEqual(transaction.CreditCard.Debit, Braintree.CreditCardDebit.UNKNOWN);
+ Assert.AreEqual(transaction.CreditCard.DurbinRegulated, Braintree.CreditCardDurbinRegulated.UNKNOWN);
+ Assert.AreEqual(transaction.CreditCard.Commercial, Braintree.CreditCardCommercial.UNKNOWN);
+ Assert.AreEqual(transaction.CreditCard.Healthcare, Braintree.CreditCardHealthcare.UNKNOWN);
+ Assert.AreEqual(transaction.CreditCard.Payroll, Braintree.CreditCardPayroll.UNKNOWN);
+ }
}
}
View
4 Braintree/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.19.0.0")]
-[assembly: AssemblyFileVersion("2.19.0.0")]
+[assembly: AssemblyVersion("2.20.0.0")]
+[assembly: AssemblyFileVersion("2.20.0.0")]
View
2  Braintree/Transaction.cs
@@ -95,6 +95,7 @@ public class Transaction
public String AvsPostalCodeResponseCode { get; protected set; }
public String AvsStreetAddressResponseCode { get; protected set; }
public Address BillingAddress { get; protected set; }
+ public String Channel { get; protected set; }
public DateTime? CreatedAt { get; protected set; }
public CreditCard CreditCard { get; protected set; }
public String CurrencyIsoCode { get; protected set; }
@@ -145,6 +146,7 @@ protected internal Transaction(NodeWrapper node, BraintreeService service)
node.GetString("gateway-rejection-reason"),
null
);
+ Channel = node.GetString("channel");
OrderId = node.GetString("order-id");
Status = (TransactionStatus)CollectionUtil.Find(TransactionStatus.ALL, node.GetString("status"), TransactionStatus.UNRECOGNIZED);
View
2  Braintree/TransactionCloneRequest.cs
@@ -10,6 +10,7 @@ namespace Braintree
public class TransactionCloneRequest : Request
{
public Decimal Amount { get; set; }
+ public String Channel { get; set; }
public TransactionOptionsCloneRequest Options { get; set; }
public override String ToXml()
@@ -26,6 +27,7 @@ protected virtual RequestBuilder BuildRequest(String root)
{
RequestBuilder builder = new RequestBuilder(root);
builder.AddElement("amount", Amount);
+ builder.AddElement("channel", Channel);
builder.AddElement("options", Options);
return builder;
View
2  Braintree/TransactionRequest.cs
@@ -29,6 +29,7 @@ public class TransactionRequest : Request
{
public TransactionCreditCardRequest CreditCard { get; set; }
public Decimal Amount { get; set; }
+ public String Channel { get; set; }
public String OrderId { get; set; }
public Boolean? Recurring { get; set; }
public String MerchantAccountId { get; set; }
@@ -83,6 +84,7 @@ protected virtual RequestBuilder BuildRequest(String root)
if (Amount != 0) builder.AddElement("amount", Amount);
builder.AddElement("customer-id", CustomerId);
builder.AddElement("order-id", OrderId);
+ builder.AddElement("channel", Channel);
if (Recurring.HasValue) builder.AddElement("recurring", Recurring);
builder.AddElement("payment-method-token", PaymentMethodToken);
builder.AddElement("purchase-order-number", PurchaseOrderNumber);
View
1  Braintree/ValidationErrorCode.cs
@@ -149,6 +149,7 @@ public enum ValidationErrorCode
TRANSACTION_CANNOT_REFUND_UNLESS_SETTLED = 91506,
TRANSACTION_CANNOT_REFUND_WITH_SUSPENDED_MERCHANT_ACCOUNT = 91538,
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,
View
4 CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.20.0
+
+* Adds channel field to transactions.
+
## 2.19.0
* Adds country of issuance and issuing bank
Please sign in to comment.
Something went wrong with that request. Please try again.