protected void btnSubmit_Click(object sender, EventArgs e) { SponsorshipPaymentFormOptionsOCM options = (SponsorshipPaymentFormOptionsOCM)this.Content.GetContent(typeof(SponsorshipPaymentFormOptionsOCM)); if (options != null) { try { if (validCard()) { Guid searchId = this.findConstituent(); Guid constituentId = searchId == Guid.Empty ? this.createConsitutent() : searchId; //new Guid("AB7BD96E-F277-4C5F-B9FE-2D5E9DB1F9E7"); // //this.addGift(constituentId); this.createSponsorship(constituentId); if (this.radPayment.SelectedValue == "Check") { Response.Redirect(options.ThankYouPage); } else { if (this.processPayment()) { Session["CartData"] = null; Response.Redirect(options.ThankYouPage); } } } } catch (Exception ex) { this.lblError.Visible = true; this.lblError.Text = ex.Message + "<br /><br />" + ex.StackTrace; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SponsorshipPaymentFormOptionsOCM options = (SponsorshipPaymentFormOptionsOCM)this.Content.GetContent(typeof(SponsorshipPaymentFormOptionsOCM)); if (options.DemoMode) { Session[c_Referrer] += "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; } lblReferrer.Text = "v3 - " + (Session[c_Referrer] == null ? String.Empty : Session[c_Referrer].ToString()); lblReferrer.Visible = options.DemoMode; if (this.total == 0) { // Response.Redirect("/"); } try { this.populateYears(); this.populateHearAbout(); this.showTotal(); } catch { //ignore } } }
public override bool OnSaveContent(bool bDialogIsClosing = true) { SponsorshipPaymentFormOptionsOCM options = new SponsorshipPaymentFormOptionsOCM(); options.ThankYouPage = this.txtThankYouPage.Text; options.DemoMode = this.chkDemo.Checked; this.Content.SaveContent(options); return(true); }
public override void OnLoadContent() { if (!IsPostBack) { SponsorshipPaymentFormOptionsOCM options = (SponsorshipPaymentFormOptionsOCM)this.Content.GetContent(typeof(SponsorshipPaymentFormOptionsOCM)); if (options != null) { this.txtThankYouPage.Text = options.ThankYouPage; this.chkDemo.Checked = options.DemoMode; } } }
private bool processPayment() { SponsorshipPaymentFormOptionsOCM options = (SponsorshipPaymentFormOptionsOCM)this.Content.GetContent(typeof(SponsorshipPaymentFormOptionsOCM)); BBPSPaymentInfo payment = new BBPSPaymentInfo(); payment.DemoMode = options.DemoMode; payment.MerchantAcctID = 14; payment.Bbpid = Utility.GetBbbid(14, this.API.Transactions.MerchantAccounts); payment.SkipCardValidation = false; foreach (DataRow dr in this.cartData.Rows) { int designationId = Utility.GetBbncDesignationIdFromSponsorshipOpportunity(dr["Id"].ToString()); decimal amount = Convert.ToInt32(dr["Months"]) * Convert.ToDecimal(dr["Amount"]); payment.AddDesignationInfo(amount, "BBIS Child Sponsorship Transaction", designationId); } payment.AppealID = 1; payment.Comments = ""; if (this.radPayment.SelectedValue == "Check") { payment.PaymentMethod = BBNCExtensions.API.Transactions.PaymentArgs.ePaymentMethod.Check; } else { payment.PaymentMethod = BBNCExtensions.API.Transactions.PaymentArgs.ePaymentMethod.CreditCard; payment.CreditCardCSC = this.txtCcSecurityCode.Text; payment.CreditCardExpirationMonth = Convert.ToInt32(this.cmbCcExpMonth.SelectedValue); payment.CreditCardExpirationYear = Convert.ToInt32(this.cmbCcExpYear.SelectedValue); payment.CreditCardHolderName = this.txtCcName.Text; payment.CreditCardNumber = this.txtCcNumber.Text; payment.CreditCardType = (BBNCExtensions.Interfaces.Services.CreditCardType)Enum.Parse(typeof(BBNCExtensions.Interfaces.Services.CreditCardType), this.cmbCcType.SelectedValue); if (this.radBilling.SelectedValue == "Yes") { payment.DonorStreetAddress = this.txtAddress.Text; payment.DonorCity = this.txtCity.Text; payment.DonorStateProvince = this.cmbCountry.SelectedValue == "US" ? this.cmbState.SelectedValue : this.txtRegion.Text; payment.DonorZIP = this.txtZip.Text; } else { payment.DonorStreetAddress = this.txtBillingAddress.Text; payment.DonorCity = this.txtBillingCity.Text; payment.DonorStateProvince = this.cmbCountry.SelectedValue == "US" ? this.cmbBillingState.SelectedValue : this.txtBillingRegion.Text; payment.DonorZIP = this.txtBillingZip.Text; } } payment.EmailAddress = this.txtEmail.Text; BBNCExtensions.API.Transactions.Donations.RecordDonationReply reply = this.API.Transactions.RecordDonation(payment.GeneratePaymentArgs()); if (!payment.InterpretPaymentReply(reply).Success) { this.lblError.Visible = true; this.lblError.Text = payment.InterpretPaymentReply(reply).Message; return(false); } else { return(true); } }