Example #1
0
        /// <summary>
        /// Used to set IPN values related to a customer.
        /// </summary>
        /// <remarks>
        /// This method should not be used directly. Instead use
        /// <see cref="SetIpnTransactionProperties"/>.
        /// </remarks>
        /// <param name="key">The key used to find the property.</param>
        /// <param name="val">The value to set to the property.</param>
        /// <param name="ipn">The <see cref="IpnTransaction"/> to set to.</param>
        /// <returns>TRUE if a property was set, otherwise returns FALSE.</returns>
        private bool SetIpnTransactionProperties_Customer(string key, string val, IpnTransaction ipn)
        {
            // Only want to set these values

            switch (key)
            {
                case "first_name":
                    ipn.CustomerInfo.FirstName = val;
                    break;

                case "last_name":
                    ipn.CustomerInfo.LastName = val;
                    break;

                case "payer_business_name":
                    ipn.CustomerInfo.BusinessName = val;
                    break;

                case "address_name":
                    ipn.CustomerInfo.AddressName = val;
                    break;

                case "address_street":
                    ipn.CustomerInfo.Address1 = val;
                    break;

                case "address_city":
                    ipn.CustomerInfo.City = val;
                    break;

                case "address_state":
                    ipn.CustomerInfo.State = val;
                    break;

                case "address_zip":
                    ipn.CustomerInfo.Zip = val;
                    break;

                case "address_country":
                    ipn.CustomerInfo.Country = val;
                    break;

                case "address_status":
                    ipn.SetProperty("address_status", val);
                    break;

                case "payer_email":
                    ipn.CustomerInfo.Email = val;
                    break;

                case "payer_id":
                    ipn.CustomerInfo.PayerID = val;
                    break;

                case "payer_status":
                    ipn.SetProperty("payer_status", val);
                    break;

                default:
                    return false;
            }

            return true;
        }
Example #2
0
        /// <summary>
        /// Helper function used to set the property value for an <see cref="IpnTransaction"/> object
        /// for the given key.
        /// </summary>
        /// <param name="key">The key used to find the property.</param>
        /// <param name="val">The value to set to the property.</param>
        /// <param name="ipn">The <see cref="IpnTransaction"/> to set to.</param>
        private void SetIpnTransactionProperties(string key, string val, IpnTransaction ipn)
        {
            Debug.Assert(key != null, "Cannot find property with key == null!");
            Debug.Assert(val != null, "Cannot set property with val == null!");
            Debug.Assert(ipn != null, "Cannot set property with ipn == null!");


            // Set Date/Time Properties
            if (SetIpnTransactionProperties_Date(key, val, ipn))
            {
                return;
            }

                // Set Buyer Information Properties
            else if (SetIpnTransactionProperties_Customer(key, val, ipn))
            {
                return;
            }

                // Set Product Information Properties
            else if (SetIpnTransactionProperties_Product(key, val, ipn))
            {
                return;
            }

                // Set Subscriptions Information Properties
            else if (SetIpnTransactionProperties_SubscriptionItem(key, val, ipn))
            {
                return;
            }

                // Set Generically
            else
            {
                ipn.SetProperty(key, val);
            }
        }