Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Zac 223 posts 575 karma points
    Apr 04, 2011 @ 14:35
    Zac
    0

    Problem with custom pipeline task

    Hey,

    I have the following class in my App_Code:

    namespace MyShopName.Pipelines
    {

    public class NotifyWarehouse : IPipelineTask<PurchaseOrder>
    {

    #region IPipelineTask<T> Members

    public PipelineExecutionResult Execute(PurchaseOrder order)
    { //connect with 3rd party warehouse here
    //throw new Exception("hello world");
    return 0; //success code?
    }

    #endregion

    }
    }

    This is where I hope to connect with the 3rd party warehousing that we are using, to notify them that the order has been taken. I have modified the Checkout.config to look like this:

    <array>
    <value>${Checkout.AssignOrderNumber}</value>
    <value>${Checkout.CreateCustomer}</value>
    <value>${Checkout.CreateMemberForCustomer}</value>
    <value>${Checkout.ConvertBasketToPurchaseOrder}</value>
    <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>
    <value>${Checkout.ClearBasketInformation}</value>
    <value>${Checkout.SavePurchaseOrder}</value>
    <value>${Checkout.NotifyWarehouse}</value>
    <value>${Checkout.SendConfirmationEmail}</value>
    </array>

    ...

    <component id="Checkout.SendWarehouseXml"
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
    type="MyShopName.Pipelines.NotifyWarehouse, MyShopName.Pipelines"
    lifestyle="Thread" />

    I've set up my SagePay method to use the Checkout pipeline. I don't really quite understand this bit, or whether that's correct, but that's what I've done:

    When I run though the sagepay simulator, sagepay get's this response back from the payment processor:

    [HandlerException: Can't create component 'Checkout' as it has dependencies to be 
    satisfied.

    Checkout is waiting for the following dependencies:



    Keys (components with specific keys)

    - Checkout.NotifyWarehouse which was not registered.

    ]

    UCommerce.Transactions.Payments.PaymentProcessor.ProcessRequest(HttpContext context) +1323

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +597

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean completedSynchronously) +266

    Perhaps I need to register this pipeline somewhere?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 04, 2011 @ 14:52
    Søren Spelling Lund
    0

    Hi Zac,

    It's saying that it can't find your pipeline task. Most probably due to the location in app_code, which requires a different way of registering your code.

    Classes in app_code are compiled into a new assembly at runtime called: App_Code. Basically uCommerce is looking for your type in an assembly called MyShopName.Pipelines when in fact type is in the App_Code assembly.

    Try changing the reg to the following:

    <array>
       
    <value>${Checkout.AssignOrderNumber}</value>
       
    <value>${Checkout.CreateCustomer}</value>
       
    <value>${Checkout.CreateMemberForCustomer}</value>
       
    <value>${Checkout.ConvertBasketToPurchaseOrder}</value>
       
    <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>
       
    <value>${Checkout.ClearBasketInformation}</value>
       
    <value>${Checkout.SavePurchaseOrder}</value>
       
    <value>${Checkout.NotifyWarehouse}</value>
       
    <value>${Checkout.SendConfirmationEmail}</value>
    </array>

    ...

    <component id="Checkout.SendWarehouseXml"
         
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
         
    type="MyShopName.Pipelines.NotifyWarehouse, App_Code"
         
    lifestyle="Thread" />

    Hope this helps.

  • Zac 223 posts 575 karma points
    Apr 04, 2011 @ 16:04
    Zac
    0

    Thanks once again Søren

    I still seem to be getting the error. I've tried

    MyShopName.Pipelines.NotifyWarehouse, App_Code
    MyShopName.Pipelines.NotifyWarehouse, __Code
    MyShopName.Pipelines.NotifyWarehouse

    as per what I read here: http://blog.wouterdeboer.nl/archive/2007/03/26/31.aspx

    Any other ideas?

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 05, 2011 @ 08:15
    Søren Spelling Lund
    0

    You can always compile the class into a property assembly and put in /bin. That'll definitely work.

  • Zac 223 posts 575 karma points
    Apr 05, 2011 @ 14:18
    Zac
    0

    Thanks Søren - I did think of trying it as a seperate assembly. I did that and added it to the bin and referenced it correctly, but I still get the same error:

                 Exception Details: Castle.MicroKernel.Handlers.HandlerException: Can't 
    create component 'Checkout' as it has dependencies to be satisfied.
    Checkout is waiting for the
    following dependencies:

    Keys (components with specific keys)
    - Checkout.NotifyWarehouse
    which was not registered.

    I've double checked that I'm using the correct syntax for the type in the pipeline task section

    do you have any other idea why this may be happening?

    Thanks

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 05, 2011 @ 14:22
    Søren Spelling Lund
    0

    Hi Zac,

    I completely missed the obvious: The ids don't match. In the values an id called Checkout.NotifyWarehouse is used, but the component is registered with name Checkout.SendWarehouseXml. Change one or the other and you should be fine.

    Sorry I didn't catch that earlier.

    <array>
       
    <value>${Checkout.AssignOrderNumber}</value>
       
    <value>${Checkout.CreateCustomer}</value>
       
    <value>${Checkout.CreateMemberForCustomer}</value>
       
    <value>${Checkout.ConvertBasketToPurchaseOrder}</value>
       
    <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>
       
    <value>${Checkout.ClearBasketInformation}</value>
       
    <value>${Checkout.SavePurchaseOrder}</value>
       
    <value>${Checkout.NotifyWarehouse}</value>
       
    <value>${Checkout.SendConfirmationEmail}</value>
    </array>

    ...

    <component id="Checkout.SendWarehouseXml"
         
    service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
         
    type="MyShopName.Pipelines.NotifyWarehouse, App_Code"
         
    lifestyle="Thread" />
  • Zac 223 posts 575 karma points
    Apr 05, 2011 @ 14:49
    Zac
    0

    Thanks for that - I did spot and correct it before I ran the last test, as I thought that might cause the problem; however, I still get the same error.

    My steps:

    Created a seperate project and added dll to umbraco bin folder

    namespace MyLibrary.Pipelines
    {
        public class NotifyWarehouseTask : IPipelineTask
        {

            #region IPipelineTask Members

            public PipelineExecutionResult Execute(PurchaseOrder order)
            {
                //throw new Exception("hi");
                return 0;
            }

            #endregion

        }
    }

    I've checked the type in Reflector, which gives me:

    public class NotifyWarehouseTask : IPipelineTask

    Name: MyLibrary.Pipelines.NotifyWarehouseTask
    Assembly: MyLibrary, Version=1.0.0.0

    in checkout.config, i've added

    ${Checkout.NotifyWarehouse}

    and

     

                service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.Entities.PurchaseOrder, UCommerce]], UCommerce"
            type="
    MyLibrary.Pipelines.NotifyWarehouseTask, MyLibrary"
            lifestyle="Thread" />

    But it still errors with the dependency problem

    Thanks for your help

  • Zac 223 posts 575 karma points
    Apr 05, 2011 @ 14:50
    Zac
    0

    sorry, double posted the last entry

  • Zac 223 posts 575 karma points
    Apr 06, 2011 @ 08:57
    Zac
    0

    Hi Søren,

    Any further ideas on this issue?

     

    Thanks

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 06, 2011 @ 09:20
    Søren Spelling Lund
    0

    Could you send me the code and config file so I can take a closer look? [email protected]

  • Zac 223 posts 575 karma points
    Apr 06, 2011 @ 12:52
    Zac
    0

    To close this off, there were two further problems:

    1) The XML wasn't correctly formatted in the config file (a silly mistake), so the component was within another xml tag that wasn't self-closing.

    2) I was using

    UCommerce.EntitiesV2

    instead of

    UCommerce.Entities

    when implementing

    IPipelineTask<PurchaseOrder>
  • Søren Spelling Lund 1797 posts 2786 karma points
    Apr 06, 2011 @ 20:10
    Søren Spelling Lund
    0

    Thanks for putting the final solution here for everyone to see. Appreciate it.

  • Deano 11 posts 31 karma points
    Oct 08, 2012 @ 10:54
    Deano
    0

    PurchaseOrder doesnt exist for me while using the name space UCommerce.Entities. I have to use UCommerce.EntiriesV2 ???

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 10, 2012 @ 09:26
    Søren Spelling Lund
    0

    The UCommerce.Entities namespace is only avaialble in uCommerce 1.0 - 1.5. From uCommerce 2 UCommerce.EntitiesV2 replaces the old API adding richer querying capabilities and a much clearer object model to work with.

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 11:57
    Jacob
    0

    Hello

    Sorry for starting this older thread up, but I am having a issue like this.

     

    I have put a dll in the bin folder with:

    using UCommerce.EntitiesV2;
    using UCommerce.Pipelines;
     
    namespace UCommerceOrderHandler
    {
        public class UCommerceTransferOrder : IPipelineTask
        {
            #region IPipelineTaskMembers
     
            public PipelineExecutionResult Execute(PurchaseOrder order)
            {
            }
     
            #endregion
        }
    }
     

    In the Checkout config file I have put:

    ${Checkout.MoveOrderToERP}     
      service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerceOrderHandler.UCommerceTransferOrder, UCommerceOrderHandler" />

     

    But I am getting the same error as seen ealier in the post, and I cannot seem to figure out whats wrong. The XML seems correct, and I can not use Entities as suggested because I am on the newest version of uCommerce. The error I am getting in UmbracoLog is:

    Can't create component 'Checkout' as it has dependencies to be satisfied. 

    Checkout is waiting for the following dependencies: 

    Keys (components with specific keys)

    - Checkout.MoveOrderToERP which was not registered. 

     

    Hope you guys can point me to what I am doing wrong.

     

  • Morten Skjoldager 440 posts 1499 karma points
    Feb 19, 2013 @ 13:37
    Morten Skjoldager
    0

    Can't create component 'Checkout' as it has dependencies to be satisfied.  

    That line tell's me that you have Services injected into the constructor that Castle windsor doesn't know what to do with. Is that correct? All injected components must be registered along with their dependencies and so forth.

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 14:07
    Jacob
    0

    Hello Morten

    I am certainly doing somthing wrong, since it does not work. I posted what I have done in my ealier post, but can you give me a clue what to look for.

  • Morten Skjoldager 440 posts 1499 karma points
    Feb 19, 2013 @ 15:19
    Morten Skjoldager
    0

    Whenever you register a new component in Castle windsor it will be able to find it and use it (which it does whenever you execute a pipeline.).

    However it might be that your constructor isn't empty. If so, you need to register those task in the components file just like you did with UCommerceTransferOrder. That is what the error is trying to tell you. 

    It looks like it is a component with id 'Checkout' that needs a component "MoveOrderToERP" which you did not register. 

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 15:37
    Jacob
    0

    Hey again Morten

    In the Checkout.config I have:

    <component id="Checkout"
      service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.Checkout.CheckoutPipeline, UCommerce.Pipelines">
    <parameters>
    <tasks>
    <array>
    <value>${Checkout.ValidatePaymentsMadeAgainstOrderTotal}</value>
    <value>${Checkout.AssignOrderNumber}</value>
    <value>${Checkout.CreateCustomer}</value>
    <value>${Checkout.CreateMemberForCustomer}</value>
    <value>${Checkout.ConvertBasketToPurchaseOrder}</value>
    <value>${Checkout.AddAuditTrailForCurrentOrderStatus}</value>
    <value>${Checkout.SetVoucherUses}</value>
    <value>${Checkout.ClearBasketInformation}</value>
    <value>${Checkout.SavePurchaseOrder}</value>
    <value>${Checkout.SendConfirmationEmail}</value>
               <value>${Checkout.SendWebshopInfoEmail}</value> 
    <value>${Checkout.MoveOrderToERP}</value>         
    </array>
    </tasks>
    </parameters>
    </component>
     

    And further down I have:

    <component id="Checkout.MoveOrderToERP"
      service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerceOrderHandler.UCommerceTransferOrder, UCommerceOrderHandler" />

  • Morten Skjoldager 440 posts 1499 karma points
    Feb 19, 2013 @ 15:42
    Morten Skjoldager
    0

    Allrighty - that looks right. And does MoveOrderToERP have anything in it's constructor, or is it empty ? 

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 16:00
    Jacob
    0

    Well all I have in UCommerceOrderHandler is what I have taken from the ealier example

    using UCommerce.EntitiesV2;
    using UCommerce.Pipelines;
     
    namespace UCommerceOrderHandler
    {
        public class UCommerceTransferOrder : IPipelineTask<PurchaseOrder>
        {
            #region IPipelineTask<T> Members
     
            public PipelineExecutionResult Execute(PurchaseOrder order)
            {
                //throw new Exception("hello world");
                return 0;
            }
     
            #endregion
        }
    }

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 16:17
    Jacob
    0

    ehh.. I guess it is time to leave the Pc for a while... I just found out I have been copying the dlls to a different test Umbraco installation I was messing around with. After placing the DLLs in the correct bin folder everything is working!

    Sorry for wasting your time Morten, and thanks for using your time to help me out.

Please Sign in or register to post replies

Write your reply to:

Draft