Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Feb 12, 2024
1 parent 37a74f6 commit 2e206dc
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 62 deletions.
4 changes: 3 additions & 1 deletion MangoPay.SDK.Tests/ApiCardPreAuthorizationsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using NUnit.Framework;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace MangoPay.SDK.Tests
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion MangoPay.SDK.Tests/ApiPayInsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions MangoPay.SDK.Tests/ApiUsersTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace MangoPay.SDK.Tests
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion MangoPay.SDK.Tests/ApiWalletsTest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
33 changes: 2 additions & 31 deletions MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -998,36 +998,7 @@ protected async Task<string> 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);
}

/// <param name="cardRegistration">CardRegistration instance.</param>
/// <returns>Registration data.</returns>
protected async Task<string> 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");

Expand Down Expand Up @@ -1055,7 +1026,7 @@ protected async Task<CardRegistrationDTO> 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";

Expand Down
56 changes: 28 additions & 28 deletions MangoPay.SDK/Entities/GET/CardValidationDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,54 @@ namespace MangoPay.SDK.Entities.GET
public class CardValidationDTO: EntityBase
{

/// <summary> The unique identifier of the user at the source of the transaction. &lt;/summary&gt;
public string AuthorId;
/// <summary> The unique identifier of the user at the source of the transaction. </summary>
public string AuthorId { get; set; }

/// <summary> The URL to which users are automatically returned after
/// 3DS2 if it is triggered (i.e., if the SecureModeNeeded parameter is set to true). &lt;/summary&gt;
public string SecureModeReturnUrl;
/// 3DS2 if it is triggered (i.e., if the SecureModeNeeded parameter is set to true). </summary>
public string SecureModeReturnUrl { get; set; }

/// <summary> The URL to which users are to be redirected to proceed to 3DS2 validation. &lt;/summary&gt;
public string SecureModeRedirectURL;
/// <summary> The URL to which users are to be redirected to proceed to 3DS2 validation. </summary>
public string SecureModeRedirectURL { get; set; }

/// <summary> Whether or not the SecureMode was used. &lt;/summary&gt;
public Boolean SecureModeNeeded;
/// <summary> Whether or not the SecureMode was used. </summary>
public Boolean SecureModeNeeded { get; set; }

/// <summary> The IP address of the end user initiating the transaction, in IPV4 or IPV6 format &lt;/summary&gt;
public string IpAddress;
/// <summary> The IP address of the end user initiating the transaction, in IPV4 or IPV6 format </summary>
public string IpAddress { get; set; }

/// <summary> Information about the browser used by the end user (author) to perform the payment. &lt;/summary&gt;
public BrowserInfo BrowserInfo;
/// <summary> Information about the browser used by the end user (author) to perform the payment. </summary>
public BrowserInfo BrowserInfo { get; set; }

/// <summary> Whether the card is valid or not. &lt;/summary&gt;
public string Validity;
/// <summary> Whether the card is valid or not. </summary>
public string Validity { get; set; }

/// <summary> 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. &lt;/summary&gt;
public TransactionType Type;
/// indicates a transaction made to perform a strong customer authentication without debiting the card. </summary>
public TransactionType Type { get; set; }

/// <summary> The 3DS protocol version applied to the transaction. &lt;/summary&gt;
public string Applied3DSVersion;
/// <summary> The 3DS protocol version applied to the transaction. </summary>
public string Applied3DSVersion { get; set; }

/// <summary>
public TransactionStatus Status;
/// <summary> The status of the transaction. </summary>
public TransactionStatus Status { get; set; }

/// <summary> The code indicating the result of the operation. This information is mostly
/// used to handle errors or for filtering purposes. &lt;/summary&gt;
public string ResultCode;
/// used to handle errors or for filtering purposes. </summary>
public string ResultCode { get; set; }

/// <summary> The explanation of the result code. </summary>
public string ResultMessage;
public string ResultMessage { get; set; }

/// <summary> Allowed values: VISA, MASTERCARD, CB, MAESTRO
///
/// The card network to use, as chosen by the cardholder, in case of co-branded card products. &lt;/summary&gt;
public string PreferredCardNetwork;
/// The card network to use, as chosen by the cardholder, in case of co-branded card products. </summary>
public string PreferredCardNetwork { get; set; }

/// &lt;summary&gt; The date and time at which successful authorization occurred. If authorization failed, the value is null. &lt;/summary&gt;
public DateTime AuthorizationDate;
/// <summary> The date and time at which successful authorization occurred. If authorization failed, the value is null. </summary>
public DateTime? AuthorizationDate { get; set; }

/// <summary> Information about the card used for the transaction. </summary>
public CardInfo CardInfo;
public CardInfo CardInfo { get; set; }
}
}

0 comments on commit 2e206dc

Please sign in to comment.