Beispiel #1
0
    protected void validateEmail(object sender, ServerValidateEventArgs e)
    {
        Validation validate     = new Validation();
        string     confirmEmail = "";

        e.IsValid = false;

        if (!String.IsNullOrEmpty(tbEmail.Text))
        {
            confirmEmail = tbEmail.Text.Trim().ToLower();
        }

        if (!String.IsNullOrEmpty(tbEmail.Text))
        {
            if (!validate.ValidateEmailAddress(tbEmail.Text))
            {
                ValidationError.AddNewError(PaymentResources.GetStringFromResourceFile("resCCEmailAddressNotValid"));
            }
            else
            {
                if (confirmEmail != tbEmail.Text.Trim().ToLower())
                {
                    ValidationError.AddNewError(PaymentResources.GetStringFromResourceFile("resCCEmailAddressConfirmDoesNotMatch"));
                }
                else
                {
                    e.IsValid = true;
                }
            }
        }
    }
Beispiel #2
0
    protected void validateSecurityCode(object sender, ServerValidateEventArgs e)
    {
        Validation validate = new Validation();

        e.IsValid = validate.ValidateSecurityCode(tbSecurityCode.Text);

        if (e.IsValid == false)
        {
            ValidationError.AddNewError(PaymentResources.GetStringFromResourceFile("resCCSecurityCodeError"));
        }
    }
Beispiel #3
0
    private void ProcessCreditCardPayment()
    {
        string offerId       = OfferIdFromViewState;
        string piUserId      = PaymentItemUserIdFromViewState;
        string hangoutUserId = HangoutUserIdFromViewState;
        string sessionGuid   = SessionGuidFromViewState;

        CreditCardInfo creditCardInfo = new CreditCardInfo();

        creditCardInfo.FirstName     = tbFirstName.Text.Trim();
        creditCardInfo.LastName      = tbLastName.Text.Trim();
        creditCardInfo.Address       = tbAddress.Text.Trim();
        creditCardInfo.City          = tbCity.Text.Trim();
        creditCardInfo.StateProvince = ddState.SelectedValue;
        creditCardInfo.ZipCode       = tbZipCode.Text;
        creditCardInfo.CountryCode   = ddCountry.SelectedValue;

        creditCardInfo.CreditCardnumber = tbCreditCardNumber.Text.Replace(" ", "").Replace("-", "");
        creditCardInfo.CreditCardtype   = ddCardType.SelectedValue.ToUpper().Replace(" ", "_");
        creditCardInfo.SecurityCode     = tbSecurityCode.Text;
        creditCardInfo.ExpireDate       = String.Format("{0}{1}", ddExpireMonth.SelectedValue, ddExpireYear.SelectedValue);

        string transactionId = Guid.NewGuid().ToString();

        string emailaddress = tbEmail.Text.Trim();

        if (PaymentItemEmailAddressFromViewState.Trim().ToLower() != emailaddress.ToLower())
        {
            UpdateEmailAddress(piUserId, emailaddress);
        }

        string resultMessage = PurchaseGameCurrencyCreditCard(transactionId, piUserId, hangoutUserId, sessionGuid, offerId, creditCardInfo, emailaddress);

        if (resultMessage == "OK")
        {
            Context.Items["transactionId"] = transactionId;
            Context.Items["offerId"]       = offerId;
            Context.Items.Add("creditCardInfo", creditCardInfo);
            ServerTransfer("CreditCardComplete.aspx");
        }
        else
        {
            ValidationError.AddNewError(resultMessage);
            CreditCardErrorsDiv.Visible = true;
        }
    }