You can call a pipeline with the following code from .NET
var pipeline = PipelineFactory.Create<PurchaseOrder>("Basket"); // name of the pipeline found in /umbraco/ucommerce/pipelines
pipeline.Execute(purchaseOrder);
OrderAddress address = new OrderAddress(); //Want to assign this address to PurchaseOrder (for both billing and shipping address) address.FirstName = "Neo";
I need to assign Billing and Shipping address to the PurchaseOrder.
But BasketInstance.PurchaseOrder.BillingAddress is not a valid property.
namespaces to be used for the following functions
Can you guys tell me the namespace to be used for the following functions? It need to use these functions in .NET usercontrols (via API)
CommerceLibrary:ExecuteBasketPipeline();
CommerceLibrary:DeleteLineItem($deleteLineItem);
CommerceLibrary:GetBasket();
CommerceLibrary:CreatePayment($paymentMethodId, -1, true(), true())"
CommerceLibrary:CreateShipment($shippingMethodId, 'Shipment', true());
CommerceLibrary:EditShipmentInformation()
CommerceLibrary:Checkout()
CommerceLibrary:SetBillingAddress('Billing')"
Neo
The UCommerce XSLT functions are found in UCommerce.Xslt.Library. You may have a look at http://www.ucommerce.dk/docs/ for further investigation.
Hope this helps.
Christian
Hi Christian
Thanks for you reply. By the way I want to know the API equivalent for those functions?
for eg.
CommerceLibrary:GetBasket() corresponds to SiteContext.Current.OrderContext.GetBasket();
Like that how we can call this function ExecuteBasketPipeline(); in .NET usercontrol through API?
Neo
Neo,
You can call a pipeline with the following code from .NET
Thanks Soren.
By the way can you please tell how to call the following methods?
CommerceLibrary:CreatePayment($paymentMethodId, -1, true(), true())"
CommerceLibrary:CreateShipment($shippingMethodId, 'Shipment', true());
CommerceLibrary:EditShipmentInformation()
CommerceLibrary:Checkout()
CommerceLibrary:SetBillingAddress('Billing')
And what is equavent for CommerceLibrary in API?
CreatePayment: new Payment()
CreateShipment:
CreateShipment:
EditShipmentInformation:
Checkout:
SetBillingAddress:
Thank you Soren. This is what I am looking for.
Got some more doubts.
Basket BasketInstance = SiteContext.Current.OrderContext.GetBasket();
//BasketInstance.PurchaseOrder
OrderAddress address = new OrderAddress(); //Want to assign this address to PurchaseOrder (for both billing and shipping address)
address.FirstName = "Neo";
I need to assign Billing and Shipping address to the PurchaseOrder.
But BasketInstance.PurchaseOrder.BillingAddress is not a valid property.
and
Shipment shipment = BasketInstance.PurchaseOrder.Shipments.First();
OrderAddress address = shipment.ShippingAddress; //Not a valid property
address.FirstName = "Neo";
Can you please help me on this?
Ah yes, you're using UCommerce.Entities so the way of associating objects to each other works than the EntitiesV2 example I showed above.
Basically you need to do on the id level instead of object like so:
BasketInstance.PurchaseOrder.BillingAddressId = billlingAddress.OrderAddressId;
Same thing for shipping address.
Hope this helps.
Is it the right way to assign Billing address?
OrderAddress Address = new OrderAddress();
Address.FirstName = "Neo";
Address.Save();
BasketInstance.PurchaseOrder.BillingAddressId = Address.OrderAddressId;
But in the case of shipping there is no property called BasketInstance.PurchaseOrder.ShippingAddressId?
Can you please show the code for adding shipping address also?
Shipping address is linked to the order via a shipment. If you're working with just one shipment here's how you do it:
Thanks Soren for your reply.
Can you please tell me the code to create payment and assign to a payment method?
This is the payment method that I want to use.
PaymentMethod Pay = PaymentMethod.SingleOrDefault(pm => pm.PaymentMethodServiceName.Equals("SagePay") && pm.Enabled);
Take a look at the last part of this article: Integrating uCommerce with a Payment Provider. It shows you how to execute a payment method service both from XSLT and .NET.
is working on a reply...