public Boolean ParallelPayment(bool Live_Trial, gift giftinfo, string receiveremail) { Boolean txcompleted = false; BaseAPIProfile profile2 = new BaseAPIProfile(); int Tx_Key = giftinfo.txkey; Site sitetemp = new Site(); Transactions txinfo = sitetemp.Gettx(giftinfo.txkey); ////Three token profile2.APIProfileType = ProfileType.ThreeToken; string blueikonemail = ""; if (Live_Trial)//true = Live , false = trial { profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString(); blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Live").ToString(); } else { profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString(); profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString(); profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString(); profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString(); profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString(); blueikonemail = ConfigurationManager.AppSettings.Get("My_Email_Trial").ToString(); } /*profile2.RequestDataformat = "SOAP11"; profile2.ResponseDataformat = "SOAP11"; */ profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]); string url = ConfigurationManager.AppSettings.Get("Callback").ToString() + "/"; string returnURL = url + "Order_Confirmation.aspx?Tx_key=" + Tx_Key.ToString(); string cancelURL = url + "Order_Confirmation.aspx?Tx_key=0"; PayRequest payRequest = null; payRequest = new PayRequest(); payRequest.cancelUrl = cancelURL; payRequest.returnUrl = returnURL; payRequest.reverseAllParallelPaymentsOnError = true; //payRequest.senderEmail = email.Value; //payRequest.clientDetails = new ClientDetailsType(); //payRequest.clientDetails = ClientInfoUtil.getMyAppDetails(); payRequest.feesPayer = "SENDER";//feesPayer.Value; payRequest.memo = "BlueIkons";// memo.Value; payRequest.actionType = "PAY"; payRequest.currencyCode = "USD"; //currencyCode.Items[currencyCode.SelectedIndex].Value; payRequest.requestEnvelope = new RequestEnvelope(); payRequest.requestEnvelope.errorLanguage = "en_US";//ClientInfoUtil.getMyAppRequestEnvelope(); payRequest.preapprovalKey = txinfo.pakey; payRequest.receiverList = new Receiver[2]; payRequest.receiverList[0] = new Receiver(); payRequest.receiverList[0].amount = decimal.Round(giftinfo.amount,2);//amount_0.Value); payRequest.receiverList[0].email = receiveremail;//receiveremail_0.Value; decimal blueikonamount = (giftinfo.amount * Convert.ToDecimal(.1)); if (receiveremail != blueikonemail) { payRequest.receiverList[1] = new Receiver(); payRequest.receiverList[1].amount = decimal.Round(blueikonamount, 2); payRequest.receiverList[1].email = blueikonemail; } else { payRequest.receiverList[0].amount += decimal.Round(blueikonamount, 2); } //Eventomatic_DB.SPs.UpdateTransactionTicketAmountEmail(Tx_Key, strEmail1).Execute(); profile2.ResponseDataformat = "SOAP11"; profile2.RequestDataformat = "SOAP11"; AdapativePayments ap = new AdapativePayments(); ap.APIProfile = profile2; PayResponse PResponse = ap.pay(payRequest); if (ap.isSuccess.ToUpper() == "FAILURE") { //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError; for (int i = 0; i <= ap.LastError.ErrorDetails.Length - 1; i++) { FaultDetailFaultMessageError ETtemp = (FaultDetailFaultMessageError)ap.LastError.ErrorDetails.GetValue(i); //decimal OverallTotal = decimal.Round(dcAmount1, 2) + decimal.Round(dcAmount2, 2); //Eventomatic_DB.SPs.UpdateCCErrors(ETtemp.message.ToString(), Tx_Key, 2, OverallTotal.ToString()).Execute(); } //HttpContext.Current.Response.Redirect("APIError.aspx", false); } else { //Payment went through BlueIkons_DB.SPs.UpdateTransaction(Tx_Key, 0, 0, 0, 3, PResponse.responseEnvelope.correlationId, receiveremail).Execute(); txcompleted = true; } return txcompleted; }
public gift GetGiftInfo(int Gift_Key) { gift tempgift = new gift(); DataSet dstemp = BlueIkons_DB.SPs.ViewGift(Gift_Key).GetDataSet(); tempgift.Gift_Key = Gift_Key; if (dstemp.Tables[0].Rows[0]["sender_fbid"] != DBNull.Value) { tempgift.sender_fbid = Convert.ToInt64(dstemp.Tables[0].Rows[0]["sender_fbid"]); } if (dstemp.Tables[0].Rows[0]["receiver_fbid"] != DBNull.Value) { tempgift.receiver_fbid = Convert.ToInt64(dstemp.Tables[0].Rows[0]["receiver_fbid"]); } if (dstemp.Tables[0].Rows[0]["receiver_email"] != DBNull.Value) { tempgift.receiver_email = dstemp.Tables[0].Rows[0]["receiver_email"].ToString(); } if (dstemp.Tables[0].Rows[0]["witty_message"] != DBNull.Value) { tempgift.witty_message = dstemp.Tables[0].Rows[0]["witty_message"].ToString(); } if (dstemp.Tables[0].Rows[0]["created_date"] != DBNull.Value) { tempgift.created_date = Convert.ToDateTime(dstemp.Tables[0].Rows[0]["created_date"]); } if (dstemp.Tables[0].Rows[0]["blueikon"] != DBNull.Value) { tempgift.blueikon = Convert.ToInt32(dstemp.Tables[0].Rows[0]["blueikon"]); } if (dstemp.Tables[0].Rows[0]["fbpost"] != DBNull.Value) { tempgift.fbpost = Convert.ToBoolean(dstemp.Tables[0].Rows[0]["fbpost"]); } if (dstemp.Tables[0].Rows[0]["receiver_name"] != DBNull.Value) { tempgift.receiver_name = dstemp.Tables[0].Rows[0]["receiver_name"].ToString(); } dstemp = BlueIkons_DB.SPs.ViewTransactionsGiftKey(Gift_Key).GetDataSet(); if (dstemp.Tables[0].Rows[0]["Amount"] != DBNull.Value) { tempgift.amount = Convert.ToDecimal(dstemp.Tables[0].Rows[0]["Amount"]); } if (dstemp.Tables[0].Rows[0]["Tx_Key"] != DBNull.Value) { tempgift.txkey = Convert.ToInt32(dstemp.Tables[0].Rows[0]["Tx_Key"]); } return tempgift; }