private static ComboOrderData BuildComboOrder(string partyId, decimal amount, string fund)
 {
     var usd = new CurrencyData("USD");
     var party = new PersonData { PartyId = partyId };
     var customerParty = new CustomerPartyData { Id = partyId, Party = party };
     var orderData = new OrderData
     {
         BillToCustomerParty = customerParty,
         SoldToCustomerParty = customerParty,
         Currency = usd,
         Lines = new OrderLineDataCollection{
             new OrderLineData
             {
                 Item = new GiftItemData {ItemCode = fund},
                 QuantityOrdered = new QuantityData(1),
                 UnitPrice = new MonetaryAmountData(amount, usd),
                 ExtendedAmount = new MonetaryAmountData(amount, usd)
             }
         },
     };
     var comboOrder = new ComboOrderData
     {
         Currency = usd,
         Order = orderData
     };
     comboOrder.Payments = new RemittanceDataCollection
     {
         new RemittanceData
         {
             Amount = new MonetaryAmountData(amount, usd),
             PaymentMethod = new PaymentMethodData {PaymentMethodId = "CASH"},
             PayorParty = new CustomerPartyData {Id = partyId, Party = party}
         }
     };
     return comboOrder;
 }
示例#2
0
        private OrderData ProcessOrderImportRow(string[] pieces, string line, int lineNumber)
        {
            OrderData orderData = null;
            if (pieces.Length < minimumSupportedColumnsForOrder)
            {
                AddError(line, lineNumber, "Invalid line - too few columns for ORDER");
            }
            else
            {
                var partyId = pieces[partyIdColumn];
                var firstName = pieces[firstNameColumn];
                var lastName = pieces[lastNameColumn];
                var email = pieces[emailColumn];
                var phone = pieces[phoneColumn];
                var country = pieces[countryColumn];
                var line1 = pieces[addressLine1Column];
                var line2 = pieces[addressLine2Column];
                var city = pieces[cityColumn];
                var stateProvince = pieces[stateProvinceColumn];
                var postalCode = pieces[postalCodeColumn];

                PartyData party;
                var updateParty = false;
                AlternateIdData originatorId = null;
                if (String.IsNullOrEmpty(partyId))
                {
                    party = CreateNewParty(firstName, lastName, country, city, stateProvince, postalCode, email, phone, line1, line2);
                    originatorId = new AlternateIdData("SourceId", Guid.NewGuid().ToString());
                    updateParty = true;
                }
                else
                    party = new PersonData {PartyId = partyId};

               var customerParty = new CustomerPartyData { Id = partyId, UpdateParty = updateParty, Party = party, OriginatorCustomerId = originatorId};
               var deliveryData = new DeliveryData
               {
                   DeliveryMethod = new DeliveryMethodData { DeliveryMethodId = "USPS" },
                   Address = party.Addresses[0],
                   CustomerParty = customerParty
               };
                orderData = new OrderData
                {
                    BillToCustomerParty = customerParty,
                    SoldToCustomerParty = customerParty,
                    Currency = CommerceSettings.DefaultCurrency,
                    Lines = new OrderLineDataCollection(),
                    OrderReference = new OrderReferenceData(),
                    Delivery = new DeliveryDataCollection { deliveryData }
                };

            }
            return orderData;
        }