Skip to content
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
7 changes: 0 additions & 7 deletions src/CheckoutSdk/Payments/Hosted/HostedPaymentInstruction.cs

This file was deleted.

6 changes: 3 additions & 3 deletions src/CheckoutSdk/Payments/Hosted/HostedPaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ public class HostedPaymentRequest

public IDictionary<string, object> Metadata { get; set; }

public Locale Locale { get; set; }
public LocaleType? Locale { get; set; }

[JsonProperty(PropertyName = "3ds")] public ThreeDsRequest ThreeDs { get; set; }

public bool Capture { get; set; }
public bool? Capture { get; set; }

public DateTime? CaptureOn { get; set; }

public HostedPaymentInstruction Instruction { get; set; }
public PaymentInstruction Instruction { get; set; }

public PaymentMethodConfiguration PaymentMethodConfiguration { get; set; }

Expand Down
34 changes: 16 additions & 18 deletions src/CheckoutSdk/Payments/Links/PaymentLinkDetailsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,37 @@ public class PaymentLinkDetailsResponse : Resource
public string Id { get; set; }

public PaymentLinkStatus? Status { get; set; }

public string PaymentId { get; set; }


public long? Amount { get; set; }

public Currency? Currency { get; set; }

public DateTime? ExpiresOn { get; set; }

public DateTime? CreatedOn { get; set; }

public BillingInformation Billing { get; set; }

public string PaymentId { get; set; }

public string Reference { get; set; }

public string Description { get; set; }

public DateTime? CreatedOn { get; set; }

public DateTime? ExpiresOn { get; set; }

public string ProcessingChannelId { get; set; }
public IList<AmountAllocations> AmountAllocations { get; set; }
public CustomerResponse Customer { get; set; }

public ShippingDetails Shipping { get; set; }

public BillingInformation Billing { get; set; }

public IList<Product> Products { get; set; }

public IDictionary<string, object> Metadata { get; set; }

public string ReturnUrl { get; set; }

public string Locale { get; set; }

//Not available on Previous

public string ProcessingChannelId { get; set; }
public LocaleType? Locale { get; set; }

public IList<AmountAllocations> AmountAllocations { get; set; }
public string ReturnUrl { get; set; }
}
}
40 changes: 21 additions & 19 deletions src/CheckoutSdk/Payments/Links/PaymentLinkRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,38 @@ public class PaymentLinkRequest
public long? Amount { get; set; }

public Currency? Currency { get; set; }

public BillingInformation Billing { get; set; }

public PaymentType? PaymentType { get; set; }

public string PaymentIp { get; set; }

public BillingDescriptor BillingDescriptor { get; set; }

public string Reference { get; set; }

public string Description { get; set; }

public string DisplayName { get; set; }

public string ProcessingChannelId { get; set; }

public IList<AmountAllocations> AmountAllocations { get; set; }

public int? ExpiresIn { get; set; }

public CustomerRequest Customer { get; set; }

public ShippingDetails Shipping { get; set; }

public BillingInformation Billing { get; set; }

public PaymentRecipient Recipient { get; set; }

public ProcessingSettings Processing { get; set; }

public IList<PaymentSourceType> AllowPaymentMethods { get; set; }

public IList<PaymentSourceType> DisabledPaymentMethods { get; set; }

public IList<Product> Products { get; set; }

Expand All @@ -44,28 +60,14 @@ public class PaymentLinkRequest

public string ReturnUrl { get; set; }

public string Locale { get; set; }
public LocaleType Locale { get; set; }

public bool? Capture { get; set; }

public DateTime? CaptureOn { get; set; }

public PaymentType? PaymentType { get; set; }

public string PaymentIp { get; set; }

public BillingDescriptor BillingDescriptor { get; set; }

public IList<PaymentSourceType> AllowPaymentMethods { get; set; }

public IList<PaymentSourceType> DisabledPaymentMethods { get; set; }
public PaymentInstruction Instruction { get; set; }

//Not available on Previous

public string ProcessingChannelId { get; set; }

public IList<AmountAllocations> AmountAllocations { get; set; }

public string DisplayName { get; set; }
public PaymentMethodConfiguration PaymentMethodConfiguration { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Checkout.Payments
{
public enum Locale
public enum LocaleType
{
[EnumMember(Value = "ar")]
Ar,
Expand Down
9 changes: 9 additions & 0 deletions src/CheckoutSdk/Payments/PaymentInstruction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Checkout.Payments.Hosted;

namespace Checkout.Payments
{
public class PaymentInstruction
{
public PaymentPurposeType Purpose { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/CheckoutSdk/Payments/Response/GetPaymentResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class GetPaymentResponse : Resource

public bool? CkoNetworkTokenAvailable { get; set; }

public PaymentInstruction Instruction { get; set; }
public Request.PaymentInstruction Instruction { get; set; }


}
Expand Down
3 changes: 2 additions & 1 deletion src/CheckoutSdk/Payments/Sender/PaymentIndividualSender.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Checkout.Common;
using Newtonsoft.Json;

namespace Checkout.Payments.Sender
{
Expand All @@ -18,7 +19,7 @@ public PaymentIndividualSender() : base(PaymentSenderType.Individual)

public Address Address { get; set; }

public AccountHolderIdentification AccountHolderIdentification { get; set; }
[JsonProperty(PropertyName = "identification")] public AccountHolderIdentification AccountHolderIdentification { get; set; }

public string ReferenceType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private static HostedPaymentRequest CreateHostedPaymentRequest(string reference)
SuccessUrl = "https://example.com/payments/success",
CancelUrl = "https://example.com/payments/success",
FailureUrl = "https://example.com/payments/success",
Locale = Locale.EnGb,
Locale = LocaleType.EnGb,
ThreeDs = new ThreeDsRequest {Enabled = false, AttemptN3D = false},
Capture = true,
CaptureOn = DateTime.UtcNow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ protected static HostedPaymentRequest CreateHostedPaymentRequest()
SuccessUrl = "https://example.com/payments/success",
CancelUrl = "https://example.com/payments/cancel",
FailureUrl = "https://example.com/payments/failure",
Locale = Locale.Ar,
Locale = LocaleType.Ar,
ThreeDs = new ThreeDsRequest
{
Enabled = false,
Expand All @@ -156,7 +156,7 @@ protected static HostedPaymentRequest CreateHostedPaymentRequest()
},
Capture = true,
CaptureOn = DateTime.UtcNow,
Instruction = new HostedPaymentInstruction
Instruction = new PaymentInstruction
{
Purpose = PaymentPurposeType.Donations
},
Expand Down
118 changes: 101 additions & 17 deletions test/CheckoutSdkTest/Payments/Links/PaymentLinksIntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using Checkout.Common;
using Checkout.Payments.Hosted;
using Checkout.Payments.Request;
using Checkout.Payments.Sender;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
using Product = Checkout.Common.Product;

namespace Checkout.Payments.Links
{
Expand All @@ -19,15 +23,58 @@ private async Task ShouldCreateAndGetPaymentLink()
var paymentLinkRequest = new PaymentLinkRequest
{
Amount = 100,
Billing = new BillingInformation { Address = GetAddress() },
Capture = true,
CaptureOn = DateTime.Now,
Currency = Currency.GBP,
Customer = new CustomerRequest { Email = GenerateRandomEmail(), Name = "name" },
Description = "description",
Billing = new BillingInformation { Address = GetAddress() },
PaymentType = PaymentType.Regular,
PaymentIp = "192.168.0.1",
BillingDescriptor = new BillingDescriptor { Name = "name", City = "London", Reference = "reference" },
Reference = "Reference",
Description = "Description",
DisplayName = "DisplayName",
ProcessingChannelId = System.Environment.GetEnvironmentVariable("CHECKOUT_PROCESSING_CHANNEL_ID"),
AmountAllocations = new List<AmountAllocations>
{
new AmountAllocations
{
Id = "ent_sdioy6bajpzxyl3utftdp7legq",
Amount = 100,
Reference = Guid.NewGuid().ToString(),
Commission = new Commission { Amount = 1, Percentage = 0.1 }
}
},
ExpiresIn = 1,
Locale = "locale",
Reference = "referene",
Customer = new CustomerRequest { Email = GenerateRandomEmail(), Name = "name" },
Shipping = new ShippingDetails { Address = GetAddress(), Phone = GetPhone() },
Recipient = new PaymentRecipient
{
AccountNumber = "1234567",
Country = CountryCode.ES,
DateOfBirth = "1985-05-15",
FirstName = "IT",
LastName = "TESTING",
Zip = "12345"
},
Processing = new ProcessingSettings { Aft = true },
AllowPaymentMethods =
new List<PaymentSourceType> { PaymentSourceType.Card, PaymentSourceType.Ideal },
DisabledPaymentMethods =
new List<PaymentSourceType> { PaymentSourceType.EPS, PaymentSourceType.Ideal, PaymentSourceType.KNet },
Products = new List<Product>
{
new Product
{
Name = "Gold Necklace",
Quantity = 1,
Price = 10,
Reference = "some description about item",
}
},
Metadata = new Dictionary<string, object>
{
{"VoucherCode", "loyalty_10"},
{"discountApplied", "10"},
{"customer_id", "2190EF321"},
},
ThreeDs = new ThreeDsRequest
{
Enabled = true,
Expand All @@ -38,17 +85,53 @@ private async Task ShouldCreateAndGetPaymentLink()
Version = "2.0.1",
ChallengeIndicator = ChallengeIndicatorType.NoPreference
},
PaymentType = PaymentType.Regular,
AllowPaymentMethods =
new List<PaymentSourceType> { PaymentSourceType.Card, PaymentSourceType.Ideal },
AmountAllocations = new List<AmountAllocations>
Risk = new RiskRequest
{
new AmountAllocations
Enabled = false
},
CustomerRetry = new PaymentRetryRequest
{
MaxAttempts = 2
},
Sender = new PaymentInstrumentSender
{
Reference = "8285282045818"
},
Locale = LocaleType.EnGb,
Capture = true,
CaptureOn = DateTime.Now,
Instruction = new PaymentInstruction
{
Purpose = PaymentPurposeType.Pension
},
PaymentMethodConfiguration = new PaymentMethodConfiguration
{
Applepay = new Applepay
{
Id = "ent_sdioy6bajpzxyl3utftdp7legq",
Amount = 100,
Reference = Guid.NewGuid().ToString(),
Commission = new Commission { Amount = 1, Percentage = 0.1 }
AccountHolder = new AccountHolder
{
FirstName = "John",
LastName = "Jones",
Type = AccountHolderType.Individual
}
},
Card = new Card
{
AccountHolder = new AccountHolder
{
FirstName = "John",
LastName = "Jones",
Type = AccountHolderType.Individual
}
},
Googlepay = new Googlepay
{
AccountHolder = new AccountHolder
{
FirstName = "John",
LastName = "Jones",
Type = AccountHolderType.Individual
}
}
}
};
Expand Down Expand Up @@ -77,7 +160,8 @@ private async Task ShouldCreateAndGetPaymentLink()
responseGet.Links.Count.ShouldBe(2);
responseGet.Reference.ShouldNotBeNull();
responseGet.Metadata.ShouldNotBeNull();
responseGet.Metadata.Count.ShouldBe(0);
responseGet.Metadata.Count.ShouldBe(3);
responseGet.Locale.ShouldBe(LocaleType.EnGb);
}
}
}
2 changes: 1 addition & 1 deletion test/CheckoutSdkTest/Payments/PayoutsIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private async Task ShouldMakeCardPayoutPayments()
DateOfBirth = "1939-05-05",
SourceOfFunds = SourceOfFunds.Credit,
},
Instruction = new PaymentInstruction
Instruction = new Request.PaymentInstruction
{
Purpose = "pension", FundsTransferType = "C07", Mvv = "0123456789"
},
Expand Down
Loading
Loading