-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Adyen/develop
Terminal API
- Loading branch information
Showing
220 changed files
with
6,837 additions
and
282 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<system.net> | ||
<settings> | ||
<servicePointManager | ||
checkCertificateName="false" | ||
checkCertificateRevocationList="false" | ||
/> | ||
</settings> | ||
</system.net> | ||
</configuration> |
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,30 @@ | ||
using Adyen.EcommLibrary.Service; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
|
||
namespace Adyen.EcommLibrary.Test | ||
{ | ||
[TestClass] | ||
public class CloudApiPosRequestTest : BaseTest | ||
{ | ||
|
||
[TestMethod] | ||
public void TestCloudApiRequest() | ||
{ | ||
try | ||
{ | ||
//Create a mock pos payment request | ||
var paymentRequest = MockPosApiRequest.CreatePosPaymentRequest("Request"); | ||
var client = CreateMockTestClientPosApiRequest("Mocks/pospayment-success.json"); | ||
var payment = new PosPayment(client); | ||
var saleToPoiResponse = payment.TerminalApiOverCLoudAsync(paymentRequest); | ||
|
||
Assert.IsNotNull(saleToPoiResponse); | ||
} | ||
catch (Exception) | ||
{ | ||
Assert.Fail(); | ||
} | ||
} | ||
} | ||
} |
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,53 @@ | ||
using Adyen.EcommLibrary.HttpClient; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace Adyen.EcommLibrary.Test | ||
{ | ||
[TestClass] | ||
public class HeaderRequestTest | ||
{ | ||
|
||
private readonly HttpUrlConnectionClient _httpUrlConnectionClient; | ||
private readonly string _endpoint = "https://endpoint:8080"; | ||
|
||
public HeaderRequestTest() | ||
{ | ||
_httpUrlConnectionClient = new HttpUrlConnectionClient(); | ||
} | ||
[TestMethod] | ||
public void BasicAuthenticationHeadersTest() | ||
{ | ||
var httpWebRequest = _httpUrlConnectionClient.GetHttpWebRequest(_endpoint, MockPaymentData.CreateConfingMock(), false); | ||
|
||
Assert.IsNotNull(httpWebRequest.UserAgent); | ||
Assert.AreEqual(httpWebRequest.Address, _endpoint); | ||
Assert.AreEqual(httpWebRequest.Headers["Accept-Charset"], "UTF-8"); | ||
Assert.AreEqual(httpWebRequest.Headers["Cache-Control"], "no-cache"); | ||
Assert.AreEqual(httpWebRequest.ContentType, "application/json"); | ||
|
||
Assert.IsNotNull(httpWebRequest.Headers["Authorization"]); | ||
Assert.IsTrue(httpWebRequest.UseDefaultCredentials); | ||
|
||
Assert.AreEqual(httpWebRequest.Headers["Cache-Control"], "no-cache"); | ||
Assert.IsNull(httpWebRequest.Headers["x-api-key"]); | ||
} | ||
|
||
[TestMethod] | ||
public void ApiKeyBasedHeadersTest() | ||
{ | ||
var httpWebRequest = _httpUrlConnectionClient.GetHttpWebRequest(_endpoint, MockPaymentData.CreateConfingApiKeyBasedMock(), true); | ||
|
||
Assert.IsNotNull(httpWebRequest.UserAgent); | ||
Assert.AreEqual(httpWebRequest.Address, _endpoint); | ||
Assert.AreEqual(httpWebRequest.Headers["Accept-Charset"], "UTF-8"); | ||
Assert.AreEqual(httpWebRequest.Headers["Cache-Control"], "no-cache"); | ||
Assert.AreEqual(httpWebRequest.ContentType, "application/json"); | ||
|
||
Assert.IsNull(httpWebRequest.Headers["Authorization"]); | ||
Assert.IsFalse(httpWebRequest.UseDefaultCredentials); | ||
|
||
Assert.IsNotNull(httpWebRequest.Headers["x-api-key"]); | ||
Assert.AreEqual(httpWebRequest.Headers["x-api-key"], "AQEyhmfxK....LAG84XwzP5pSpVd"); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.