diff --git a/MangoPay.SDK.Tests/ApiCardRegistrationsTest.cs b/MangoPay.SDK.Tests/ApiCardRegistrationsTest.cs index 958462f..30193a2 100644 --- a/MangoPay.SDK.Tests/ApiCardRegistrationsTest.cs +++ b/MangoPay.SDK.Tests/ApiCardRegistrationsTest.cs @@ -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); diff --git a/MangoPay.SDK.Tests/BaseTest.cs b/MangoPay.SDK.Tests/BaseTest.cs index caecdd1..b023967 100644 --- a/MangoPay.SDK.Tests/BaseTest.cs +++ b/MangoPay.SDK.Tests/BaseTest.cs @@ -847,7 +847,7 @@ protected async Task GetNewTransfer(WalletDTO walletIn = null) var walletPost = new WalletPostDTO(new List { 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" }; diff --git a/MangoPay.SDK/Core/APIs/ApiBase.cs b/MangoPay.SDK/Core/APIs/ApiBase.cs index 7df21e1..fe5303e 100644 --- a/MangoPay.SDK/Core/APIs/ApiBase.cs +++ b/MangoPay.SDK/Core/APIs/ApiBase.cs @@ -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) }, diff --git a/MangoPay.SDK/Core/APIs/ApiPayIns.cs b/MangoPay.SDK/Core/APIs/ApiPayIns.cs index 607a5ce..6c1d66f 100644 --- a/MangoPay.SDK/Core/APIs/ApiPayIns.cs +++ b/MangoPay.SDK/Core/APIs/ApiPayIns.cs @@ -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 @@ -402,5 +403,14 @@ public async Task GetPaymentMethodMetadataAsync(Paymen { return await this.CreateObjectAsync(MethodKey.GetPaymentMethodMetadata, metadata, null); } + + /// Add tracking information to a PayPal PayIn (add the tracking number and carrier for LineItems shipments.) + /// PayIn identifier. + /// The tracking information to be added. + /// The updated PayPal PayIn. + public async Task AddPayPalTrackingInformation(string payInId, PayPalTrackingInformationPutDTO trackingInformation) + { + return await this.UpdateObjectAsync(MethodKey.PayInsAddTrackingInformation, trackingInformation, null, payInId); + } } } diff --git a/MangoPay.SDK/Core/Enumerations/MethodKey.cs b/MangoPay.SDK/Core/Enumerations/MethodKey.cs index 3a3cca7..fe8c7fd 100644 --- a/MangoPay.SDK/Core/Enumerations/MethodKey.cs +++ b/MangoPay.SDK/Core/Enumerations/MethodKey.cs @@ -196,5 +196,6 @@ public enum MethodKey GetConversion, CreateConversionQuote, GetConversionQuote, + PayInsAddTrackingInformation } } diff --git a/MangoPay.SDK/Entities/GET/CardDTO.cs b/MangoPay.SDK/Entities/GET/CardDTO.cs index c97443e..b1be855 100644 --- a/MangoPay.SDK/Entities/GET/CardDTO.cs +++ b/MangoPay.SDK/Entities/GET/CardDTO.cs @@ -46,5 +46,10 @@ public class CardDTO : EntityBase ///Card's fingerprint, which is unique per 16-digit card number. public string Fingerprint { get; set; } + + /// + /// The cardholder’s name shown on the payment card. + /// + public string CardHolderName { get; set; } } } diff --git a/MangoPay.SDK/Entities/GET/CardValidationDTO.cs b/MangoPay.SDK/Entities/GET/CardValidationDTO.cs index 2c69f5d..a5438a7 100644 --- a/MangoPay.SDK/Entities/GET/CardValidationDTO.cs +++ b/MangoPay.SDK/Entities/GET/CardValidationDTO.cs @@ -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 { @@ -57,5 +58,9 @@ public class CardValidationDTO : EntityBase /// Information about the card used for the transaction. public CardInfo CardInfo { get; set; } + + /// Secure mode. + [JsonConverter(typeof(StringEnumConverter))] + public SecureMode? SecureMode { get; set; } } } \ No newline at end of file diff --git a/MangoPay.SDK/Entities/GET/PayInPayPalWebDTO.cs b/MangoPay.SDK/Entities/GET/PayInPayPalWebDTO.cs index 7f059b1..2de72c6 100644 --- a/MangoPay.SDK/Entities/GET/PayInPayPalWebDTO.cs +++ b/MangoPay.SDK/Entities/GET/PayInPayPalWebDTO.cs @@ -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 Trackings { get; set; } } } \ No newline at end of file diff --git a/MangoPay.SDK/Entities/LineItem.cs b/MangoPay.SDK/Entities/LineItem.cs index 05cb596..2b13664 100644 --- a/MangoPay.SDK/Entities/LineItem.cs +++ b/MangoPay.SDK/Entities/LineItem.cs @@ -22,5 +22,7 @@ public class LineItem /// - Or the firstname and lastname of the seller /// public string Description { get; set; } + + public string Category { get; set; } } } \ No newline at end of file diff --git a/MangoPay.SDK/Entities/POST/CardValidationPostDTO.cs b/MangoPay.SDK/Entities/POST/CardValidationPostDTO.cs index 44f3f84..d073507 100644 --- a/MangoPay.SDK/Entities/POST/CardValidationPostDTO.cs +++ b/MangoPay.SDK/Entities/POST/CardValidationPostDTO.cs @@ -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; } /// The unique identifier of the user at the source of the transaction. @@ -24,5 +29,9 @@ public CardValidationPostDTO(string authorId, string secureModeReturnUrl, string /// Information about the browser used by the end user (author) to perform the payment. public BrowserInfo BrowserInfo; + + /// Secure mode. + [JsonConverter(typeof(StringEnumConverter))] + public SecureMode? SecureMode { get; set; } } } \ No newline at end of file diff --git a/MangoPay.SDK/Entities/POST/PayInPayPalWebPostDTO.cs b/MangoPay.SDK/Entities/POST/PayInPayPalWebPostDTO.cs index 7e9a4f9..14748e3 100644 --- a/MangoPay.SDK/Entities/POST/PayInPayPalWebPostDTO.cs +++ b/MangoPay.SDK/Entities/POST/PayInPayPalWebPostDTO.cs @@ -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; @@ -33,6 +34,7 @@ public PayInPayPalWebPostDTO( Culture = culture; ShippingPreference = shippingPreference; Reference = reference; + CancelURL = cancelUrl; } /// Author identifier. @@ -74,5 +76,7 @@ public PayInPayPalWebPostDTO( public string StatementDescriptor { get; set; } public string Reference { get; set; } + + public string CancelURL { get; set; } } } \ No newline at end of file diff --git a/MangoPay.SDK/Entities/PUT/CardRegistrationPutDTO.cs b/MangoPay.SDK/Entities/PUT/CardRegistrationPutDTO.cs index 8d21bb9..53b3024 100644 --- a/MangoPay.SDK/Entities/PUT/CardRegistrationPutDTO.cs +++ b/MangoPay.SDK/Entities/PUT/CardRegistrationPutDTO.cs @@ -11,5 +11,10 @@ public class CardRegistrationPutDTO : EntityPutBase /// Custom data. public string Tag { get; set; } + + /// + /// The cardholder’s name shown on the payment card. + /// + public string CardHolderName { get; set; } } } diff --git a/MangoPay.SDK/Entities/PUT/PayPalTrackingInformationPutDTO.cs b/MangoPay.SDK/Entities/PUT/PayPalTrackingInformationPutDTO.cs new file mode 100644 index 0000000..45475eb --- /dev/null +++ b/MangoPay.SDK/Entities/PUT/PayPalTrackingInformationPutDTO.cs @@ -0,0 +1,18 @@ +using System; + +namespace MangoPay.SDK.Entities +{ + public class PayPalTrackingInformationPutDTO: EntityPutBase + { + /// The shipment’s tracking number provided by the carrier. + public string TrackingNumber { get; set; } + + /// The carrier for the shipment. Use the country-specific version of the carrier if it exists, + /// otherwise use its global version. + public string Carrier { get; set; } + + /// 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. + public Boolean NotifyBuyer { get; set; } + } +} \ No newline at end of file diff --git a/MangoPay.SDK/Entities/PayPalTrackingInformation.cs b/MangoPay.SDK/Entities/PayPalTrackingInformation.cs new file mode 100644 index 0000000..2c0d8c3 --- /dev/null +++ b/MangoPay.SDK/Entities/PayPalTrackingInformation.cs @@ -0,0 +1,18 @@ +using System; + +namespace MangoPay.SDK.Entities +{ + public class PayPalTrackingInformation + { + /// The shipment’s tracking number provided by the carrier. + public string TrackingNumber { get; set; } + + /// The carrier for the shipment. Use the country-specific version of the carrier if it exists, + /// otherwise use its global version. + public string Carrier { get; set; } + + /// 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. + public Boolean NotifyBuyer { get; set; } + } +} \ No newline at end of file