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 DocDataGetCustomerStep(),
     new DocDataCreateClusterStep(),     
  };
  return new PaymentPreProcessPipeline("PreProcessPipeline",
  preProcessSteps, true);
}
 
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, true);
}
 
protected override IPaymentPipeline BuildPostProcessPipeline()
{
 var postProcessSteps = new IPaymentStep[]
 {
   new DeleteBasketStep(),
   new DocDataConfirmationDebug()     
 };
 return new PaymentPipeline("PostProcessPipeline", postProcessSteps, true);
}
 
protected override IPaymentPipeline BuildCancelPipeline()
{
  var CancelSteps = new IPaymentStep[]
  {     
     new DocDataConfirmationDebug(),
  };
  return new PaymentPipeline("CancelPipeline", CancelSteps, true);
}
 
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