Skip to content

Commit fc370e4

Browse files
Update Payment Links and tests (#454)
- Update Payment Links with latests changes - Refactor names - Fix name properties - Update tests
1 parent f7734f5 commit fc370e4

14 files changed

+161
-74
lines changed

src/CheckoutSdk/Payments/Hosted/HostedPaymentInstruction.cs

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/CheckoutSdk/Payments/Hosted/HostedPaymentRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ public class HostedPaymentRequest
6060

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

63-
public Locale Locale { get; set; }
63+
public LocaleType? Locale { get; set; }
6464

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

67-
public bool Capture { get; set; }
67+
public bool? Capture { get; set; }
6868

6969
public DateTime? CaptureOn { get; set; }
7070

71-
public HostedPaymentInstruction Instruction { get; set; }
71+
public PaymentInstruction Instruction { get; set; }
7272

7373
public PaymentMethodConfiguration PaymentMethodConfiguration { get; set; }
7474

src/CheckoutSdk/Payments/Links/PaymentLinkDetailsResponse.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,37 @@ public class PaymentLinkDetailsResponse : Resource
99
public string Id { get; set; }
1010

1111
public PaymentLinkStatus? Status { get; set; }
12-
13-
public string PaymentId { get; set; }
14-
12+
1513
public long? Amount { get; set; }
1614

1715
public Currency? Currency { get; set; }
16+
17+
public DateTime? ExpiresOn { get; set; }
18+
19+
public DateTime? CreatedOn { get; set; }
20+
21+
public BillingInformation Billing { get; set; }
22+
23+
public string PaymentId { get; set; }
1824

1925
public string Reference { get; set; }
2026

2127
public string Description { get; set; }
22-
23-
public DateTime? CreatedOn { get; set; }
24-
25-
public DateTime? ExpiresOn { get; set; }
26-
28+
29+
public string ProcessingChannelId { get; set; }
30+
31+
public IList<AmountAllocations> AmountAllocations { get; set; }
32+
2733
public CustomerResponse Customer { get; set; }
2834

2935
public ShippingDetails Shipping { get; set; }
3036

31-
public BillingInformation Billing { get; set; }
32-
3337
public IList<Product> Products { get; set; }
3438

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

37-
public string ReturnUrl { get; set; }
38-
39-
public string Locale { get; set; }
40-
41-
//Not available on Previous
42-
43-
public string ProcessingChannelId { get; set; }
41+
public LocaleType? Locale { get; set; }
4442

45-
public IList<AmountAllocations> AmountAllocations { get; set; }
43+
public string ReturnUrl { get; set; }
4644
}
4745
}

src/CheckoutSdk/Payments/Links/PaymentLinkRequest.cs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,38 @@ public class PaymentLinkRequest
1313
public long? Amount { get; set; }
1414

1515
public Currency? Currency { get; set; }
16+
17+
public BillingInformation Billing { get; set; }
18+
19+
public PaymentType? PaymentType { get; set; }
20+
21+
public string PaymentIp { get; set; }
22+
23+
public BillingDescriptor BillingDescriptor { get; set; }
1624

1725
public string Reference { get; set; }
1826

1927
public string Description { get; set; }
28+
29+
public string DisplayName { get; set; }
30+
31+
public string ProcessingChannelId { get; set; }
32+
33+
public IList<AmountAllocations> AmountAllocations { get; set; }
2034

2135
public int? ExpiresIn { get; set; }
2236

2337
public CustomerRequest Customer { get; set; }
2438

2539
public ShippingDetails Shipping { get; set; }
2640

27-
public BillingInformation Billing { get; set; }
28-
2941
public PaymentRecipient Recipient { get; set; }
3042

3143
public ProcessingSettings Processing { get; set; }
44+
45+
public IList<PaymentSourceType> AllowPaymentMethods { get; set; }
46+
47+
public IList<PaymentSourceType> DisabledPaymentMethods { get; set; }
3248

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

@@ -44,28 +60,14 @@ public class PaymentLinkRequest
4460

4561
public string ReturnUrl { get; set; }
4662

47-
public string Locale { get; set; }
63+
public LocaleType Locale { get; set; }
4864

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

5167
public DateTime? CaptureOn { get; set; }
52-
53-
public PaymentType? PaymentType { get; set; }
54-
55-
public string PaymentIp { get; set; }
56-
57-
public BillingDescriptor BillingDescriptor { get; set; }
58-
59-
public IList<PaymentSourceType> AllowPaymentMethods { get; set; }
6068

61-
public IList<PaymentSourceType> DisabledPaymentMethods { get; set; }
69+
public PaymentInstruction Instruction { get; set; }
6270

63-
//Not available on Previous
64-
65-
public string ProcessingChannelId { get; set; }
66-
67-
public IList<AmountAllocations> AmountAllocations { get; set; }
68-
69-
public string DisplayName { get; set; }
71+
public PaymentMethodConfiguration PaymentMethodConfiguration { get; set; }
7072
}
7173
}

src/CheckoutSdk/Payments/Locale.cs renamed to src/CheckoutSdk/Payments/LocaleType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Checkout.Payments
44
{
5-
public enum Locale
5+
public enum LocaleType
66
{
77
[EnumMember(Value = "ar")]
88
Ar,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Checkout.Payments.Hosted;
2+
3+
namespace Checkout.Payments
4+
{
5+
public class PaymentInstruction
6+
{
7+
public PaymentPurposeType Purpose { get; set; }
8+
}
9+
}

src/CheckoutSdk/Payments/Response/GetPaymentResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public class GetPaymentResponse : Resource
8989

9090
public bool? CkoNetworkTokenAvailable { get; set; }
9191

92-
public PaymentInstruction Instruction { get; set; }
92+
public Request.PaymentInstruction Instruction { get; set; }
9393

9494

9595
}

src/CheckoutSdk/Payments/Sender/PaymentIndividualSender.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Checkout.Common;
2+
using Newtonsoft.Json;
23

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

1920
public Address Address { get; set; }
2021

21-
public AccountHolderIdentification AccountHolderIdentification { get; set; }
22+
[JsonProperty(PropertyName = "identification")] public AccountHolderIdentification AccountHolderIdentification { get; set; }
2223

2324
public string ReferenceType { get; set; }
2425

test/CheckoutSdkTest/Payments/Hosted/HostedPaymentsClientTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static HostedPaymentRequest CreateHostedPaymentRequest(string reference)
119119
SuccessUrl = "https://example.com/payments/success",
120120
CancelUrl = "https://example.com/payments/success",
121121
FailureUrl = "https://example.com/payments/success",
122-
Locale = Locale.EnGb,
122+
Locale = LocaleType.EnGb,
123123
ThreeDs = new ThreeDsRequest {Enabled = false, AttemptN3D = false},
124124
Capture = true,
125125
CaptureOn = DateTime.UtcNow

test/CheckoutSdkTest/Payments/Hosted/HostedPaymentsIntegrationTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected static HostedPaymentRequest CreateHostedPaymentRequest()
145145
SuccessUrl = "https://example.com/payments/success",
146146
CancelUrl = "https://example.com/payments/cancel",
147147
FailureUrl = "https://example.com/payments/failure",
148-
Locale = Locale.Ar,
148+
Locale = LocaleType.Ar,
149149
ThreeDs = new ThreeDsRequest
150150
{
151151
Enabled = false,
@@ -156,7 +156,7 @@ protected static HostedPaymentRequest CreateHostedPaymentRequest()
156156
},
157157
Capture = true,
158158
CaptureOn = DateTime.UtcNow,
159-
Instruction = new HostedPaymentInstruction
159+
Instruction = new PaymentInstruction
160160
{
161161
Purpose = PaymentPurposeType.Donations
162162
},

0 commit comments

Comments
 (0)