Knowledge BaseCustom Payment Module Example: DocData

Custom Payment Module Example: DocData

Adding Custom Steps to the Pipeline

We can add the custom steps we made to the pipeline by overriding the correct 'BuildPipeline' method and creating a new pipeline containing the new steps. In the case of DocData we want the preprocess pipeline to have two steps: 'DocDataGetCustomerStep.cs' and 'DocDataCreateClusterStep.cs'. In order to accomplish that we add the following code to our DocData Payment module:
protected override IPaymentPipeline BuildPreProcessPipeline()
{
  var preProcessSteps = new IPaymentStep[]
  {    
     new SaveOrderStep(),
     new DocDataGetCustomerStep(),
     new DocDataCreateClusterStep(),    
     new SaveOrderStep()
  };
  return new PaymentPreProcessPipeline("PreProcessPipeline",
  preProcessSteps);
}
  
This code will overwrite the default pipeline with a pipeline containing the previous two steps. We also update the other pipelines like:
protected override IPaymentPipeline BuildConfirmPipeline()
{
  var confirmSteps = new IPaymentStep[]
  {    
    new DocDataGetClusterStatusStep() 
  };
  return new PaymentConfirmPipeline("ConfirmPipeline", confirmSteps);
}
protected override IPaymentPipeline BuildPostProcessPipeline()
{
 var postProcessSteps = new IPaymentStep[]
 {
   new DeleteBasketStep(),
   new DocDataConfirmationDebug()    
 };
 return new PaymentPipeline("PostProcessPipeline", postProcessSteps);
}
protected override IPaymentPipeline BuildCancelPipeline()
{
  var CancelSteps = new IPaymentStep[]
  {    
     new DocDataConfirmationDebug(),
     new SaveOrderStep()
  };
  return new PaymentPipeline("CancelPipeline", CancelSteps);
}
The preprocess steps will now correct get customer information and create a cluster. The 'cluster' is stored in the order configuration and passed to DocData. For confirmation we now get the status XML from DocData. Finally we have added some steps that allow us to debug DocData in a development environment. In the end we will have the add the additional steps to DocData like the image below:
 
 
Knowledge BaseCustom Payment Module Example: DocData