Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

Pipeline CreateCostumerTask Decompilation Request

$
0
0

Hi there, uCommerce experts.

I'm currently developing a costumized webshop where I have to assign a purchaseOrder automatically to some users. Therefore, I dug into the world of pipelines and together with dotPeek (a decompilation program) I managed to get my hands on the code of the CreateCostumerTask pipeline function in the checkout() pipeline.

The decompiled code looks like the following:

public PipelineExecutionResult Execute(PurchaseOrder purchaseOrder)

    {

      if (purchaseOrder.Customer == null)

      {

        // ISSUE: object of a compiler-generated type is created

        // ISSUE: variable of a compiler-generated type

        CreateCustomerTask.<>c__DisplayClass0 cDisplayClass0 = new CreateCustomerTask.<>c__DisplayClass0();

        // ISSUE: reference to a compiler-generated field

        cDisplayClass0.billingAddress = purchaseOrder.GetBillingAddress();

        // ISSUE: reference to a compiler-generated field

        if (cDisplayClass0.billingAddress == null)

          throw new InvalidOperationException(string.Format("No billing address is set for order {0}. Please add an OrderAddress and set that as the billing address of the order.", (object) purchaseOrder.OrderGuid));

        ParameterExpression parameterExpression = Expression.Parameter(typeof (Customer), "x");

        // ISSUE: method reference

        // ISSUE: field reference

        // ISSUE: method reference

        // ISSUE: method reference

        // ISSUE: reference to a compiler-generated field

        Customer customer = Customer.SingleOrDefault(Expression.Lambda<Func<Customer, bool>>((Expression) Expression.Equal((Expression) Expression.Property((Expression) parameterExpression, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (Customer.get_EmailAddress))), (Expression) Expression.Property((Expression) Expression.Field((Expression) Expression.Constant((object) cDisplayClass0), FieldInfo.GetFieldFromHandle(__fieldref (CreateCustomerTask.<>c__DisplayClass0.billingAddress))), (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (OrderAddress.get_EmailAddress))), false, (MethodInfo) MethodBase.GetMethodFromHandle(__methodref (string.op_Equality))), new ParameterExpression[1]

        {

          parameterExpression

        })) ?? Customer.Create(cDisplayClass0.billingAddress);

        purchaseOrder.Customer = customer;

      }

      return PipelineExecutionResult.Success;

    }

 

I would like to hear, if you could elaborate on the code where it initiates a new class containing the <> symbol. That is, to say, to be able to create my costum pipeline with a costumized "CreateCostumer" function. My final aim is to be able to create a new costumer with a dummy billing address assigned to him.

 

Thanks in advance, and a happy new year to everyone!

Brinck10


Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>