Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PayPal updates and new 'CardHolderName' param #221

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MangoPay.SDK.Tests/ApiCardRegistrationsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public async Task Test_CardRegistrations_Update()
var registrationData = await this.GetPaylineCorrectRegistartionData(cardRegistration);
cardRegistrationPut.RegistrationData = registrationData;
cardRegistrationPut.Tag = "DefaultTag - Updated";
cardRegistrationPut.CardHolderName = "John Silver";

var getCardRegistration = await this.Api.CardRegistrations.UpdateAsync(cardRegistrationPut, cardRegistration.Id);

Expand Down
2 changes: 1 addition & 1 deletion MangoPay.SDK.Tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ protected async Task<TransferDTO> GetNewTransfer(WalletDTO walletIn = null)
var walletPost = new WalletPostDTO(new List<string> { user.Id }, "WALLET IN EUR FOR TRANSFER", CurrencyIso.EUR);
var wallet = await this.Api.Wallets.CreateAsync(walletPost);

var transfer = new TransferPostDTO(user.Id, user.Id, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletWithMoney.Id, wallet.Id)
var transfer = new TransferPostDTO(user.Id, null, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletWithMoney.Id, wallet.Id)
{
Tag = "DefaultTag"
};
Expand Down
2 changes: 1 addition & 1 deletion MangoPay.SDK/Core/APIs/ApiBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ public abstract class ApiBase
{ MethodKey.PayinsRecurringRegistration, new ApiEndPoint("/recurringpayinregistrations", RequestType.POST)},
{ MethodKey.PayinsGetRecurringRegistration, new ApiEndPoint("/recurringpayinregistrations/{0}", RequestType.GET)},
{ MethodKey.PayinsPutRecurringRegistration, new ApiEndPoint("/recurringpayinregistrations/{0}", RequestType.PUT)},

{ MethodKey.PayinsRecurringCardDirect, new ApiEndPoint("/payins/recurring/card/direct", RequestType.POST) },

{ MethodKey.PayInsCreateCardPreAuthorizedDeposit,new ApiEndPoint("/payins/deposit-preauthorized/direct/full-capture",RequestType.POST)},
{ MethodKey.PayInsAddTrackingInformation,new ApiEndPoint("/payins/{0}/trackings",RequestType.PUT)},

{ MethodKey.GetPaymentMethodMetadata, new ApiEndPoint("/payment-methods/metadata", RequestType.POST) },

Expand Down
10 changes: 10 additions & 0 deletions MangoPay.SDK/Core/APIs/ApiPayIns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.PUT;

namespace MangoPay.SDK.Core.APIs
Expand Down Expand Up @@ -402,5 +403,14 @@ public async Task<PaymentMethodMetadataDTO> GetPaymentMethodMetadataAsync(Paymen
{
return await this.CreateObjectAsync<PaymentMethodMetadataDTO, PaymentMethodMetadataPostDTO>(MethodKey.GetPaymentMethodMetadata, metadata, null);
}

/// <summary>Add tracking information to a PayPal PayIn (add the tracking number and carrier for LineItems shipments.)</summary>
/// <param name="payInId">PayIn identifier.</param>
/// <param name="trackingInformation">The tracking information to be added.</param>
/// <returns>The updated PayPal PayIn.</returns>
public async Task<PayInPayPalWebDTO> AddPayPalTrackingInformation(string payInId, PayPalTrackingInformationPutDTO trackingInformation)
{
return await this.UpdateObjectAsync<PayInPayPalWebDTO, PayPalTrackingInformationPutDTO>(MethodKey.PayInsAddTrackingInformation, trackingInformation, null, payInId);
}
}
}
1 change: 1 addition & 0 deletions MangoPay.SDK/Core/Enumerations/MethodKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,6 @@ public enum MethodKey
GetConversion,
CreateConversionQuote,
GetConversionQuote,
PayInsAddTrackingInformation
}
}
5 changes: 5 additions & 0 deletions MangoPay.SDK/Entities/GET/CardDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,10 @@ public class CardDTO : EntityBase

///<summary>Card's fingerprint, which is unique per 16-digit card number.</summary>
public string Fingerprint { get; set; }

/// <summary>
/// The cardholder’s name shown on the payment card.
/// </summary>
public string CardHolderName { get; set; }
}
}
7 changes: 6 additions & 1 deletion MangoPay.SDK/Entities/GET/CardValidationDTO.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using MangoPay.SDK.Core;
using MangoPay.SDK.Core.Enumerations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using UnixDateTimeConverter = MangoPay.SDK.Core.UnixDateTimeConverter;

namespace MangoPay.SDK.Entities.GET
{
Expand Down Expand Up @@ -57,5 +58,9 @@ public class CardValidationDTO : EntityBase

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

/// <summary>Secure mode.</summary>
[JsonConverter(typeof(StringEnumConverter))]
public SecureMode? SecureMode { get; set; }
}
}
18 changes: 18 additions & 0 deletions MangoPay.SDK/Entities/GET/PayInPayPalWebDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,23 @@ public class PayInPayPalWebDTO : PayInDTO
public ShippingPreference? ShippingPreference { get; set; }

public string Reference { get; set; }

public string CancelURL { get; set; }

public string PaypalPayerID { get; set; }

public string BuyerCountry { get; set; }

public string BuyerFirstname { get; set; }

public string BuyerLastname { get; set; }

public string BuyerPhone { get; set; }

public string PaypalOrderID { get; set; }

public string PaypalBuyerAccountEmail { get; set; }

public List<PayPalTrackingInformation> Trackings { get; set; }
}
}
2 changes: 2 additions & 0 deletions MangoPay.SDK/Entities/LineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ public class LineItem
/// - Or the firstname and lastname of the seller
/// </summary>
public string Description { get; set; }

public string Category { get; set; }
}
}
11 changes: 10 additions & 1 deletion MangoPay.SDK/Entities/POST/CardValidationPostDTO.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
using MangoPay.SDK.Core.Enumerations;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace MangoPay.SDK.Entities.POST
{
public class CardValidationPostDTO: EntityPostBase
{
public CardValidationPostDTO(string authorId, string secureModeReturnUrl, string ipAddress, BrowserInfo browserInfo,
string tag = null)
string tag = null, SecureMode? secureMode = null)
{
AuthorId = authorId;
SecureModeReturnUrl = secureModeReturnUrl;
IpAddress = ipAddress;
BrowserInfo = browserInfo;
Tag = tag;
SecureMode = secureMode;
}

/// <summary> The unique identifier of the user at the source of the transaction.
Expand All @@ -24,5 +29,9 @@ public CardValidationPostDTO(string authorId, string secureModeReturnUrl, string

/// <summary> Information about the browser used by the end user (author) to perform the payment.
public BrowserInfo BrowserInfo;

/// <summary>Secure mode.</summary>
[JsonConverter(typeof(StringEnumConverter))]
public SecureMode? SecureMode { get; set; }
}
}
6 changes: 5 additions & 1 deletion MangoPay.SDK/Entities/POST/PayInPayPalWebPostDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public PayInPayPalWebPostDTO(
string statementDescriptor = null,
CultureCode? culture = null,
ShippingPreference? shippingPreference = null,
string reference = null
string reference = null,
string cancelUrl = null
)
{
AuthorId = authorId;
Expand All @@ -33,6 +34,7 @@ public PayInPayPalWebPostDTO(
Culture = culture;
ShippingPreference = shippingPreference;
Reference = reference;
CancelURL = cancelUrl;
}

/// <summary>Author identifier.</summary>
Expand Down Expand Up @@ -74,5 +76,7 @@ public PayInPayPalWebPostDTO(
public string StatementDescriptor { get; set; }

public string Reference { get; set; }

public string CancelURL { get; set; }
}
}
5 changes: 5 additions & 0 deletions MangoPay.SDK/Entities/PUT/CardRegistrationPutDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ public class CardRegistrationPutDTO : EntityPutBase

/// <summary>Custom data.</summary>
public string Tag { get; set; }

/// <summary>
/// The cardholder’s name shown on the payment card.
/// </summary>
public string CardHolderName { get; set; }
}
}
18 changes: 18 additions & 0 deletions MangoPay.SDK/Entities/PUT/PayPalTrackingInformationPutDTO.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace MangoPay.SDK.Entities
{
public class PayPalTrackingInformationPutDTO: EntityPutBase
{
/// <summary>The shipment’s tracking number provided by the carrier.</summary>
public string TrackingNumber { get; set; }

/// <summary>The carrier for the shipment. Use the country-specific version of the carrier if it exists,
/// otherwise use its global version.</summary>
public string Carrier { get; set; }

/// <summary>If true, sends an email notification to the PaypalBuyerAccountEmail containing the
/// TrackingNumber and Carrier, which allows the end user to track their shipment with the carrier.</summary>
public Boolean NotifyBuyer { get; set; }
}
}
18 changes: 18 additions & 0 deletions MangoPay.SDK/Entities/PayPalTrackingInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace MangoPay.SDK.Entities
{
public class PayPalTrackingInformation
{
/// <summary>The shipment’s tracking number provided by the carrier.</summary>
public string TrackingNumber { get; set; }

/// <summary>The carrier for the shipment. Use the country-specific version of the carrier if it exists,
/// otherwise use its global version.</summary>
public string Carrier { get; set; }

/// <summary>If true, sends an email notification to the PaypalBuyerAccountEmail containing the
/// TrackingNumber and Carrier, which allows the end user to track their shipment with the carrier.</summary>
public Boolean NotifyBuyer { get; set; }
}
}
Loading