Beispiel #1
0
        /// <summary>
        /// Adds the contact to plan.
        /// </summary>
        /// <param name="contactIdentifier">The contact identifier.</param>
        /// <param name="order">The order.</param>
        /// <param name="planId">The plan identifier.</param>
        /// <param name="initialStateId">The initial state identifier.</param>
        protected virtual void AddContactToPlan(string contactIdentifier, Order order, ID planId, ID initialStateId)
        {
            Dictionary <string, object> customDictionary = new Dictionary <string, object>();

            customDictionary.Add(order.ExternalId, order);
            Dictionary <string, object> customData = new Dictionary <string, object>();

            customData.Add("commerce.orders", customDictionary);
            CommerceAutomationHelper.AddContactToState(contactIdentifier, planId, initialStateId, customData);
        }
Beispiel #2
0
        public PipelineExecutionResult Execute(PurchaseOrder purchaseOrder)
        {
            var contactRepositoryBase = Assert.ResultNotNull(Factory.CreateObject("contactRepository", true) as ContactRepositoryBase);

            var    contactFactory = new ContactFactory();
            string userIdentifier = contactFactory.GetContact();
            var    leaseOwner     = new LeaseOwner(AnalyticsSettings.ClusterName, LeaseOwnerType.WebCluster);

            var contact = CommerceAutomationHelper.GetContact(userIdentifier);

            if (contact != null)
            {
                AddEmailAddressToContact(purchaseOrder, contact);
                contactRepositoryBase.SaveContact(contact, new ContactSaveOptions(true, leaseOwner, new TimeSpan?()));
            }

            return(PipelineExecutionResult.Success);
        }