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

Prefill customer information and related #19

Merged
merged 1 commit into from
Nov 4, 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
16 changes: 10 additions & 6 deletions src/DibsEasyCheckout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@
[AddInParameter("Support B2B"), AddInParameterEditor(typeof(YesNoParameterEditor), "infoText=Enables a \"Business checkout\" radio button in the DIBS easy payment window.;")]
public bool SupportB2b { get; set; }

[AddInParameter("Set B2B as default"), AddInParameterEditor(typeof(YesNoParameterEditor), "infoText=If \"Support B2B\" is enabled and \"Set B2B as default\" then B2B fields are rendered by default in the DIBS easy payment window. The added B2B address fields vary from country to country.;")]
[AddInParameter("Set B2B as default"), AddInParameterEditor(typeof(YesNoParameterEditor), "infoText=If \"Support B2B\" is enabled and \"Set B2B as default\" then B2B fields are rendered by default in the DIBS easy payment window. The added B2B address fields vary from country to country.")]
public bool SetB2bAsDefault { get; set; }

[AddInParameter("Enable billing address"), AddInParameterEditor(typeof(YesNoParameterEditor), "infoText=If set to true, the Dibs checkout form provides the option to specify separate billing and shipping addresses. If set to false, the billing address is used as the shipping address.")]
public bool EnableBillingAddress { get; set; }

[AddInParameter("Test mode"), AddInParameterEditor(typeof(YesNoParameterEditor), "infoText=When enabled, the test credentials are used instead of the live credentials.;")]
public bool TestMode { get; set; } = true;

Expand Down Expand Up @@ -635,7 +638,7 @@
return string.Empty;
}

private OutputResult RenderPaymentForm(Order order, Template formTemplate, bool headless = false, string? receiptUrl = null)

Check warning on line 641 in src/DibsEasyCheckout.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 641 in src/DibsEasyCheckout.cs

View workflow job for this annotation

GitHub Actions / call-workflow / Build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
try
{
Expand All @@ -645,14 +648,15 @@
var service = new DibsService(order, GetSecretKey(), GetApiUrl());
var newPayment = service.CreatePayment(new()
{
BaseUrl = baseUrl,
WindowMode = windowMode,
SupportB2b = SupportB2b,
SetB2bAsDefault = SetB2bAsDefault,
PrefillCustomerAddress = PrefillCustomerAddress,
EnableBillingAddress = EnableBillingAddress,
ReceiptUrl = receiptUrl,
ApprovetUrl = approvetUrl,
SetB2bAsDefault = SetB2bAsDefault,
SupportB2b = SupportB2b,
TermsPage = TermsPage,
WindowMode = windowMode
BaseUrl = baseUrl,
TermsPage = TermsPage
});

LogEvent(order, "Payment created.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<VersionPrefix>10.6.3</VersionPrefix>
<VersionPrefix>10.6.4</VersionPrefix>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Title>Nets Easy Checkout</Title>
<Description>Nets Easy Checkout</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePaymentRequest;

[DataContract]
internal sealed class ShippingAddress
internal sealed class Address
{
[DataMember(Name = "addressLine1")]
[DataMember(Name = "addressLine1", EmitDefaultValue = false)]
public string AddressLine1 { get; set; }

[DataMember(Name = "addressLine2")]
[DataMember(Name = "addressLine2", EmitDefaultValue = false)]
public string AddressLine2 { get; set; }

[DataMember(Name = "postalCode")]
[DataMember(Name = "postalCode", EmitDefaultValue = false)]
public string PostalCode { get; set; }

[DataMember(Name = "city")]
[DataMember(Name = "city", EmitDefaultValue = false)]
public string City { get; set; }

[DataMember(Name = "country")]
[DataMember(Name = "country", EmitDefaultValue = false)]
public string Country { get; set; }
}
2 changes: 1 addition & 1 deletion src/Models/CreatePaymentRequest/Consumer/Company.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePa
[DataContract]
internal sealed class Company
{
[DataMember(Name = "name")]
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }

[DataMember(Name = "contact", EmitDefaultValue = false)]
Expand Down
11 changes: 7 additions & 4 deletions src/Models/CreatePaymentRequest/Consumer/Consumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePa
[DataContract]
internal sealed class Consumer
{
[DataMember(Name = "email")]
[DataMember(Name = "email", EmitDefaultValue = false)]
public string Email { get; set; }

[DataMember(Name = "shippingAddress")]
public ShippingAddress ShippingAddress { get; set; }
[DataMember(Name = "shippingAddress", EmitDefaultValue = false)]
public Address ShippingAddress { get; set; }

[DataMember(Name = "billingAddress", EmitDefaultValue = false)]
public Address BillingAddress { get; set; }

[DataMember(Name = "privatePerson", EmitDefaultValue = false)]
public Contact PrivatePerson { get; set; }

[DataMember(Name = "company")]
[DataMember(Name = "company", EmitDefaultValue = false)]
public Company Company { get; set; }
}
4 changes: 2 additions & 2 deletions src/Models/CreatePaymentRequest/ConsumerType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePa
[DataContract]
internal sealed class ConsumerType
{
[DataMember(Name = "default")]
[DataMember(Name = "default", EmitDefaultValue = false)]
public string Default { get; set; }

[DataMember(Name = "supportedTypes")]
[DataMember(Name = "supportedTypes", EmitDefaultValue = false)]
public IEnumerable<string> SupportedTypes { get; set; }
}
4 changes: 2 additions & 2 deletions src/Models/CreatePaymentRequest/LineItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ internal sealed class LineItem
[DataMember(Name = "unit")]
public string Unit { get; set; }

[DataMember(Name = "taxRate")]
[DataMember(Name = "taxRate", EmitDefaultValue = false)]
public long TaxRate { get; set; }

[DataMember(Name = "taxAmount")]
[DataMember(Name = "taxAmount", EmitDefaultValue = false)]
public long TaxAmount { get; set; }

[DataMember(Name = "grossTotalAmount")]
Expand Down
2 changes: 1 addition & 1 deletion src/Models/CreatePaymentRequest/Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePa
[DataContract]
internal sealed class Notifications
{
[DataMember(Name = "webhooks")]
[DataMember(Name = "webhooks", EmitDefaultValue = false)]
public IEnumerable<Webhook> Webhooks { get; set; }
}
15 changes: 9 additions & 6 deletions src/Models/CreatePaymentRequest/PaymentCheckout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePa
[DataContract]
internal sealed class PaymentCheckout
{
[DataMember(Name = "url")]
[DataMember(Name = "url", EmitDefaultValue = false)]
public string Url { get; set; }

[DataMember(Name = "returnUrl")]
[DataMember(Name = "returnUrl", EmitDefaultValue = false)]
public string ReturnUrl { get; set; }

[DataMember(Name = "termsUrl")]
frederik5480 marked this conversation as resolved.
Show resolved Hide resolved
public string TermsUrl { get; set; }

[DataMember(Name = "integrationType")]
[DataMember(Name = "integrationType", EmitDefaultValue = false)]
public string IntegrationType { get; set; }

[DataMember(Name = "merchantHandlesConsumerData")]
[DataMember(Name = "merchantHandlesConsumerData", EmitDefaultValue = false)]
public bool MerchantHandlesConsumerData { get; set; }

[DataMember(Name = "consumerType")]
[DataMember(Name = "consumerType", EmitDefaultValue = false)]
public ConsumerType ConsumerType { get; set; }

[DataMember(Name = "consumer")]
[DataMember(Name = "consumer", EmitDefaultValue = false)]
public Consumer Consumer { get; set; }

[DataMember(Name = "shipping", EmitDefaultValue = false)]
public Shipping Shipping { get; set; }
}
2 changes: 1 addition & 1 deletion src/Models/CreatePaymentRequest/PaymentOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ internal sealed class PaymentOrder
[DataMember(Name = "currency")]
public string Currency { get; set; }

[DataMember(Name = "reference")]
[DataMember(Name = "reference", EmitDefaultValue = false)]
public string Reference { get; set; }
}
2 changes: 1 addition & 1 deletion src/Models/CreatePaymentRequest/PaymentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ internal sealed class PaymentRequest
[DataMember(Name = "checkout")]
public PaymentCheckout Checkout { get; set; }

[DataMember(Name = "notifications")]
[DataMember(Name = "notifications", EmitDefaultValue = false)]
public Notifications Notifications { get; set; }
}
10 changes: 10 additions & 0 deletions src/Models/CreatePaymentRequest/Shipping.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Runtime.Serialization;

namespace Dynamicweb.Ecommerce.CheckoutHandlers.DibsEasyCheckout.Models.CreatePaymentRequest;

[DataContract]
internal sealed class Shipping
{
[DataMember(Name = "enableBillingAddress", EmitDefaultValue = false)]
public bool EnableBillingAddress { get; set; }
}
2 changes: 1 addition & 1 deletion src/Models/CreatePaymentRequest/Webhook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ internal sealed class Webhook
[DataMember(Name = "url")]
public string Url { get; set; }

[DataMember(Name = "authorization")]
[DataMember(Name = "authorization", EmitDefaultValue = false)]
public string Authorization { get; set; }
}
2 changes: 2 additions & 0 deletions src/Service/CreatePaymentParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ internal sealed class CreatePaymentParameters

public bool PrefillCustomerAddress { get; set; }

public bool EnableBillingAddress { get; set; }

public string ReceiptUrl { get; set; }

public string ApprovetUrl { get; set; }
Expand Down
Loading
Loading