Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="memberCreditCard"></param>
 /// <param name="transactionType"></param>
 /// <param name="amount"></param>
 /// <param name="debug"></param>
 public ChargeCardRequest(CreditCard creditCardData, Member memberData, float amount, bool debug)
 {
     base.Debug = debug;
     this.CreditCardData = creditCardData;
     this.MemberData = memberData;
     this.Amount = amount;
 }
 public CreditCardServiceRequest(CreditCard creditcarddata, Member memberdata, string pubcode, string username, string password, bool refreshcustomer)
 {
     CreditCardData = creditcarddata;
     MemberData = memberdata;
     ProgramId = pubcode;
     UserName = username;
     Password = password;
     RefreshCustomer = refreshcustomer;
 }
Ejemplo n.º 3
0
        public void ApproveCC()
        {
            throw new NotImplementedException();
            //CreditCardLogic target = new CreditCardLogic();

            #region set cc data
            CreditCard creditCardData = new CreditCard();
            creditCardData.CCAddress = ccaddress;
            creditCardData.CCCity = cccity;
            creditCardData.CCExpMonth = short.Parse(ccexpmonth);
            creditCardData.CCExpYear = short.Parse(ccexpyear);
            creditCardData.CCName = ccname;
            creditCardData.CCPostalCode = ccpostalcode;
            creditCardData.CCState = ccstate;
            #endregion

            #region set member data
            Member memberData = new Member();
            memberData.Salutation = updatedsalutation;
            memberData.FirstName = updatedfirstname;
            memberData.MiddleInitial = updatedmiddleinitial;
            memberData.LastName = updatedlastname;
            memberData.Suffix = updatedsuffix;
            memberData.ProfessionalTitle = updatedprofessionaltitle;
            memberData.Email = updatedemail;
            memberData.OptIn = updatedoptin;
            memberData.Address.BusinessName = updatedbusinessname;
            memberData.Address.Address1 = updatedaddress1;
            memberData.Address.Address2 = updatedaddress2;
            memberData.Address.Address3 = updatedaddress3;
            memberData.Address.City = updatedcity;
            memberData.Address.State = updatedstate;
            memberData.Address.PostalCode = updatedpostalcode;
            memberData.Address.Country = updatedcountry;
            memberData.Address.Phone = updatedphone;
            memberData.Address.Fax = updatedfax;
            memberData.Address.AltCity = updatedaltcity;
            #endregion

            //creditCardData.CCNumber = goodamex;
            //BaseResponse actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
            //Assert.AreEqual(true, actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
            //verifoneroutingid = ((ChargeCardResponse)actual.TypedResponse).VerifoneRoutingId;

            //creditCardData.CCNumber = gooddisc;
            //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
            //Assert.AreEqual(true, actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
            //verifoneroutingid = ((ChargeCardResponse)actual.TypedResponse).VerifoneRoutingId;

            //creditCardData.CCNumber = goodmc;
            //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
            //Assert.AreEqual(true, actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
            //verifoneroutingid = ((ChargeCardResponse)actual.TypedResponse).VerifoneRoutingId;

            //creditCardData.CCNumber = goodvisa;
            //actual = target.ChargeCard(creditCardData, memberData, amountpaid, debug);
            //Assert.AreEqual(true, actual != null && actual.TypedResponse != null && actual.TypedResponse.Success);
            //verifoneroutingid = ((ChargeCardResponse)actual.TypedResponse).VerifoneRoutingId;
        }
Ejemplo n.º 4
0
        public BaseResponse CreateSubscription(int subscriptionlength, 
            float amountpaid, string verifoneroutingid, 
            string publicationcode, string keycode, 
            string renewingmemberid, string salutation, string firstname, string middleinitial, string lastname, string suffix,
            string professionaltitle, string email, bool optin, string businessname, string address1, string address2, string address3,
            string city, string state, string postalcode, string country,
            string phone, string fax, string altcity, 
            bool giftflag, 
            string renewinggiftmemberid, string giftsalutation, string giftfirstname, string giftmiddleinitial, string giftlastname, string giftsuffix,
            string giftprofessionaltitle, string giftemail, bool giftoptin, string giftbusinessname, string giftaddress1, string giftaddress2, string giftaddress3,
            string giftcity, string giftstate, string giftpostalcode, string giftcountry,
            string giftphone, string giftfax, string giftaltcity)
        {
            try
            {
                #region set member data
                Member memberData = new Member();
                memberData.MemberId = renewingmemberid;
                memberData.Salutation = salutation;
                memberData.FirstName = firstname;
                memberData.MiddleInitial = middleinitial;
                memberData.LastName = lastname;
                memberData.Suffix = suffix;
                memberData.ProfessionalTitle = professionaltitle;
                memberData.OptIn = optin;
                memberData.Email = email;

                memberData.Address = new Address();
                memberData.Address.BusinessName = businessname;
                memberData.Address.Address1 = address1;
                memberData.Address.Address2 = address2;
                memberData.Address.Address3 = address3;
                memberData.Address.City = city;
                memberData.Address.State = state;
                memberData.Address.PostalCode = postalcode;
                memberData.Address.Country = country;
                memberData.Address.Phone = phone;
                memberData.Address.Fax = fax;
                memberData.Address.AltCity = altcity;

                Member giftData = new Member();
                //giftData.MemberId = renewinggiftmemberid;
                //giftData.Salutation = salutation;
                //giftData.FirstName = firstname;
                //giftData.MiddleInitial = middleinitial;
                //giftData.LastName = lastname;
                //giftData.Suffix = suffix;
                //giftData.ProfessionalTitle = professionaltitle;
                //giftData.OptIn = optin;
                //giftData.Email = email;

                //giftData.Address = new Address();
                //giftData.Address.BusinessName = businessname;
                //giftData.Address.Address1 = address1;
                //giftData.Address.Address2 = address2;
                //giftData.Address.Address3 = address3;
                //giftData.Address.City = city;
                //giftData.Address.State = state;
                //giftData.Address.PostalCode = postalcode;
                //giftData.Address.Country = country;
                //giftData.Address.Phone = phone;
                //giftData.Address.Fax = fax;
                //giftData.Address.AltCity = altcity;
                #endregion

                #region set cc data
                CreditCard creditCardData = new CreditCard();
                creditCardData.Price = amountpaid;
                creditCardData.AmountPaid = amountpaid;
                creditCardData.VerifoneRoutingId = verifoneroutingid;
                #endregion

                SubscriptionServiceRequest request = new SubscriptionServiceRequest(memberData, giftData, creditCardData, 
                        publicationcode, keycode, giftflag, subscriptionlength);
                baseResponse = SubOrderInsert.CreateSubscription(request);       
            }
            catch (Exception ex)
            {
                EventLogger.LogError("SubscriptionLogic.CreateSubscription", ex.Message);
            }
            return baseResponse;
        }
Ejemplo n.º 5
0
        //string optin, string fax, string altcity,string giftoptin, string giftfax, string giftaltcity
        private object[] CreateSubscription(string subscriptionlength,
            string amountpaid, string verifoneroutingid,
            string publicationcode, string keycode,
            string renewingmemberid, string salutation, string firstname, string middleinitial, string lastname, string suffix,
            string professionaltitle, string email, string businessname, string address1, string address2, string address3,
            string city, string state, string postalcode, string country,
            string phone, 
            string giftflag,
            string renewinggiftmemberid, string giftsalutation, string giftfirstname, string giftmiddleinitial, string giftlastname, string giftsuffix,
            string giftprofessionaltitle, string giftemail, string giftbusinessname, string giftaddress1, string giftaddress2, string giftaddress3,
            string giftcity, string giftstate, string giftpostalcode, string giftcountry,
            string giftphone,
            string iscomp)
        {
            int response_code = 0;
            string member_id = string.Empty;

            #region convert string input to correct types

            bool is_comp = false;
            if (!bool.TryParse(iscomp, out is_comp))
            {
                is_comp = false;
            }
            int i_subscriptionlength = 0;
            float f_amountpaid = 0.0f;
            bool b_optin = false;
            bool b_giftflag = false;
            bool b_giftoptin = false;

            if (!int.TryParse(subscriptionlength, out i_subscriptionlength))
            {
                response_code = 401;
            }
            if (!float.TryParse(amountpaid, out f_amountpaid))
            {
                response_code = 402;
            }
            /*if (!bool.TryParse(optin, out b_optin))
            {
                response_code = 403;
            }*/
            if (!string.IsNullOrEmpty(giftflag))
            {
                if (!bool.TryParse(giftflag, out b_giftflag))
                {
                    response_code = 404;
                }
                /*if (!bool.TryParse(giftoptin, out b_giftoptin))
                {
                    response_code = 405;
                }*/
            }
            #endregion

            if (response_code == 0)
            {
                #region set member data
                Member memberData = new Member();
                memberData.MemberId = renewingmemberid;
                memberData.Salutation = salutation;
                memberData.FirstName = firstname;
                memberData.MiddleInitial = middleinitial;
                memberData.LastName = lastname;
                memberData.Suffix = suffix;
                memberData.ProfessionalTitle = professionaltitle;
                memberData.OptIn = b_optin;
                memberData.Email = email;

                memberData.Address = new Address();
                memberData.Address.BusinessName = businessname;
                memberData.Address.Address1 = address1;
                memberData.Address.Address2 = address2;
                memberData.Address.Address3 = address3;
                memberData.Address.City = city;
                memberData.Address.State = state;
                memberData.Address.PostalCode = postalcode;
                memberData.Address.Country = country;
                memberData.Address.Phone = phone;
                //memberData.Address.Fax = fax;
                //memberData.Address.AltCity = altcity;

                Member giftData = new Member();
                if (b_giftflag)
                {
                    giftData.MemberId = renewinggiftmemberid;
                    giftData.Salutation = salutation;
                    giftData.FirstName = firstname;
                    giftData.MiddleInitial = middleinitial;
                    giftData.LastName = lastname;
                    giftData.Suffix = suffix;
                    giftData.ProfessionalTitle = professionaltitle;
                    giftData.OptIn = b_giftoptin;
                    giftData.Email = email;

                    giftData.Address = new Address();
                    giftData.Address.BusinessName = businessname;
                    giftData.Address.Address1 = address1;
                    giftData.Address.Address2 = address2;
                    giftData.Address.Address3 = address3;
                    giftData.Address.City = city;
                    giftData.Address.State = state;
                    giftData.Address.PostalCode = postalcode;
                    giftData.Address.Country = country;
                    giftData.Address.Phone = phone;
                    //giftData.Address.Fax = fax;
                    //giftData.Address.AltCity = altcity;
                }
                #endregion

                #region set cc data
                CreditCard creditCardData = new CreditCard();
                creditCardData.Price = f_amountpaid;
                creditCardData.AmountPaid = f_amountpaid;
                creditCardData.VerifoneRoutingId = verifoneroutingid;
                
                if(is_comp)
                {
                    creditCardData.PaymentType = "F";
                }
                #endregion

                SubscriptionServiceRequest request = new SubscriptionServiceRequest(memberData, giftData, 
                    creditCardData, publicationcode, keycode, b_giftflag, i_subscriptionlength);
                BaseResponse sub_response = SubOrderInsert.CreateSubscription(request);
                if (sub_response == null || sub_response.TypedResponse == null || sub_response.TypedResponse.Success == false)
                {
                    string msgs = string.Empty;
                    foreach (Message s in sub_response.Messages)
                    {
                        msgs += "[" + s.ToString() + "]";
                    }
                    tbl_AppEventLog logmsg = new tbl_AppEventLog();
                    logmsg.aelAppName = "HarperSERVICE";
                    logmsg.aelDateCreated = DateTime.Now;
                    logmsg.aelEvent = "406";
                    logmsg.aelMessage1 = "sub_response messages:" + msgs;
                    logmsg.aelMessage2 = "typed response:" + sub_response.TypedResponse.ToString();
                    logmsg.aelMessage3 = "success:" + sub_response.TypedResponse.Success;
                    logmsg.Save();
                    response_code = 406;
                }
                else
                {
                    member_id = ((SubscriptionServiceResponse)sub_response.TypedResponse).MemberId;
                }
            }
            return new object[]{response_code, member_id};
        }
Ejemplo n.º 6
0
        //string optin,string fax,string altcity,
        private object[] ChargeCard(string memberid, string salutation, string firstname, string middleinitial, string lastname, string suffix,
            string professionaltitle, string email, string businessname, string address1, string address2, string address3,
            string city, string state, string postalcode, string country,
            string phone,  
            string ccnumber, string expmonth, string expyear, string amount,
            string ccname, string ccaddr, string cccity,
            string ccstate, string cczip, string cccountry, string pubcode, string username, string password, string refreshcustomer)
        {
            int response_code = 0;
            string routing_id = string.Empty;
            string auth_code = string.Empty;

            #region convert string input to correct types
            bool b_optin = false;
            short s_expmonth = 0;
            short s_expyear = 0;
            float f_amount = 0.0f;
            bool b_refreshcustomer = false;

            /*if (!bool.TryParse(optin, out b_optin))
            {
                response_code = 301;
            }*/
            if (!short.TryParse(expmonth, out s_expmonth))
            {
                response_code = 302;
            }
            if (!short.TryParse(expyear, out s_expyear))
            {
                response_code = 303;
            }
            if (!float.TryParse(amount, out f_amount))
            {
                response_code = 304;
            }
            if (!bool.TryParse(refreshcustomer, out b_refreshcustomer))
            {
                response_code = 305;
            }
            #endregion
            
            if(response_code == 0)
            {
                #region validate input
                Member memberData = new Member();
                memberData.MemberId = memberid;
                memberData.Salutation = salutation;
                memberData.FirstName = firstname;
                memberData.MiddleInitial = middleinitial;
                memberData.LastName = lastname;
                memberData.Suffix = suffix;
                memberData.ProfessionalTitle = professionaltitle;
                //memberData.OptIn = b_optin;
                memberData.Email = email;

                memberData.Address = new Address();
                memberData.Address.BusinessName = businessname;
                memberData.Address.Address1 = address1;
                memberData.Address.Address2 = address2;
                memberData.Address.Address3 = address3;
                memberData.Address.City = city;
                memberData.Address.State = state;
                memberData.Address.PostalCode = postalcode;
                memberData.Address.Country = country;
                memberData.Address.Phone = phone;
                //memberData.Address.Fax = fax;
                //memberData.Address.AltCity = altcity;

                CreditCard ccData = new CreditCard();
                ccData.CCNumber = ccnumber;
                ccData.CCExpMonth = s_expmonth;
                ccData.CCExpYear = s_expyear;
                ccData.AmountPaid = f_amount;
                ccData.CCName = ccname;
                ccData.CCAddress = ccaddr;
                ccData.CCCity = cccity;
                ccData.CCState = ccstate;
                ccData.CCPostalCode = cczip;
                ccData.CCCountry = cccountry;
                #endregion

                CreditCardServiceRequest request = new CreditCardServiceRequest(ccData, memberData, pubcode, username, password, b_refreshcustomer);
                BaseResponse cc_response = CreditCardProcessing.GetResponse(request);

                if (cc_response == null || cc_response.TypedResponse == null || cc_response.TypedResponse.Success == false)
                {
                    string msgs = string.Empty;
                    foreach (Message s in cc_response.Messages)
                    {
                        msgs += "[" + s.ToString() + "]";
                    }
                    tbl_AppEventLog logmsg = new tbl_AppEventLog();
                    logmsg.aelAppName = "HarperSERVICE";
                    logmsg.aelDateCreated = DateTime.Now;
                    logmsg.aelEvent = "306";
                    logmsg.aelMessage1 = "cc_response messages:" + msgs;
                    logmsg.aelMessage2 = "typed response:" + cc_response.TypedResponse.ToString();
                    logmsg.aelMessage3 = "success:" + cc_response.TypedResponse.Success;
                    logmsg.Save();
                    response_code = 306;
                }
                else
                {
                    routing_id = ((CreditCardServiceResponse)cc_response.TypedResponse).VerifoneRoutingId;
                    auth_code = ((CreditCardServiceResponse)cc_response.TypedResponse).AuthorizationCode;
                }
            }

            return new object[]{response_code, routing_id, auth_code};
        }