-
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
1 parent
18f32ab
commit 0217e9c
Showing
14 changed files
with
193 additions
and
7 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
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 |
---|---|---|
|
@@ -1197,6 +1197,23 @@ public void Sale_ReturnsPaymentInstrumentTypeForPayPal() | |
Assert.AreEqual(PaymentInstrumentType.PAYPAL_ACCOUNT, transaction.PaymentInstrumentType); | ||
} | ||
|
||
[Test] | ||
public void Sale_ReturnsDebugIdForPayPal() | ||
{ | ||
String nonce = TestHelper.GenerateOneTimePayPalNonce(gateway); | ||
TransactionRequest request = new TransactionRequest | ||
{ | ||
Amount = SandboxValues.TransactionAmount.AUTHORIZE, | ||
PaymentMethodNonce = nonce | ||
}; | ||
Result<Transaction> result = gateway.Transaction.Sale(request); | ||
Assert.IsTrue(result.IsSuccess()); | ||
Transaction transaction = result.Target; | ||
|
||
Assert.IsNotNull(transaction.PayPalDetails); | ||
Assert.IsNotNull(transaction.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
public void Sale_WithAllAttributes() | ||
{ | ||
|
@@ -3532,6 +3549,30 @@ public void CreateTransaction_WithPaymentMethodNonce() | |
Assert.IsTrue(result.IsSuccess()); | ||
} | ||
|
||
[Test] | ||
public void CreateTransaction_WithPayeeEmail() | ||
{ | ||
String nonce = TestHelper.GenerateOneTimePayPalNonce(gateway); | ||
TransactionRequest request = new TransactionRequest | ||
{ | ||
Amount = SandboxValues.TransactionAmount.AUTHORIZE, | ||
PaymentMethodNonce = nonce, | ||
PayPalAccount = new TransactionPayPalRequest() | ||
{ | ||
PayeeEmail = "[email protected]" | ||
} | ||
}; | ||
Result<Transaction> 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_WithOneTimePayPalNonce() | ||
{ | ||
|
@@ -3548,6 +3589,7 @@ public void CreateTransaction_WithOneTimePayPalNonce() | |
Assert.IsNotNull(result.Target.PayPalDetails.AuthorizationId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.ImageUrl); | ||
Assert.IsNull(result.Target.PayPalDetails.Token); | ||
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
|
@@ -3569,6 +3611,7 @@ public void CreateTransaction_WithOneTimePayPalNonceAndAttemptToVault() | |
Assert.IsNotNull(result.Target.PayPalDetails.PaymentId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.AuthorizationId); | ||
Assert.IsNull(result.Target.PayPalDetails.Token); | ||
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
|
@@ -3590,6 +3633,7 @@ public void CreateTransaction_WithFuturePayPalNonceAndAttemptToVault() | |
Assert.IsNotNull(result.Target.PayPalDetails.PaymentId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.AuthorizationId); | ||
Assert.IsNotNull(result.Target.PayPalDetails.Token); | ||
Assert.IsNotNull(result.Target.PayPalDetails.DebugId); | ||
} | ||
|
||
[Test] | ||
|
@@ -3646,5 +3690,53 @@ public void Refund_PayPalTransaction() | |
Result<Transaction> refundResult = gateway.Transaction.Refund(id); | ||
Assert.IsTrue(refundResult.IsSuccess()); | ||
} | ||
|
||
[Test] | ||
public void PayPalTransactionsReturnSettlementDeclinedResponse() | ||
{ | ||
var request = new TransactionRequest | ||
{ | ||
Amount = 1000M, | ||
PaymentMethodNonce = Nonce.PayPalFuturePayment, | ||
Options = new TransactionOptionsRequest | ||
{ | ||
SubmitForSettlement = true | ||
} | ||
}; | ||
|
||
var transactionResult = gateway.Transaction.Sale(request); | ||
Assert.IsTrue(transactionResult.IsSuccess()); | ||
|
||
TestHelper.SettlementDecline(service, transactionResult.Target.Id); | ||
Transaction transaction = gateway.Transaction.Find(transactionResult.Target.Id); | ||
|
||
Assert.AreEqual("4001", transaction.ProcessorSettlementResponseCode); | ||
Assert.AreEqual(TransactionStatus.SETTLEMENT_DECLINED, transaction.Status); | ||
Assert.AreEqual("Settlement Declined", transaction.ProcessorSettlementResponseText); | ||
} | ||
|
||
[Test] | ||
public void PayPalTransactionsReturnSettlementPendingResponse() | ||
{ | ||
var request = new TransactionRequest | ||
{ | ||
Amount = 1000M, | ||
PaymentMethodNonce = Nonce.PayPalFuturePayment, | ||
Options = new TransactionOptionsRequest | ||
{ | ||
SubmitForSettlement = true | ||
} | ||
}; | ||
|
||
var transactionResult = gateway.Transaction.Sale(request); | ||
Assert.IsTrue(transactionResult.IsSuccess()); | ||
|
||
TestHelper.SettlementPending(service, transactionResult.Target.Id); | ||
Transaction transaction = gateway.Transaction.Find(transactionResult.Target.Id); | ||
|
||
Assert.AreEqual("4002", transaction.ProcessorSettlementResponseCode); | ||
Assert.AreEqual(TransactionStatus.SETTLEMENT_PENDING, transaction.Status); | ||
Assert.AreEqual("Settlement Pending", transaction.ProcessorSettlementResponseText); | ||
} | ||
} | ||
} |
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
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,34 @@ | ||
using System; | ||
|
||
namespace Braintree | ||
{ | ||
public class TransactionPayPalRequest : Request | ||
{ | ||
public String PayeeEmail { get; set; } | ||
|
||
public override String ToXml() | ||
{ | ||
return ToXml("paypal-account"); | ||
} | ||
|
||
public override String ToXml(String root) | ||
{ | ||
return BuildRequest(root).ToXml(); | ||
} | ||
|
||
public override String ToQueryString() | ||
{ | ||
return ToQueryString("paypal-account"); | ||
} | ||
|
||
public override String ToQueryString(String root) | ||
{ | ||
return BuildRequest(root).ToQueryString(); | ||
} | ||
|
||
protected virtual RequestBuilder BuildRequest(String root) | ||
{ | ||
return new RequestBuilder(root).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