private string GetPaymentMethodChoice(ServiceProvider.CustomerOrderSvc.CustomerOrder_V01 customerOrder) { var paymentMethodChoice = customerOrder.PaymentMethodChoice.ToString(); var paypalPayment = customerOrder.Payments.OfType <PayPalPayment_V01>().FirstOrDefault(); if (customerOrder.PaymentMethodChoice == ServiceProvider.CustomerOrderSvc.CustomerPaymentMethodChoice.CreditCardRedirect && paypalPayment != null) { if (paypalPayment.SolutionType == "SOLE") { paymentMethodChoice = @"Credit\Debit card"; } else { paymentMethodChoice = "PayPal Account"; } } var value = GetCustomerPaymentMethodChoice(customerOrder.PaymentMethodChoice); return(string.IsNullOrEmpty(value) ? paymentMethodChoice : value); }
private static Invoice CreateInvoiceFromCustomerOrder(ServiceProvider.CustomerOrderSvc.CustomerOrder_V01 customerOrderV01) { var invoice = new Invoice(); try { invoice.ID = 0; invoice.Type = InvoiceType.customer; invoice.CreatedDate = DateTime.Now; invoice.DistributorID = customerOrderV01.DistributorID; if (null != customerOrderV01.Shipping) { var shippingInfo = (ServiceProvider.CustomerOrderSvc.CustomerShippingInfo_V01)customerOrderV01.Shipping; if (null != shippingInfo) { if (null != shippingInfo.Address) { invoice.Address1 = shippingInfo.Address.Line1; invoice.Address2 = shippingInfo.Address.Line2; invoice.City = shippingInfo.Address.City; invoice.State = shippingInfo.Address.StateProvinceTerritory; invoice.PostalCode = shippingInfo.Address.PostalCode; } if (null != shippingInfo.Recipient) { invoice.FirstName = shippingInfo.Recipient.First; invoice.LastName = shippingInfo.Recipient.Last; } invoice.PhoneNumber = shippingInfo.Phone; } if (null != customerOrderV01.OrderItems && customerOrderV01.OrderItems.Count > 0) { invoice.InvoiceSkus = new List <InvoiceSKU>(); foreach (var orderItem in customerOrderV01.OrderItems) { var catalogItem = OrderProvider.GetInvoiceSkuDetails(orderItem.SKU); if (null != catalogItem) { var skuItem = new InvoiceSKU { SKU = orderItem.SKU, Quantity = orderItem.Quantity, Description = catalogItem.Description, UnitTotalPrice = catalogItem.ListPrice, UnitVolumePoints = catalogItem.VolumePoints, TotalVolumePoints = catalogItem.VolumePoints * orderItem.Quantity, TotalPrice = orderItem.Quantity * catalogItem.ListPrice }; invoice.InvoiceSkus.Add(skuItem); } } } } } catch (Exception ex) { // TODO: Proper logging //MyHLWebUtil.LogExceptionWithContext(ex); } return(invoice); }