protected void btnGenerate_Click(object sender, EventArgs e) { ZNode.Libraries.Payment.GatewayIPCommerce ipc = new ZNode.Libraries.Payment.GatewayIPCommerce(); ipc.RotateKey(); lblMsg.Text = "Key has been successfully rotated."; btnCancel.Visible = false; btnGenerate.Visible = false; }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { ZNode.Libraries.Payment.GatewayIPCommerce ipc = new ZNode.Libraries.Payment.GatewayIPCommerce(); bool ret = ipc.ChangePassword(UserID.Text, PasswordOld.Text, Password.Text); if (!ret) { lblErrorMsg.Text = "Unable to change IP Commerce Password. " + ipc.ResponseText ; } else { Response.Redirect("~/admin/secure/settings/default.aspx?mode=ipcommerce"); } }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { IPCommerce ipc = new IPCommerce(); IPCommerceService ipcserv = new IPCommerceService(); ZNodeEncryption encrypt = new ZNodeEncryption(); ipc = ipcserv.GetByPortalID(ZNodeConfigManager.SiteConfig.PortalID); bool recordExists = false; if (ipc == null) { recordExists = false; ipc = new IPCommerce(); //delete config files string uc = Server.MapPath("~/data/default/config/ipcommerce_users.config"); string zc = Server.MapPath("~/data/default/config/ipcommerce_znode.config"); File.Delete(uc); File.Delete(zc); } else { recordExists = true; } ipc.PortalID = ZNodeConfigManager.SiteConfig.PortalID; ipc.IPPFSocketId = encrypt.EncryptData(SocketID.Text); ipc.MerchantLogin = encrypt.EncryptData(UserID.Text); ipc.MerchantPassword = encrypt.EncryptData(Password.Text); ipc.MerchantCity = txtBillingCity.Text; ipc.MerchantCountryCode = lstBillingCountryCode.SelectedItem.Text; ipc.MerchantCustServicePhone = PhoneNumber.Text; ipc.MerchantName = MerchantName.Text; ipc.MerchantPostalCode = txtBillingPostalCode.Text; ipc.MerchantSocketNum = SocketNumber.Text; ipc.MerchantStateProv = txtBillingState.Text; ipc.MerchantStoreId = StoreID.Text; ipc.MerchantStreet1 = txtBillingStreet1.Text; ipc.MerchantStreet2 = txtBillingStreet2.Text; ipc.Custom1 = SIC.Text.Trim(); // SIC Code ipc.Custom5 = SerialNumber.Text.Trim(); //Serial number ipc.Custom2 = chkCVVData.Checked.ToString(); ipc.Custom3 = chkAVSData.Checked.ToString(); //validate these settings with IP Commerce ZNode.Libraries.Payment.GatewayIPCommerce gwipc = new ZNode.Libraries.Payment.GatewayIPCommerce(ipc); //save to database if (gwipc.PaymentSolutionStatus == SecurePayments.Framework.PaymentSolutionStatus.ReadyToTransact) { Hashtable elementMapping = new Hashtable(); // Add elements to the hash table. There are no // duplicate keys, which contains xpath to retrieve value from provisioned data elementMapping.Add("/ppbcp:MerchId", ""); elementMapping.Add("/ppbcp:SIC", ""); elementMapping.Add("/ppbcp:SocketNum", ""); elementMapping.Add("/ppbcp:StoreId", ""); //retrieve data gwipc.GetMerchantInfo("CREDIT", elementMapping); ipc.MerchantSocketNum = elementMapping["/ppbcp:SocketNum"].ToString(); ipc.MerchantStoreId = elementMapping["/ppbcp:StoreId"].ToString(); ipc.Custom4 = elementMapping["/ppbcp:MerchId"].ToString(); // Merchant ID if (recordExists) { ipcserv.Save(ipc); } else { ipcserv.Insert(ipc); } Response.Redirect("~/admin/secure/settings/default.aspx?mode=ipcommerce"); } else { lblErrorMsg.Text = "Unable to configure IP Commerce Settings. Please verify the settings and try again. " + gwipc.ResponseText; } }