-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Braintree
committed
Dec 11, 2014
1 parent
0327c78
commit fb7ab34
Showing
12 changed files
with
213 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,8 @@ public void Search_OnMultipleValueFields() | |
|
||
CreditCardVerificationSearchRequest searchRequest = new CreditCardVerificationSearchRequest(). | ||
CreditCardCardType.IncludedIn(CreditCardCardType.VISA, CreditCardCardType.MASTER_CARD). | ||
Ids.IncludedIn(verification1.Id, verification2.Id); | ||
Ids.IncludedIn(verification1.Id, verification2.Id). | ||
Status.IncludedIn(verification1.Status); | ||
|
||
ResourceCollection<CreditCardVerification> collection = gateway.CreditCardVerification.Search(searchRequest); | ||
|
||
|
@@ -163,6 +164,47 @@ public void CardTypeIndicators() | |
Assert.AreEqual(verification.CreditCard.Payroll, Braintree.CreditCardPayroll.UNKNOWN); | ||
|
||
} | ||
|
||
[Test] | ||
public void Search_OnTextFields() | ||
{ | ||
var createRequest = new CustomerRequest | ||
{ | ||
Email = "[email protected]", | ||
CreditCard = new CreditCardRequest | ||
{ | ||
Number = "4111111111111111", | ||
ExpirationDate = "05/12", | ||
BillingAddress = new CreditCardAddressRequest | ||
{ | ||
PostalCode = "44444" | ||
}, | ||
Options = new CreditCardOptionsRequest | ||
{ | ||
VerifyCard = true | ||
} | ||
} | ||
}; | ||
|
||
Result<Customer> result = gateway.Customer.Create(createRequest); | ||
String token = result.Target.CreditCards[0].Token; | ||
String postalCode = result.Target.CreditCards[0].BillingAddress.PostalCode; | ||
String customerId = result.Target.Id; | ||
String customerEmail = result.Target.Email; | ||
|
||
CreditCardVerificationSearchRequest searchRequest = new CreditCardVerificationSearchRequest(). | ||
PaymentMethodToken.Is(token). | ||
BillingAddressDetailsPostalCode.Is(postalCode). | ||
CustomerId.Is(customerId). | ||
CustomerEmail.Is(customerEmail); | ||
|
||
ResourceCollection<CreditCardVerification> collection = gateway.CreditCardVerification.Search(searchRequest); | ||
CreditCardVerification verification = collection.FirstItem; | ||
|
||
Assert.AreEqual(1, collection.MaximumCount); | ||
Assert.AreEqual(token, verification.CreditCard.Token); | ||
Assert.AreEqual(postalCode, verification.BillingAddress.PostalCode); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3119,6 +3119,19 @@ public void Find_ExposesDisputes() | |
Assert.AreEqual(dispute.Status, DisputeStatus.WON); | ||
} | ||
|
||
[Test] | ||
public void Find_ExposesRetrievals() | ||
{ | ||
Transaction transaction = gateway.Transaction.Find("retrievaltransaction"); | ||
|
||
List<Dispute> disputes = transaction.Disputes; | ||
Dispute dispute = disputes[0]; | ||
|
||
Assert.AreEqual(dispute.Amount, Decimal.Parse("1000.00")); | ||
Assert.AreEqual(dispute.CurrencyIsoCode, "USD"); | ||
Assert.AreEqual(dispute.Reason, DisputeReason.RETRIEVAL); | ||
} | ||
|
||
[Test] | ||
public void Find_IsDisbursedFalse() | ||
{ | ||
|
@@ -3764,6 +3777,62 @@ public void CreateTransaction_WithPayeeEmailInOptionsParams() | |
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
public void CreateTransaction_WithPayeeEmailInOptionsPaypal() | ||
{ | ||
var nonce = TestHelper.GenerateOneTimePayPalNonce(gateway); | ||
var request = new TransactionRequest | ||
{ | ||
Amount = SandboxValues.TransactionAmount.AUTHORIZE, | ||
PaymentMethodNonce = nonce, | ||
Options = new TransactionOptionsRequest() | ||
{ | ||
PayPal = new TransactionOptionsPayPalRequest() | ||
{ | ||
PayeeEmail = "[email protected]" | ||
} | ||
} | ||
}; | ||
|
||
var result = gateway.Transaction.Sale(request); | ||
Assert.IsTrue(result.IsSuccess()); | ||
Assert.IsNotNull(result.Target.PayPalDetails.PayerEmail); | ||
Assert.IsNotNull(result.Target.PayPalDetails.PaymentId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.AuthorizationId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.ImageUrl); | ||
Assert.AreEqual("[email protected]", result.Target.PayPalDetails.PayeeEmail); | ||
Assert.IsNull(result.Target.PayPalDetails.Token); | ||
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
public void CreateTransaction_WithPayPalCustomField() | ||
{ | ||
var nonce = TestHelper.GenerateOneTimePayPalNonce(gateway); | ||
var request = new TransactionRequest | ||
{ | ||
Amount = SandboxValues.TransactionAmount.AUTHORIZE, | ||
PaymentMethodNonce = nonce, | ||
Options = new TransactionOptionsRequest() | ||
{ | ||
PayPal = new TransactionOptionsPayPalRequest() | ||
{ | ||
CustomField = "custom field stuff" | ||
} | ||
} | ||
}; | ||
|
||
var result = gateway.Transaction.Sale(request); | ||
Assert.IsTrue(result.IsSuccess()); | ||
Assert.IsNotNull(result.Target.PayPalDetails.PayerEmail); | ||
Assert.IsNotNull(result.Target.PayPalDetails.PaymentId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.AuthorizationId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.ImageUrl); | ||
Assert.AreEqual("custom field stuff", result.Target.PayPalDetails.CustomField); | ||
Assert.IsNull(result.Target.PayPalDetails.Token); | ||
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
public void CreateTransaction_WithOneTimePayPalNonce() | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
|
||
namespace Braintree | ||
{ | ||
public class TransactionOptionsPayPalRequest : Request | ||
{ | ||
public string CustomField { get; set; } | ||
public string PayeeEmail { get; set; } | ||
|
||
public override string ToXml(string root) | ||
{ | ||
return BuildRequest(root).ToXml(); | ||
} | ||
|
||
public override string ToQueryString(string root) | ||
{ | ||
return BuildRequest(root).ToQueryString(); | ||
} | ||
|
||
private RequestBuilder BuildRequest(string root) | ||
{ | ||
return new RequestBuilder(root). | ||
AddElement("custom-field", CustomField). | ||
AddElement("payee-email", PayeeEmail); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters