From 2e206dc0a3c8526a0dff74dcb60d0e3193c486d9 Mon Sep 17 00:00:00 2001 From: Iulian Masar Date: Mon, 12 Feb 2024 11:46:04 +0200 Subject: [PATCH] updated tests --- .../ApiCardPreAuthorizationsTest.cs | 4 +- MangoPay.SDK.Tests/ApiPayInsTest.cs | 1 - MangoPay.SDK.Tests/ApiUsersTest.cs | 2 + MangoPay.SDK.Tests/ApiWalletsTest.cs | 5 +- MangoPay.SDK.Tests/BaseTest.cs | 33 +---------- .../Entities/GET/CardValidationDTO.cs | 56 +++++++++---------- 6 files changed, 39 insertions(+), 62 deletions(-) diff --git a/MangoPay.SDK.Tests/ApiCardPreAuthorizationsTest.cs b/MangoPay.SDK.Tests/ApiCardPreAuthorizationsTest.cs index 52a8a7f..48bfb1f 100644 --- a/MangoPay.SDK.Tests/ApiCardPreAuthorizationsTest.cs +++ b/MangoPay.SDK.Tests/ApiCardPreAuthorizationsTest.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using System; using System.Linq; +using System.Threading; using System.Threading.Tasks; namespace MangoPay.SDK.Tests @@ -178,7 +179,8 @@ public async Task Test_CardPreAuthorizationTransactions_Get() }; await Api.PayIns.CreatePreauthorizedDirectAsync(payIn); - + + Thread.Sleep(2000); var preAuthTransactions = await this.Api.CardPreAuthorizations.GetTransactionsAsync(cardPreAuthorization.Id, new Pagination(1, 10)); Assert.NotNull(preAuthTransactions); diff --git a/MangoPay.SDK.Tests/ApiPayInsTest.cs b/MangoPay.SDK.Tests/ApiPayInsTest.cs index 69f91dd..e9ef73d 100644 --- a/MangoPay.SDK.Tests/ApiPayInsTest.cs +++ b/MangoPay.SDK.Tests/ApiPayInsTest.cs @@ -786,7 +786,6 @@ public async Task Test_PayIns_DirectDebit_Create_Get() Assert.IsNotNull(createPayIn.ReturnURL); Assert.IsNotNull(createPayIn.RedirectURL); - Assert.IsNotNull(createPayIn.TemplateURL); var getPayIn = await this.Api.PayIns.GetDirectDebitAsync(createPayIn.Id); diff --git a/MangoPay.SDK.Tests/ApiUsersTest.cs b/MangoPay.SDK.Tests/ApiUsersTest.cs index a323d3e..1246051 100644 --- a/MangoPay.SDK.Tests/ApiUsersTest.cs +++ b/MangoPay.SDK.Tests/ApiUsersTest.cs @@ -11,6 +11,7 @@ using System.IO; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace MangoPay.SDK.Tests @@ -899,6 +900,7 @@ public async Task Test_Users_GetTransactionsForBankAccount() var sort = new Sort(); sort.AddField("CreationDate", SortDirection.desc); + Thread.Sleep(2000); var transactions = await Api.Users.GetTransactionsForBankAccountAsync(bankAccountId, pagination, filter, sort); Assert.IsTrue(transactions.Count > 0); diff --git a/MangoPay.SDK.Tests/ApiWalletsTest.cs b/MangoPay.SDK.Tests/ApiWalletsTest.cs index 8ef7503..9880418 100644 --- a/MangoPay.SDK.Tests/ApiWalletsTest.cs +++ b/MangoPay.SDK.Tests/ApiWalletsTest.cs @@ -1,4 +1,5 @@ -using MangoPay.SDK.Core; +using System.Threading; +using MangoPay.SDK.Core; using MangoPay.SDK.Core.Enumerations; using MangoPay.SDK.Entities; using MangoPay.SDK.Entities.GET; @@ -63,6 +64,8 @@ public async Task Test_Wallets_Transactions() { Type = TransactionType.PAYIN }; + + Thread.Sleep(2000); var transactions = await Api.Wallets.GetTransactionsAsync(wallet.Id, pagination, filter, null); Assert.IsTrue(transactions.Count == 1); diff --git a/MangoPay.SDK.Tests/BaseTest.cs b/MangoPay.SDK.Tests/BaseTest.cs index 0c721aa..c8989b3 100644 --- a/MangoPay.SDK.Tests/BaseTest.cs +++ b/MangoPay.SDK.Tests/BaseTest.cs @@ -998,36 +998,7 @@ protected async Task GetPaylineCorrectRegistartionData(CardRegistrationD }; request.AddParameter("data", cardRegistration.PreregistrationData); request.AddParameter("accessKeyRef", cardRegistration.AccessKey); - request.AddParameter("cardNumber", "4970105191923460"); - request.AddParameter("cardExpirationDate", "1224"); - request.AddParameter("cardCvx", "123"); - - // Payline requires TLS - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - - var response = await client.ExecuteAsync(request); - - var responseString = response.Content; - - if (response.StatusCode == HttpStatusCode.OK) - return responseString; - - throw new Exception(responseString); - } - - /// CardRegistration instance. - /// Registration data. - protected async Task GetPaylineCorrectRegistartionDataForDeposit(CardRegistrationDTO cardRegistration) - { - var client = new RestClient(cardRegistration.CardRegistrationURL); - - var request = new RestRequest - { - Method = Method.Post - }; - request.AddParameter("data", cardRegistration.PreregistrationData); - request.AddParameter("accessKeyRef", cardRegistration.AccessKey); - request.AddParameter("cardNumber", "4970105181818183"); + request.AddParameter("cardNumber", "4970107111111119"); request.AddParameter("cardExpirationDate", "1224"); request.AddParameter("cardCvx", "123"); @@ -1055,7 +1026,7 @@ protected async Task GetCardRegistrationForDeposit() var cardRegistration = await this.Api.CardRegistrations.CreateAsync(cardRegistrationPostDto); var cardRegistrationPut = new CardRegistrationPutDTO(); - var registrationData = await this.GetPaylineCorrectRegistartionDataForDeposit(cardRegistration); + var registrationData = await this.GetPaylineCorrectRegistartionData(cardRegistration); cardRegistrationPut.RegistrationData = registrationData; cardRegistrationPut.Tag = "DefaultTag - Updated"; diff --git a/MangoPay.SDK/Entities/GET/CardValidationDTO.cs b/MangoPay.SDK/Entities/GET/CardValidationDTO.cs index 6186887..9a4ab61 100644 --- a/MangoPay.SDK/Entities/GET/CardValidationDTO.cs +++ b/MangoPay.SDK/Entities/GET/CardValidationDTO.cs @@ -8,54 +8,54 @@ namespace MangoPay.SDK.Entities.GET public class CardValidationDTO: EntityBase { - /// The unique identifier of the user at the source of the transaction. </summary> - public string AuthorId; + /// The unique identifier of the user at the source of the transaction. + public string AuthorId { get; set; } /// The URL to which users are automatically returned after - /// 3DS2 if it is triggered (i.e., if the SecureModeNeeded parameter is set to true). </summary> - public string SecureModeReturnUrl; + /// 3DS2 if it is triggered (i.e., if the SecureModeNeeded parameter is set to true). + public string SecureModeReturnUrl { get; set; } - /// The URL to which users are to be redirected to proceed to 3DS2 validation. </summary> - public string SecureModeRedirectURL; + /// The URL to which users are to be redirected to proceed to 3DS2 validation. + public string SecureModeRedirectURL { get; set; } - /// Whether or not the SecureMode was used. </summary> - public Boolean SecureModeNeeded; + /// Whether or not the SecureMode was used. + public Boolean SecureModeNeeded { get; set; } - /// The IP address of the end user initiating the transaction, in IPV4 or IPV6 format </summary> - public string IpAddress; + /// The IP address of the end user initiating the transaction, in IPV4 or IPV6 format + public string IpAddress { get; set; } - /// Information about the browser used by the end user (author) to perform the payment. </summary> - public BrowserInfo BrowserInfo; + /// Information about the browser used by the end user (author) to perform the payment. + public BrowserInfo BrowserInfo { get; set; } - /// Whether the card is valid or not. </summary> - public string Validity; + /// Whether the card is valid or not. + public string Validity { get; set; } /// The type of transaction. In the specific case of the Card Validation object, this value - /// indicates a transaction made to perform a strong customer authentication without debiting the card. </summary> - public TransactionType Type; + /// indicates a transaction made to perform a strong customer authentication without debiting the card. + public TransactionType Type { get; set; } - /// The 3DS protocol version applied to the transaction. </summary> - public string Applied3DSVersion; + /// The 3DS protocol version applied to the transaction. + public string Applied3DSVersion { get; set; } - /// - public TransactionStatus Status; + /// The status of the transaction. + public TransactionStatus Status { get; set; } /// The code indicating the result of the operation. This information is mostly - /// used to handle errors or for filtering purposes. </summary> - public string ResultCode; + /// used to handle errors or for filtering purposes. + public string ResultCode { get; set; } /// The explanation of the result code. - public string ResultMessage; + public string ResultMessage { get; set; } /// Allowed values: VISA, MASTERCARD, CB, MAESTRO /// - /// The card network to use, as chosen by the cardholder, in case of co-branded card products. </summary> - public string PreferredCardNetwork; + /// The card network to use, as chosen by the cardholder, in case of co-branded card products. + public string PreferredCardNetwork { get; set; } - /// <summary> The date and time at which successful authorization occurred. If authorization failed, the value is null. </summary> - public DateTime AuthorizationDate; + /// The date and time at which successful authorization occurred. If authorization failed, the value is null. + public DateTime? AuthorizationDate { get; set; } /// Information about the card used for the transaction. - public CardInfo CardInfo; + public CardInfo CardInfo { get; set; } } } \ No newline at end of file