Skip to content

Commit 69478bd

Browse files
committed
add docs about payment/shipping provider settings validation
1 parent a43d1ad commit 69478bd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

16/umbraco-commerce/key-concepts/payment-providers.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,28 @@ public class MyPaymentProviderSettings
3535

3636
All Payment Providers inherit from a base class `AsyncPaymentProviderBase<TSettings>`. `TSettings` is the type of a Plain Old Class Object (POCO) model class representing the Payment Provider's settings. The class must be decorated with `PaymentProviderAttribute` which defines the Payment Providers `alias`.
3737

38+
### Payment Provider Settings
3839
The settings class consists of a series of properties, each decorated with a `PaymentProviderSettingAttribute`. These will all be used to dynamically build an editor interface for the given settings in the backoffice.
3940

4041
Labels and descriptions for providers and their settings are controlled through [Localization](#localization) entries.
4142

43+
{% hint style="info" %}
44+
The **Validate Payment Provider Settings** feature has been available since Umbraco Commerce 16.4.0.
45+
{% endhint %}
46+
47+
Umbraco Commerce supports validating payment provider settings by using `System.ComponentModel.DataAnnotations.ValidationAttribute`.
48+
49+
```csharp
50+
public class MyPaymentProviderSettings
51+
{
52+
[System.ComponentModel.DataAnnotations.Required] // Validation Attribute
53+
[System.ComponentModel.DataAnnotations.StringLength(100)] // Validation Attribute
54+
[PaymentProviderSetting(SortOrder = 100)]
55+
public string ContinueUrl { get; set; }
56+
...
57+
}
58+
```
59+
4260
## Payment Provider Responsibilities
4361

4462
There are two main responsibilities of a Payment Provider, and those are:

16/umbraco-commerce/key-concepts/shipping-providers.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,27 @@ public class MyShippingProviderSettings
3535

3636
All Shipping Providers inherit from a base class `ShippingProviderBase<TSettings>`. `TSettings` is the type of a Plain Old Class Object (POCO) model class representing the Shipping Provider's settings. The class must be decorated with `ShippingProviderAttribute` which defines the Shipping Providers `alias`.
3737

38+
### Shipping Provider Settings
3839
The settings class consists of a series of properties, each decorated with a `ShippingProviderSettingAttribute`. These will all be used to dynamically build an editor interface for the given settings in the backoffice.
3940

4041
Labels and descriptions for providers and their settings are controlled through [Localization](#localization) entries.
4142

43+
{% hint style="info" %}
44+
The **Validate Shipping Provider Settings** feature has been available since Umbraco Commerce 16.4.0.
45+
{% endhint %}
46+
47+
Umbraco Commerce supports validating shipping provider settings by using `System.ComponentModel.DataAnnotations.ValidationAttribute`.
48+
49+
```csharp
50+
public class MyShippingProviderSettings
51+
{
52+
[System.ComponentModel.DataAnnotations.Required] // Validation Attribute
53+
[System.ComponentModel.DataAnnotations.StringLength(100)] // Validation Attribute
54+
[ShippingProviderSetting(SortOrder = 100)]
55+
public string ContinueUrl { get; set; }
56+
...
57+
}
58+
```
4259
## Shipping Provider Responsibilities
4360

4461
The responsibilities of a Shipping Provider are:

0 commit comments

Comments
 (0)