Skip to content

Commit

Permalink
Merge pull request #474 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 7.2.0
  • Loading branch information
AlexandrosMor authored Jul 8, 2021
2 parents edfe57e + 714f9d1 commit f1c6dc3
Show file tree
Hide file tree
Showing 37 changed files with 932 additions and 536 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @Aleffio @AlexandrosMor @martinsrenato @msilvagarcia @rikterbeek @deepu105
* @Aleffio @AlexandrosMor @martinsrenato @rikterbeek @deepu105
12 changes: 6 additions & 6 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.1.0</AssemblyVersion>
<AssemblyVersion>7.2.0</AssemblyVersion>

<FileVersion>7.1.0</FileVersion>
<FileVersion>7.2.0</FileVersion>

<Version>7.1.0</Version>
<Version>7.2.0</Version>

<LangVersion>7.2</LangVersion>
</PropertyGroup>
Expand All @@ -33,12 +33,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />

<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />

<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.5" />
</ItemGroup>

<ItemGroup>
Expand Down
23 changes: 0 additions & 23 deletions Adyen.Test/ApplePayDeserializationTest.cs

This file was deleted.

49 changes: 2 additions & 47 deletions Adyen.Test/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,53 +152,8 @@ public Model.Checkout.PaymentRequest CreatePaymentRequestCheckout()
paymentsRequest.AddCardData("4111111111111111", "10", "2020", "737", "John Smith");
return paymentsRequest;
}

/// <summary>
/// Check out Apple Pay payment request
/// </summary>
/// <returns></returns>
public Model.Checkout.PaymentRequest CreateApplePayPaymentRequestCheckout()
{
var amount = new Model.Checkout.Amount("USD", 1000);
var applePay = new Model.Checkout.DefaultPaymentMethodDetails()
{
Type = "applepay",
ApplePayToken = "VNRWtuNlNEWkRCSm1xWndjMDFFbktkQU..."
};
var paymentsRequest = new Model.Checkout.PaymentRequest
{
Amount = amount,
Reference = "Your order number ",
ReturnUrl = @"https://your-company.com/...",
MerchantAccount = "MerchantAccount",
PaymentMethod = applePay
};
return paymentsRequest;
}

/// <summary>
/// Check out Google Pay payment request
/// </summary>
/// <returns></returns>
public Model.Checkout.PaymentRequest CreateGooglePayPaymentRequestCheckout()
{
var amount = new Model.Checkout.Amount("USD", 1000);
var googlePay = new Model.Checkout.DefaultPaymentMethodDetails()
{
Type = "paywithgoogle",
GooglePayToken = "==Payload as retrieved from Google Pay response=="
};
var paymentsRequest = new Model.Checkout.PaymentRequest
{
Amount = amount,
Reference = "Your order number ",
ReturnUrl = @"https://your-company.com/...",
MerchantAccount = "MerchantAccount",
PaymentMethod = googlePay
};
return paymentsRequest;
}



/// <summary>
/// 3DS2 payments request
/// </summary>
Expand Down
30 changes: 0 additions & 30 deletions Adyen.Test/CheckoutTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,36 +128,6 @@ public async Task PaymentsAsyncAdditionalDataParsingTest()
Assert.AreEqual("NL", paymentResponse.AdditionalData["cardIssuingCountry"]);
}

/// <summary>
/// Test success flow for Apple Pay
/// POST /payments
/// </summary>
[TestMethod]
public void PaymentsApplePayTest()
{
var paymentRequest = CreateApplePayPaymentRequestCheckout();
var client = CreateMockTestClientApiKeyBasedRequest("Mocks/checkout/payments-applepay-success.json");
var checkout = new Checkout(client);
var paymentResponse = checkout.Payments(paymentRequest);
Assert.AreEqual("9035798957043214", paymentResponse.PspReference);
Assert.AreEqual(ResultCodeEnum.Authorised, paymentResponse.ResultCode);
}

/// <summary>
/// Test success flow for Google Pay
/// POST /payments
/// </summary>
[TestMethod]
public void PaymentsGooglePayTest()
{
var paymentRequest = CreateGooglePayPaymentRequestCheckout();
var client = CreateMockTestClientApiKeyBasedRequest("Mocks/checkout/payments-googlepay-success.json");
var checkout = new Checkout(client);
var paymentResponse = checkout.Payments(paymentRequest);
Assert.AreEqual("9035798960987345", paymentResponse.PspReference);
Assert.AreEqual(ResultCodeEnum.Authorised, paymentResponse.ResultCode);
}

/// <summary>
/// Test success flow for 3DS2
/// POST /payments
Expand Down
15 changes: 0 additions & 15 deletions Adyen.Test/MockPaymentData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,6 @@ public static PaymentRequest3D CreateFullPaymentRequest3D()
return paymentRequest;
}

public static Adyen.Model.Checkout.PaymentRequest CreateApplePayPaymentRequest()
{
var paymentRequest = new Adyen.Model.Checkout.PaymentRequest
{
MerchantAccount = "MerchantAccount",
Reference = "payment - " + DateTime.Now.ToString("yyyyMMdd"),
PaymentMethod = new DefaultPaymentMethodDetails
{
Type = "applepay",
ApplePayToken = "ApplePayToken"
}
};

return paymentRequest;
}

public static BrowserInfo CreateMockBrowserInfo()
{
Expand Down
4 changes: 0 additions & 4 deletions Adyen.Test/Mocks/checkout/paymentmethod-applepay-request.json

This file was deleted.

4 changes: 0 additions & 4 deletions Adyen.Test/Mocks/checkout/payments-applepay-success.json

This file was deleted.

4 changes: 0 additions & 4 deletions Adyen.Test/Mocks/checkout/payments-googlepay-success.json

This file was deleted.

8 changes: 8 additions & 0 deletions Adyen.Test/Mocks/recurring/notifyShopper-success.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"displayedReference": "Example displayed reference",
"message": "Request processed successfully",
"pspReference": "8516167336214570",
"reference": "Example reference",
"resultCode": "Success",
"shopperNotificationReference": "IA0F7500002462"
}
45 changes: 34 additions & 11 deletions Adyen.Test/RecurringTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@
#endregion

using System;
using Adyen.HttpClient;
using Adyen.Model.Enum;
using Adyen.Model.Recurring;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using Recurring = Adyen.Model.Recurring.Recurring;
using System.Threading.Tasks;

namespace Adyen.Test
{
[TestClass]
public class RecurringTest:BaseTest
public class RecurringTest : BaseTest
{

[TestMethod]
public void TestListRecurringDetails()
{
var client = base.CreateMockTestClientNullRequiredFieldsRequest("Mocks/recurring/listRecurringDetails-success.json");
var recurring=new Service.Recurring(client);
var recurring = new Service.Recurring(client);
var recurringDetailsRequest = this.CreateRecurringDetailsRequest();
var recurringDetailsResult = recurring.ListRecurringDetails(recurringDetailsRequest);
Assert.AreEqual(1L, (long)recurringDetailsResult.Details.Count);
Expand Down Expand Up @@ -71,7 +69,6 @@ public void TestDisable()
var recurring = new Service.Recurring(client);
var disableRequest = this.CreateDisableRequest();
var disableResult = recurring.Disable(disableRequest);
Assert.AreEqual(1L, (long)disableResult.Details.Count);
Assert.AreEqual("[detail-successfully-disabled]", disableResult.Response);
}

Expand All @@ -82,7 +79,6 @@ public async Task TestDisableAsync()
var recurring = new Service.Recurring(client);
var disableRequest = this.CreateDisableRequest();
var disableResult = await recurring.DisableAsync(disableRequest);
Assert.AreEqual(1L, (long)disableResult.Details.Count);
Assert.AreEqual("[detail-successfully-disabled]", disableResult.Response);
}

Expand All @@ -91,7 +87,7 @@ public void TestDisable803()
{
try
{
var client = base.CreateMockTestClientForErrors(422,"Mocks/recurring/disable-error-803.json");
var client = base.CreateMockTestClientForErrors(422, "Mocks/recurring/disable-error-803.json");
var recurring = new Service.Recurring(client);
var disableRequest = this.CreateDisableRequest();

Expand All @@ -101,18 +97,33 @@ public void TestDisable803()
catch (Exception exception)
{
Assert.AreNotEqual(200, exception);

}


}

[TestMethod]
public void NotifyShopperTest()
{
Client client = base.CreateMockTestClientNullRequiredFieldsRequest("Mocks/recurring/notifyShopper-success.json");
var recurring = new Service.Recurring(client);
NotifyShopperRequest request = CreateNotifyShopperRequest();
NotifyShopperResult result = recurring.NotifyShopper(request);
Assert.IsNotNull(result);
Assert.AreEqual("Example displayed reference", result.DisplayedReference);
Assert.AreEqual("8516167336214570", result.PspReference);
Assert.AreEqual("Request processed successfully", result.Message);
Assert.AreEqual("Example reference", result.Reference);
Assert.AreEqual("Success", result.ResultCode);
Assert.AreEqual("IA0F7500002462", result.ShopperNotificationReference);
}

private RecurringDetailsRequest CreateRecurringDetailsRequest()
{
var request = new RecurringDetailsRequest
{
ShopperReference = "test-123",
MerchantAccount = "DotNetAlexandros",
Recurring = new Recurring { Contract = Contract.Oneclick }
MerchantAccount = "DotNetAlexandros"
};
return request;
}
Expand All @@ -127,5 +138,17 @@ private DisableRequest CreateDisableRequest()
return request;
}

private NotifyShopperRequest CreateNotifyShopperRequest()
{
return new NotifyShopperRequest
{
MerchantAccount = "TestMerchant",
RecurringDetailReference = "8316158654144897",
Reference = "Example reference",
ShopperReference = "1234567",
BillingDate = "2021-03-31",
DisplayedReference = "Example displayed reference"
};
}
}
}
2 changes: 1 addition & 1 deletion Adyen.Test/SaleToAcquirerDataTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void SerializationTest()
{
SaleToAcquirerData saleToAcquirerData = new SaleToAcquirerData
{
Metadata = new Dictionary<string, string> { { "key", "value" } },
Metadata = new SortedDictionary<string, string> { { "key", "value" } },
ShopperEmail = "[email protected]",
ShopperReference = "13164308",
RecurringContract = "RECURRING,ONECLICK",
Expand Down
16 changes: 12 additions & 4 deletions Adyen.Test/TerminalCommonNameValidatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public void TerminalCertificateCommonNameTest()
{
foreach (var terminalCNValidationParameter in GetTerminalCNValidationParameters())
{
bool result = Security.TerminalCommonNameValidator.ValidateCertificate(terminalCNValidationParameter.CommonName, terminalCNValidationParameter.Environment);
Assert.AreEqual(result, terminalCNValidationParameter.TestSuccess);
bool result = Security.TerminalCommonNameValidator.ValidateCertificate(terminalCNValidationParameter.CommonName, terminalCNValidationParameter.Environment);
Assert.AreEqual(result, terminalCNValidationParameter.TestSuccess);
}
}

private List<TerminalCNValidationParameters> GetTerminalCNValidationParameters()
{
return new List<TerminalCNValidationParameters>
Expand All @@ -48,12 +48,17 @@ private List<TerminalCNValidationParameters> GetTerminalCNValidationParameters()
new TerminalCNValidationParameters ( "[email protected], CN=legacy-terminal-certificate.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, true ),
new TerminalCNValidationParameters ( "[email protected], CN=P400-123456789.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, true ),
new TerminalCNValidationParameters ( "[email protected], CN=P400-123456789.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, true ),
new TerminalCNValidationParameters ( "[email protected], CN=S1E-000150123456789.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, true ),
new TerminalCNValidationParameters ( "[email protected], CN=S1E-000150123456789.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, true ),
// Wrong environment
new TerminalCNValidationParameters ( "[email protected], CN=legacy-terminal-certificate.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, false ),
new TerminalCNValidationParameters ( "[email protected], CN=P400-123456789.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, false ),
new TerminalCNValidationParameters ( "[email protected], CN=legacy-terminal-certificate.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=P400-123456789.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false),
// Invalid CN
new TerminalCNValidationParameters ( "[email protected], CN=S1E-000150123456789.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, false ),
new TerminalCNValidationParameters ( "[email protected], CN=S1E-000150123456789.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),

// Invalid CN
new TerminalCNValidationParameters ( "[email protected], CN=wrong-terminal-certificate.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=legacyy-terminal-certificate.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=legacy-terminaal-certificate.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
Expand All @@ -67,6 +72,9 @@ private List<TerminalCNValidationParameters> GetTerminalCNValidationParameters()
new TerminalCNValidationParameters ( "[email protected], CN=-123.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=www.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=ANY, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=S1E-0001501234567891.test.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false ),
new TerminalCNValidationParameters ( "[email protected], CN=S1E-0001501234567891.live.terminal.adyen.com, OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Live, false ),

// Missing CN
new TerminalCNValidationParameters( "[email protected], OU=Mock, O=Mock, L=Mock, ST=MO, C=MO", Adyen.Model.Enum.Environment.Test, false )
};
Expand Down
8 changes: 4 additions & 4 deletions Adyen/Adyen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Copyright>Adyen</Copyright>
<Version>7.1.0</Version>
<AssemblyVersion>7.1.0</AssemblyVersion>
<FileVersion>7.1.0</FileVersion>
<Version>7.2.0</Version>
<AssemblyVersion>7.2.0</AssemblyVersion>
<FileVersion>7.2.0</FileVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>The Adyen API Library for .net core enables you to work with Adyen APIs, Hosted Payment Pages and terminal api with any .net application.</Description>
<PackageProjectUrl>https://github.com/Adyen/adyen-dotnet-api-library</PackageProjectUrl>
<RepositoryUrl>https://github.com/Adyen/adyen-dotnet-api-library</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>7.1.0</PackageTags>
<PackageTags>7.2.0</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Adyen</Authors>
<Company>Adyen</Company>
Expand Down
Loading

0 comments on commit f1c6dc3

Please sign in to comment.