Exemple #1
0
        /// <summary>
        /// Add a line to this transaction
        /// </summary>
        /// <param name="amount">Value of the item.</param>
        /// <param name="type">Address Type. Can be ShipFrom, ShipTo, PointOfOrderAcceptance, PointOfOrderOrigin, SingleLocation.</param>
        /// <param name="line1">Street address, attention line, or business name of the location.</param>
        /// <param name="line2">Street address, business name, or apartment/unit number of the location.</param>
        /// <param name="line3">Street address or apartment/unit number of the location.</param>
        /// <param name="city">City of the location.</param>
        /// <param name="region">State or Region of the location.</param>
        /// <param name="postalCode">Postal/zip code of the location.</param>
        /// <param name="country">Two-letter country code of the location.</param>
        /// <returns></returns>
        public TransactionBuilder WithSeparateAddressLine(decimal amount, TransactionAddressType type, string line1, string line2, string line3, string city, string region, string postalCode, string country)
        {
            var l = new LineItemModel
            {
                number    = _line_number.ToString(),
                quantity  = 1,
                amount    = amount,
                addresses = new AddressesModel()
            };

            // Add this address
            var ai = new AddressLocationInfo
            {
                line1      = line1,
                line2      = line2,
                line3      = line3,
                city       = city,
                region     = region,
                postalCode = postalCode,
                country    = country
            };

            SetAddress(l.addresses, type, ai);

            // Put this line in the model
            _model.lines.Add(l);
            _line_number++;

            // Continue building
            return(this);
        }
        /// <summary>
        /// Add a line to this transaction
        /// </summary>
        /// <param name="amount"></param>
        /// <returns></returns>
        public TransactionBuilder WithSeparateAddressLine(decimal amount, TransactionAddressType type, string line1, string line2, string line3, string city, string region, string postalCode, string country)
        {
            var l = new LineItemModel()
            {
                number   = _line_number.ToString(),
                quantity = 1,
                amount   = amount,
            };

            // Add this address
            l.addresses       = new Dictionary <TransactionAddressType, AddressInfo>();
            l.addresses[type] = new AddressInfo()
            {
                line1      = line1,
                line2      = line2,
                line3      = line3,
                city       = city,
                region     = region,
                postalCode = postalCode,
                country    = country
            };

            // Put this line in the model
            _model.lines.Add(l);
            _line_number++;

            // Continue building
            return(this);
        }
Exemple #3
0
        /// <summary>
        /// Add a line to this transaction
        /// </summary>
        /// <param name="amount">Value of the item.</param>
        /// <param name="quantity">Quantity of the item.</param>
        /// <param name="taxCode">Tax Code of the item. If left blank, the default item (P0000000) is assumed.  Use ListTaxCodes() for a list of values.</param>
        /// <param name="customerUsageType">The intended usage type for this line.  Use ListEntityUseCodes() for a list of values.</param>
        /// <param name="description">A friendly description of this line item.</param>
        /// <param name="itemCode">The item code of this item in your product item definitions.</param>
        /// <param name="lineNumber">the number of the line.</param>
        /// <returns></returns>
        public TransactionBuilder WithLine(decimal amount, decimal quantity = 1, string taxCode = null, string description = null, string itemCode = null, string customerUsageType = null, string lineNumber = null)
        {
            string lineNumStr = lineNumber;

            if (string.IsNullOrEmpty(lineNumStr))
            {
                lineNumStr = _line_number.ToString();
            }

            var l = new LineItemModel
            {
                number            = lineNumStr,
                quantity          = quantity,
                amount            = amount,
                taxCode           = taxCode,
                description       = description,
                itemCode          = itemCode,
                customerUsageType = customerUsageType
            };

            _model.lines.Add(l);
            _line_number++;

            // Continue building
            return(this);
        }
        /// <summary>
        /// Add a line to this transaction
        /// </summary>
        /// <param name="amount"></param>
        /// <returns></returns>
        public TransactionBuilder WithExemptLine(decimal amount, string exemptionCode)
        {
            var l = new LineItemModel()
            {
                number        = _line_number.ToString(),
                quantity      = 1,
                amount        = amount,
                exemptionCode = exemptionCode
            };

            _model.lines.Add(l);
            _line_number++;

            // Continue building
            return(this);
        }