Skip to content

Commit

Permalink
Merge pull request #436 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 7.1.0
  • Loading branch information
AlexandrosMor authored May 12, 2021
2 parents 7f7ef09 + 256e111 commit edfe57e
Show file tree
Hide file tree
Showing 87 changed files with 6,096 additions and 522 deletions.
6 changes: 3 additions & 3 deletions Adyen.Test/Adyen.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

<IsPackable>false</IsPackable>

<AssemblyVersion>7.0.0</AssemblyVersion>
<AssemblyVersion>7.1.0</AssemblyVersion>

<FileVersion>7.0.0</FileVersion>
<FileVersion>7.1.0</FileVersion>

<Version>7.0.0</Version>
<Version>7.1.0</Version>

<LangVersion>7.2</LangVersion>
</PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions Adyen.Test/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ protected Client CreateMockTestClientForErrors(int status, string fileName)
};
return clientMock;
}


protected string MockFileToString(string fileName)
{
Expand All @@ -477,6 +478,18 @@ protected string MockFileToString(string fileName)
return text;
}

/// <summary>
/// Helper for file reading
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public string GetFileContents(string fileName)
{
string mockPath = GetMockFilePath(fileName);
return MockFileToString(mockPath);
}


/// <summary>
/// Create dummy Nexo message header
/// </summary>
Expand Down
43 changes: 19 additions & 24 deletions Adyen.Test/CheckoutTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -477,27 +477,7 @@ public void PaymentRequestAppInfoExternalTest()
Assert.AreEqual(paymentRequest.ApplicationInfo.MerchantApplication.Version, "MerchantApplicationVersion");
}

[TestMethod]
public void PaymentsResponseParsingTest()
{
var paymentRequest = CreatePaymentRequestCheckout();
var client = CreateMockTestClientApiKeyBasedRequest("Mocks/checkout/paymentResponse-3DS-ChallengeShopper.json");
var checkout = new Checkout(client);
var paymentResponse = checkout.Payments(paymentRequest);

Assert.IsTrue(paymentResponse.Action is CheckoutThreeDS2ChallengeAction);
var paymentResponseAction = (CheckoutThreeDS2ChallengeAction)paymentResponse.Action;
Assert.AreEqual(paymentResponse.ResultCode, ResultCodeEnum.ChallengeShopper);
Assert.AreEqual(paymentResponse.PaymentData, "Te1CMIy1vKQTYsSHZ+gRbFpQy4d4n2HLD3c2b7xKnRNpWzWPuI=");
Assert.AreEqual(paymentResponseAction.PaymentData, "Te1CMIy1vKQTYsSHZ+gRbFpQy4d4n2HLD3c2b7xKnRNpWzWPuI=");
Assert.AreEqual(paymentResponseAction.Type, "threeDS2Challenge");
Assert.AreEqual(paymentResponseAction.Token, "S0zYWQ0MGEwMjU2MjEifQ==");
Assert.AreEqual(paymentResponseAction.PaymentMethodType, "scheme");
Assert.AreEqual(paymentResponse.Details[0].Key, "threeds2.challengeResult");
Assert.AreEqual(paymentResponse.Details[0].Type, "text");
Assert.AreEqual(paymentResponse.Authentication["threeds2.challengeToken"], "S0zYWQ0MGEwMjU2MjEifQ==");
}


[TestMethod]
public void PaymentsOriginTest()
{
Expand Down Expand Up @@ -612,7 +592,7 @@ public void PaypalPaymentSuccessTest()
Assert.AreEqual("Ab02b4c0!BQABAgARb1TvUJa4nwS0Z1nOmxoYfD9+z...", result.PaymentData);
Assert.AreEqual("paypal", result.PaymentMethodType);
}

[TestMethod]
public void ApplePayDetailsDeserializationTest()
{
Expand Down Expand Up @@ -663,15 +643,15 @@ public void PaymentsResponseToJsonTest()
var paymentResponse = checkout.Payments(paymentRequest);
var paymentResponseToJson = paymentResponse.ToJson();
var jObject = JObject.Parse(paymentResponseToJson);
Assert.AreEqual(jObject["action"]["type"], "threeDS2Challenge");
Assert.AreEqual(jObject["action"]["type"], "threeDS2");
}

[TestMethod]
public void StoredPaymentMethodsTest()
{
var client = CreateMockTestClientApiKeyBasedRequest("Mocks/checkout/paymentmethods-storedpaymentmethods.json");
var checkout = new Checkout(client);
var paymentMethodsRequest = new PaymentMethodsRequest(merchantAccount:"TestMerchant");
var paymentMethodsRequest = new PaymentMethodsRequest(merchantAccount: "TestMerchant");
var paymentMethodsResponse = checkout.PaymentMethods(paymentMethodsRequest);
Assert.AreEqual(4, paymentMethodsResponse.StoredPaymentMethods.Count);
Assert.AreEqual("NL32ABNA0515071439", paymentMethodsResponse.StoredPaymentMethods[0].Iban);
Expand Down Expand Up @@ -701,5 +681,20 @@ public void FraudResultParsingTest()
Assert.AreEqual(0, fraudResults[1].FraudCheckResult.AccountScore);
Assert.AreEqual(3, fraudResults[1].FraudCheckResult.CheckId);
}
/// <summary>
/// Test if the fraud result are properly deseriazed
/// POST /payments
/// </summary>
[TestMethod]
public void ThreeDS2Test()
{
var paymentRequest = CreatePaymentRequestCheckout();
var client = CreateMockTestClientApiKeyBasedRequest("Mocks/checkout/paymentResponse-3DS2-Action.json");
var checkout = new Checkout(client);
var paymentResponse = checkout.Payments(paymentRequest);
var paymentResponseThreeDs2Action = (CheckoutThreeDS2Action)paymentResponse.Action;
Assert.AreEqual(ResultCodeEnum.IdentifyShopper, paymentResponse.ResultCode);
Assert.AreEqual("threeDS2", paymentResponseThreeDs2Action.Type);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using Adyen.Service;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Adyen.Test
namespace Adyen.Test.MarketPayTest
{
[TestClass]
public class MarketPayFundTest : BaseTest
Expand Down
Loading

0 comments on commit edfe57e

Please sign in to comment.