Last active
February 17, 2019 14:22
-
-
Save mattbrailsford/a4874d6308b54e4626d40a1ecbfca380 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyNamespace | |
{ | |
[ComposeAfter(typeof(TeaCommerceComposer))] | |
public class MyComposer : IUserComposer | |
{ | |
public void Compose(Composition composition) | |
{ | |
composition.WithOrderCheckoutPipeline() | |
.InsertBefore<CalculateShippingTask, MyPipelineTask>() | |
.Append<MyOtherPipelineTask>(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyNamespace | |
{ | |
public class MyPipelineTask : PipelineTaskBase<Order> | |
{ | |
public override PipelineResult<Order> Execute(PipelineContext<Order> context) | |
{ | |
// Modify the order object or perform some logic. | |
context.Data.StringProp = "New Value"; | |
return Ok(); | |
} | |
} | |
public class MyOtherPipelineTask : PipelineTaskBase<Order> | |
{ | |
public override PipelineResult<Order> Execute(PipelineContext<Order> context) | |
{ | |
// Modify the order object or perform some logic. | |
if (context.Data.BoolProp) { | |
return Fail(new PipelineException("Something went wrong")); | |
} else { | |
return Ok(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment