Skip to content

Commit 0a2de70

Browse files
Updated key concepts to async
1 parent 71a9452 commit 0a2de70

19 files changed

+155
-165
lines changed

15/umbraco-commerce/SUMMARY.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
* [Umbraco Commerce Documentation](README.md)
44
* [Release Notes](release-notes/README.md)
5-
* [v14.0.0](release-notes/v14.0.0.md)
6-
* [v14.0.0-Alpha](release-notes/v14.0.0-alpha.md)
5+
* [v15.0.0-Rc](release-notes/v15.0.0-rc.md)
76

87
## Commerce Products
98

@@ -15,23 +14,92 @@
1514

1615
* [Requirements](getting-started/requirements.md)
1716
* [Installation](getting-started/install.md)
17+
* [Licensing](getting-started/the-licensing-model.md)
18+
* [Configuration](getting-started/umbraco-configuration.md)
19+
* [User Interface](getting-started/user-interface.md)
1820

1921
## Upgrading
2022

2123
* [Upgrading Umbraco Commerce](upgrading/upgrade.md)
2224
* [Version Specific Upgrade Notes](upgrading/version-specific-upgrades.md)
25+
* [Migrate from Vendr to Umbraco Commerce](upgrading/migrate-from-vendr-to-umbraco-commerce/README.md)
26+
* [Migrate Umbraco Commerce Checkout](upgrading/migrate-from-vendr-to-umbraco-commerce/migrate-umbraco-commerce-checkout.md)
27+
* [Migrate custom Payment Providers](upgrading/migrate-from-vendr-to-umbraco-commerce/migrate-custom-payment-providers.md)
2328

2429
## How-To Guides
2530

2631
* [Overview](how-to-guides/overview.md)
32+
* [Configure SQLite support](how-to-guides/configure-sqlite-support.md)
33+
* [Limit Order Line Quantity](how-to-guides/limit-orderline-quantity.md)
34+
* [Use an Alternative Database for Umbraco Commerce Tables](how-to-guides/use-an-alternative-database-for-umbraco-commerce-tables.md)
2735

2836
## Key Concepts
2937

3038
* [Get to know the main features](key-concepts/overview.md)
39+
* [Base Currency](key-concepts/base-currency.md)
40+
* [Calculators](key-concepts/calculators.md)
41+
* [Currency Exchange Rate Service Provider](key-concepts/currency-exchange-rate-service-providers.md)
42+
* [Dependency Injection](key-concepts/dependency-injection.md)
43+
* [Discount Rules / Rewards](key-concepts/discount-rules-and-rewards.md)
44+
* [Events](key-concepts/events/README.md)
45+
* [List of validation events](key-concepts/events/list-of-validation-events.md)
46+
* [List of notification events](key-concepts/events/list-of-notification-events.md)
47+
* [Fluent API](key-concepts/fluent-api.md)
48+
* [Order Calculation State](key-concepts/order-calculation-state.md)
49+
* [Payment Forms](key-concepts/payment-forms.md)
50+
* [Payment Providers](key-concepts/payment-providers.md)
51+
* [Pipelines](key-concepts/pipelines.md)
52+
* [Price/Amount Adjustments](key-concepts/price-amount-adjustments.md)
53+
* [Price Freezing](key-concepts/price-freezing.md)
54+
* [Product Adapters](key-concepts/product-adapters.md)
55+
* [Product Bundles](key-concepts/product-bundles.md)
56+
* [Product Variants](key-concepts/product-variants/README.md)
57+
* [Complex Variants](key-concepts/product-variants/complex-variants.md)
58+
* [Properties](key-concepts/properties.md)
59+
* [ReadOnly and Writable Entities](key-concepts/readonly-and-writable-entities.md)
60+
* [Sales Tax Providers](key-concepts/sales-tax-providers.md)
61+
* [Search Specifications](key-concepts/search-specifications.md)
62+
* [Settings Objects](key-concepts/settings-objects.md)
63+
* [Shipping Package Factories](key-concepts/shipping-package-factories.md)
64+
* [Shipping Providers](key-concepts/shipping-providers.md)
65+
* [Shipping Range/Rate Providers](key-concepts/shipping-range-and-rate-providers.md)
66+
* [Tax Sources](key-concepts/tax-sources.md)
67+
* [UI Extensions](key-concepts/ui-extensions/README.md)
68+
* [Analytics Widgets](key-concepts/ui-extensions/analytics-widgets.md)
69+
* [Entity Quick Actions](key-concepts/ui-extensions/entity-quick-actions.md)
70+
* [Order Properties](key-concepts/ui-extensions/order-properties.md)
71+
* [Order Collection Properties](key-concepts/ui-extensions/order-collection-properties.md)
72+
* [Order Line Properties](key-concepts/ui-extensions/order-line-properties.md)
73+
* [Store Menu Items](key-concepts/ui-extensions/store-menu-items.md)
74+
* [Umbraco Properties](key-concepts/umbraco-properties.md)
75+
* [Unit of Work](key-concepts/unit-of-work.md)
76+
* [Umbraco Commerce Builder](key-concepts/umbraco-commerce-builder.md)
77+
* [Webhooks](key-concepts/webhooks.md)
3178

3279
## Reference
3380

3481
* [Stores](reference/stores/README.md)
82+
* [Shipping](reference/shipping/README.md)
83+
* [Fixed Rate Shipping](reference/shipping/fixed-rate-shipping.md)
84+
* [Dynamic Rate Shipping](reference/shipping/dynamic-rate-shipping.md)
85+
* [Realtime Rate Shipping](reference/shipping/realtime-rate-shipping.md)
86+
* [Taxes](reference/taxes/README.md)
87+
* [Fixed Tax Rates](reference/taxes/fixed-tax-rates.md)
88+
* [Calculated Tax Rates](reference/taxes/calculated-tax-rates.md)
89+
* [Storefront API](reference/storefront-api/README.md)
90+
* [Endpoints](reference/storefront-api/endpoints/README.md)
91+
* [Order](reference/storefront-api/endpoints/order.md)
92+
* [Checkout](reference/storefront-api/endpoints/checkout.md)
93+
* [Product](reference/storefront-api/endpoints/product.md)
94+
* [Customer](reference/storefront-api/endpoints/customer.md)
95+
* [Store](reference/storefront-api/endpoints/store.md)
96+
* [Currency](reference/storefront-api/endpoints/currency.md)
97+
* [Country](reference/storefront-api/endpoints/country.md)
98+
* [Payment method](reference/storefront-api/endpoints/payment-method.md)
99+
* [Shipping method](reference/storefront-api/endpoints/shipping-method.md)
100+
* [Content](reference/storefront-api/endpoints/content.md)
101+
* [Management API](reference/management-api/README.md)
102+
* [Go behind the scenes](reference/go-behind-the-scenes.md)
35103

36104
## Tutorials
37105

15/umbraco-commerce/getting-started/requirements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: Getting Started with Umbraco Commerce.
66

77
In this article, you will find the key steps needed to get started with Umbraco Commerce.
88

9-
It is assumed that you have an Umbraco 14+ website configured and ready for the Umbraco Commerce installation.
9+
It is assumed that you have an Umbraco 15+ website configured and ready for the Umbraco Commerce installation.
1010

1111
{% hint style="info" %}
1212
For detailed instructions on installing the latest version of Umbraco, refer to the [Umbraco CMS documentation](https://docs.umbraco.com/umbraco-cms/fundamentals/setup/install).
@@ -16,7 +16,7 @@ For detailed instructions on installing the latest version of Umbraco, refer to
1616

1717
The minimum requirements for using Umbraco Commerce are:
1818

19-
* Umbraco CMS version 14+
19+
* Umbraco CMS version 15+
2020
* SQL Server 2015+ Database
2121
* **SQLite** is acceptable for testing but not recommended for live deployments. For more details, see the [Configuring SQLite support](../how-to-guides/configure-sqlite-support.md) article.
2222

15/umbraco-commerce/key-concepts/calculators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public class MyProductCalculator : ProductCalculator
2525
: base(taxService, storeService)
2626
{ }
2727

28-
public override TaxRate CalculateProductTaxRate(IProductSnapshot productSnapshot, TaxSource taxSource, TaxRate fallbackTaxRate)
28+
public override async Task<TaxRate> CalculateProductTaxRateAsync(IProductSnapshot productSnapshot, TaxSource taxSource, TaxRate fallbackTaxRate)
2929
{
3030
// Do custom tax rate calculation here
3131
}
3232

33-
public override Price CalculateProductPrice(IProductSnapshot productSnapshot, Guid currencyId, TaxRate taxRate)
33+
public override async Task<Price> CalculateProductPriceAsync(IProductSnapshot productSnapshot, Guid currencyId, TaxRate taxRate)
3434
{
3535
// Do custom price calculation here
3636
}

15/umbraco-commerce/key-concepts/discount-rules-and-rewards.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ An example of an Order Discount Rule Provider would look something like this:
2626
[DiscountRuleProvider("myCustomOrderRule")]
2727
public class MyCustomOrderRuleProvider : OrderDiscountRuleProviderBase<MyCustomOrderRuleProviderSettings>
2828
{
29-
public override DiscountRuleResult ValidateRule(DiscountRuleContext ctx, MyCustomOrderRuleProviderSettings settings)
29+
public override async Task<DiscountRuleResult> ValidateRuleAsync(DiscountRuleContext ctx, MyCustomOrderRuleProviderSettings settings)
3030
{
3131
if (/* Some custom logic */)
3232
return Fulfilled();
@@ -69,7 +69,7 @@ An example of an Order Line Discount Rule Provider would look something like thi
6969
[DiscountRuleProvider("myCustomOrderLineRule")]
7070
public class MyCustomOrderLineRuleProvider : OrderLineDiscountRuleProviderBase<MyCustomOrderLineRuleProviderSettings>
7171
{
72-
public override DiscountRuleResult ValidateRule(DiscountRuleContext ctx, MyCustomOrderLineRuleProviderSettings settings)
72+
public override async Task<DiscountRuleResult> ValidateRuleAsync(DiscountRuleContext ctx, MyCustomOrderLineRuleProviderSettings settings)
7373
{
7474
if (/* Some custom logic */)
7575
return Fulfilled(fulfilledOrderLines);
@@ -100,7 +100,7 @@ An example of a Discount Reward Provider would look something like this:
100100
[DiscountRewardProvider("myDiscountReward")]
101101
public class MyDiscountRewardProvider : DiscountRewardProviderBase<MyDiscountRewardProviderSettings>
102102
{
103-
public override DiscountRewardCalculation CalculateReward(DiscountRewardContext ctx, MyDiscountRewardProviderSettings settings)
103+
public override async Task<DiscountRewardCalculation> CalculateRewardAsync(DiscountRewardContext ctx, MyDiscountRewardProviderSettings settings)
104104
{
105105
var result = new DiscountRewardCalculation();
106106

15/umbraco-commerce/key-concepts/fluent-api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,38 @@ An added side effect of having [ReadOnly and Writable entities](readonly-and-wri
1111
You could perform a write operation as follows:
1212

1313
```csharp
14-
_uowProvider.Execute(uow =>
14+
await _uowProvider.ExecuteAsync(async (uow) =>
1515
{
1616
// Fetch the currency
17-
var currency = _currencyService.GetCurrency(currencyId);
17+
var currency = await _currencyService.GetCurrencyAsync(currencyId);
1818

1919
// Convert the currency into it's Writable form
20-
var writableCurrency = currency.AsWritable(uow);
20+
var writableCurrency = await currency.AsWritableAsync(uow);
2121

2222
// Perform the write operation
23-
writableCurrency.SetName("New Name");
23+
await writableCurrency.SetNameAsync("New Name");
2424

2525
// Persist the changes to the database
26-
_currencyService.SaveCurrency(currency);
26+
await _currencyService.SaveCurrencyAsync(currency);
2727

2828
// Close the transaction
29-
uow.Complete();
29+
await uow.CompleteAsync();
3030
});
3131

3232
```
3333

3434
This could be simplified further by defining these actions fluently, chaining all of the entity methods into a succinct command sequence as follows:
3535

3636
```csharp
37-
_uowProvider.Execute(uow =>
37+
await _uowProvider.ExecuteAsync(async (uow) =>
3838
{
39-
var currency = _currencyService.GetCurrency(currencyId)
40-
.AsWritable(uow)
41-
.SetName("New Name");
39+
var currency = await _currencyService.GetCurrencyAsync(currencyId)
40+
.AsWritableAsync(uow)
41+
.SetNameAsync("New Name");
4242

43-
_currencyService.SaveCurrency(currency);
43+
await _currencyService.SaveCurrencyAsync(currency);
4444

45-
uow.Complete();
45+
await uow.CompleteAsync();
4646
});
4747

4848
```

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ The Payment Capture workflow can be the hardest part of a Payment Provider. This
5252

5353
Generally, there are three methods within a Payment Provider that you may need to implement, and each one has a specific responsibility.
5454

55-
* **GenerateForm** - The `GenerateForm` method is responsible for generating an HTML form that will redirect the customer to the given payment gateway payment form. In this method you may need to communicate with the payment gateway in order to initialize a payment, letting the payment gateway know how much to capture. This often results in some kind of code or redirect URL being returned which will need to be embedded into the generated form. The generated form is then usually displayed on a checkout **Review** page, the last page before payment is captured and will have an implementer-defined **Continue to Payment** button to submit the form and redirect the customer to the gateway.
56-
* **ProcessCallback** - The `ProcessCallback` method is responsible for handling the response coming back from the payment gateway and processing whether the payment was successful or not. This can sometimes occur _synchronously_, if the payment gateway sends information back as part of the confirmation page redirect, or can occur _asynchronously_ if the payment gateway sends the information back via an out-of-band webhook request.
57-
* **GetOrderReference** - The `GetOrderReference` method is responsible for extracting an order reference number from a request when the payment gateway uses an asynchronous webhook to finalize an Order **and** it uses a global webhook URL strategy for all notifications rather than a notification URL per transaction. Where a webhook URL can be passed per transaction, then Umbraco Commerce provides you with a unique callback URL you can register with the gateway that already identifies the order reference as part of the URL parameters, making implementing this method unnecessary.
55+
* **GenerateFormAsync** - The `GenerateFormAsync` method is responsible for generating an HTML form that will redirect the customer to the given payment gateway payment form. In this method you may need to communicate with the payment gateway in order to initialize a payment, letting the payment gateway know how much to capture. This often results in some kind of code or redirect URL being returned which will need to be embedded into the generated form. The generated form is then usually displayed on a checkout **Review** page, the last page before payment is captured and will have an implementer-defined **Continue to Payment** button to submit the form and redirect the customer to the gateway.
56+
* **ProcessCallbackAsync** - The `ProcessCallbackAsync` method is responsible for handling the response coming back from the payment gateway and processing whether the payment was successful or not. This can sometimes occur _synchronously_, if the payment gateway sends information back as part of the confirmation page redirect, or can occur _asynchronously_ if the payment gateway sends the information back via an out-of-band webhook request.
57+
* **GetOrderReferenceAsync** - The `GetOrderReferenceAsync` method is responsible for extracting an order reference number from a request when the payment gateway uses an asynchronous webhook to finalize an Order **and** it uses a global webhook URL strategy for all notifications rather than a notification URL per transaction. Where a webhook URL can be passed per transaction, then Umbraco Commerce provides you with a unique callback URL you can register with the gateway that already identifies the order reference as part of the URL parameters, making implementing this method unnecessary.
5858

5959
_\* denotes a required method implementation_.
6060

@@ -70,10 +70,10 @@ These features are optional and not required for Payment Provider developers to
7070

7171
The implementable management methods are:
7272

73-
* **FetchPaymentStatus** - The `FetchPaymentStatus` method communicates with the 3rd party payment gateway in order to fetch the current status of the given transaction.
74-
* **CapturePayment** - The `CapturePayment` method communicates with the 3rd party payment gateway to capture a previously authorized payment associated with the given transaction.
75-
* **CancelPayment** - The `CancelPayment` method communicates with the 3rd party payment gateway to cancel a previously authorized payment associated with the given transaction.
76-
* **RefundPayment** - The `RefundPayment` method communicates with the 3rd party payment gateway to refund a previously captured payment associated with the given transaction.
73+
* **FetchPaymentStatusAsync** - The `FetchPaymentStatusAsync` method communicates with the 3rd party payment gateway in order to fetch the current status of the given transaction.
74+
* **CapturePaymentAsync** - The `CapturePaymentAsync` method communicates with the 3rd party payment gateway to capture a previously authorized payment associated with the given transaction.
75+
* **CancelPaymentAsync** - The `CancelPaymentAsync` method communicates with the 3rd party payment gateway to cancel a previously authorized payment associated with the given transaction.
76+
* **RefundPaymentAsync** - The `RefundPaymentAsync` method communicates with the 3rd party payment gateway to refund a previously captured payment associated with the given transaction.
7777

7878
For each implemented method above, developers should also implement a corresponding boolean property returning a `true` value. This is to let Umbraco Commerce know that the given feature is supported by the Payment Provider.
7979

15/umbraco-commerce/key-concepts/pipelines.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ An example of a Pipeline task would look something like this:
2222
```csharp
2323
public class AddCustomAttachmentTask : PipelineTaskWithTypedArgsBase<EmailSendPipelineArgs, EmailContext>
2424
{
25-
public override PipelineResult<EmailContext> Execute(EmailSendPipelineArgs args)
25+
public override Task<PipelineResult<EmailContext>> ExecuteAsync(EmailSendPipelineArgs args)
2626
{
2727
var attachment = new Attachment(File.OpenRead("path\to\license.lic"), "license.lic");
2828

@@ -33,7 +33,7 @@ public class AddCustomAttachmentTask : PipelineTaskWithTypedArgsBase<EmailSendPi
3333
}
3434
```
3535

36-
All Pipeline tasks inherit from a base class `PipelineTaskWithTypedArgsBase<TPipelineArgs, TModel>`. `TPipelineArgs` is the type of arguments supported by the pipeline and `TModel` is the pipeline's return model Type. You then need to implement an `Execute` method that accepts an instance of the argument's type as input and expects a `PipelineResult<TModel>` as its output. Inside this method, you can perform your custom logic as required. To complete the pipeline task, you can call `Ok(TModel)` if the task was successful. This will pass in the updated `TModel` instance to returnæ. Otherwise, you can call `Fail()` to fail the whole pipeline.
36+
All Pipeline tasks inherit from a base class `PipelineTaskWithTypedArgsBase<TPipelineArgs, TModel>`. `TPipelineArgs` is the type of arguments supported by the pipeline and `TModel` is the pipeline's return model Type. You then need to implement an `ExecuteAsync` method that accepts an instance of the argument's type as input and expects a `Task<PipelineResult<TModel>>` as its output. Inside this method, you can perform your custom logic as required. To complete the pipeline task, you can call `Ok(TModel)` if the task was successful. This will pass in the updated `TModel` instance to returnæ. Otherwise, you can call `Fail()` to fail the whole pipeline.
3737

3838
All pipelines occur within a [Unit of Work](unit-of-work.md). In case a Pipeline task fails, the whole pipeline will fail and no changes will persist.
3939

15/umbraco-commerce/key-concepts/price-amount-adjustments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Adjustments are applied using a `IPriceAdjuster` or `IAmountAdjuster` with devel
1818
```csharp
1919
public class MyPriceAdjuster : PriceAdjusterBase
2020
{
21-
public override void ApplyPriceAdjustments(PriceAdjusterArgs args)
21+
public override async Task ApplyPriceAdjustmentsAsync(PriceAdjusterArgs args)
2222
{
2323
// Calculate Adjustment
2424
// Discount adjustments should be negative

15/umbraco-commerce/key-concepts/price-freezing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ A product's price is frozen from the point it is added to the current Order, and
1212

1313
There are times when you may wish to control when a frozen price should expire. This could be if a product was incorrectly priced, or if you have rules on how long an Order-session is allowed to maintain price.
1414

15-
On these occasions, you can force frozen prices to expire by using the `IPriceFreezerService` and its `ThawPrices` method.
15+
On these occasions, you can force frozen prices to expire by using the `IPriceFreezerService` and its `ThawPricesAsync` method.
1616

1717
All frozen prices have an `OrderId` property and a `Key` that uniquely identifies them. For product prices, this key consists of a generated token of the following format `{StoreId}_{OrderId}_{ProductReference}`. In addition, the product prices Currency, and date of the freeze are also tracked. It is important to know these details as we can use all of these attributes to target which prices we wish to thaw.
1818

1919
For example, to thaw all prices for a product with the reference `c0296b75-1764-4f62-b59c-7005c2348fdd` we could call:
2020

2121
```csharp
22-
_priceFreezerService.ThawPrices(partialKey: "c0296b75-1764-4f62-b59c-7005c2348fdd");
22+
await _priceFreezerService.ThawPricesAsync(partialKey: "c0296b75-1764-4f62-b59c-7005c2348fdd");
2323
```
2424

2525
Or to thaw all prices for a given Currency that are greater than 30 days old we could call:
2626

2727
```csharp
28-
_priceFreezerService.ThawPrices(currencyId: currency.Id, olderThan: DateTime.Now.AddDays(-30));
28+
await _priceFreezerService.ThawPricesAsync(currencyId: currency.Id, olderThan: DateTime.Now.AddDays(-30));
2929
```

0 commit comments

Comments
 (0)