public BankAccounts gettxtfields() { BankAccounts ba = new BankAccounts(); ba.First_name = txtfirstname.Text; ba.Last_name = txtlastname.Text; ba.BIC = txtBankCode.Text; ba.Account_number = txtaccountnumber.Text; ba.ABArouting = txtABArouting.Text; ba.IBAN = txtIbanAccount.Text; ba.Sortcode = getSortCode(); ba.BSB = txtbsb.Text; ba.Email = txtemailreceiver.Text; ba.Currency_key = Convert.ToInt32(ddlcurrency.SelectedValue); ba.Currency_text = sitetemp.getcurrencycode(ba.Currency_key); ba.Bankname = txtbankname.Text; ba.Institutionnumber = txtinstitution.Text; ba.Branchcode = txtbranchcode.Text; if (ba.Currency_key == 5) { ba.Account_number = txtnzdaccount1.Text + txtnzdaccount2.Text + txtnzdaccount3.Text + txtnzdaccount4.Text; } ba.Islocalpayment = true; if (ba.Currency_key == 7) { ba.Islocalpayment = false; } return ba; }
protected void btncontinue1_Click(object sender, EventArgs e) { Hashtable hstemp = BankAccountEntry1.gettxtfields_hashtable(); mx.TrackEvent("Withdrawl - Attempted Initiated Payment", currentuser.User_key, hstemp); Boolean isvalid = false; if (ddlReceivers.SelectedValue == "0") { isvalid = BankAccountEntry1.ValidateBankAccount(); } else{ isvalid = true; } if (txtamount.Value == 0) { isvalid = false; lblerror.Visible = true; } if (isvalid) { lblerror.Visible = false; RadTabStrip1.SelectedIndex = 1; lblamount.Text = txtamount.Text; lblcurrency.Text = ddlcurrency.SelectedItem.Text; BankAccountEntry2.ViewasLabels(); BankAccounts ba = new BankAccounts(); if (ddlReceivers.SelectedValue == "0"){ ba = BankAccountEntry1.gettxtfields(); } else{ ba = sitetemp.getBankAccounts(0,Convert.ToInt64(ddlReceivers.SelectedValue)); } BankAccountEntry2.LoadFields(ba); RadMultiPage1.SelectedIndex = 1; mx.TrackEvent("Withdrawl - Initiated Payment", currentuser.User_key, hstemp); } }
private Hashtable ConvertBankAccountstoHashtable(BankAccounts ba) { Hashtable hstemp = new Hashtable(); //Bank account info string countrycode = sitetemp.getCountryValueFromCurrency(ba.Currency_key); hstemp.Add("nickname", ba.Currency_text + " Account"); hstemp.Add("acct_ccy", ba.Currency_text); hstemp.Add("beneficiary_name", ba.First_name + " " + ba.Last_name); hstemp.Add("destination_country_code", countrycode); if (ba.ABArouting != null) { if (ba.ABArouting != "") { hstemp.Add("aba", ba.ABArouting); } } if (ba.Account_number != null) { if (ba.Account_number != "") { hstemp.Add("acct_number", ba.Account_number); } } /* if (SingaporeBankCode.Length > 0) { hstemp.Add("bank_code", SingaporeBankCode); }*/ if (ba.Institutionnumber != null) { if (ba.Institutionnumber != "") { hstemp.Add("institution_no", ba.Institutionnumber); } } if (ba.Bankname != null) { if (ba.Bankname != "") { hstemp.Add("bank_name", ba.Bankname); } } if (ba.Branchcode != null) { if (ba.Branchcode != "") { hstemp.Add("branch_code", ba.Branchcode); } } if (ba.BIC != null) { if (ba.BIC != "") { hstemp.Add("bic_swift", ba.BIC); } } if (ba.BSB != null) { if (ba.BSB != "") { hstemp.Add("bsb_code", ba.BSB); } } if (ba.IBAN != null) { if (ba.IBAN != "") { hstemp.Add("iban", ba.IBAN); } } if (ba.Sortcode != null) { if (ba.Sortcode != "") { hstemp.Add("sort_code", ba.Sortcode); } } if (ba.Islocalpayment) { hstemp.Add("payment_type", "local"); } return hstemp; }
public string Validate_BankAccount(BankAccounts ba) { string currencycode = sitetemp.getcurrencycode(ba.Currency_key); string countrycode = sitetemp.getCountryValueFromCurrency(ba.Currency_key); Boolean isvalid = false; string strreturn = ""; string strstatus = "error"; Hashtable hstemp = ConvertBankAccountstoHashtable(ba); string strquery = sitetemp.ConvertHashtabletoString(hstemp); hstemp.Clear(); strstatus = CallWeb_Request("/beneficiary/validate_details?"+strquery, hstemp); try { JObject o = JObject.Parse(strstatus); string status = (string)o["status"]; if (status == "success") { isvalid = true; strreturn = "true"; } else { strreturn = (string)o["message"]; } } catch { strreturn = "error validating bank account"; } return strreturn; }
public Boolean Trade_Execute(int paymentkey) { Boolean tradesuccessful = false; Payment paymenttemp = sitetemp.getPayment(paymentkey); BankAccounts ba = new BankAccounts(); if (paymenttemp.Directlyfromcurrencycloud == 0) //comes back to our local bank accounts { int country = sitetemp.getCountryFromCurrency(paymenttemp.Buy_currency); ba = sitetemp.getBankAccounts(0, sitetemp.get_PaymentObject_AdminBankAccounts(paymenttemp.Buy_currency, country)); } else //goes directly to recipient's bank account { ba = sitetemp.getBankAccounts(0, paymenttemp.Payment_object_receiver); } string strstatus = "error"; Hashtable hstemp = ConvertBankAccountstoHashtable(ba); hstemp.Add("buy_currency", paymenttemp.Buy_currency_text); hstemp.Add("sell_currency", paymenttemp.Sell_currency_text); hstemp.Add("side", "1"); hstemp.Add("amount", paymenttemp.Buy_amount.ToString("F")); hstemp.Add("term_agreement", "true"); hstemp.Add("return_details", "true"); string strrequest = sitetemp.ConvertHashtabletoString(hstemp); strstatus = CallWeb_Request("/trade/execute_with_payment", hstemp); JObject o = JObject.Parse(strstatus); string status = (string)o["status"]; if (status == "success") { tradesuccessful = true; //record new tradeid JObject o2 = (JObject)o["data"]; string newtradeid = (string)o2["trade_id"]; JArray o3 = (JArray)o2["payments"]; string newccpaymentid = (string)o3[0]; Peerfx_DB.SPs.UpdateCurrencyCloudTrades(paymentkey, newtradeid,newccpaymentid).Execute(); Peerfx_DB.SPs.UpdatePaymentStatus(paymenttemp.Payments_Key, 9).Execute(); Peerfx_DB.SPs.DeleteCurrencyCloudTradesErrors(paymenttemp.Payments_Key).Execute(); } else { tradesuccessful = false; string message = (string)o["message"]; Peerfx_DB.SPs.UpdateCurrencyCloudTradesErrors(paymentkey, strrequest, strstatus).Execute(); } return tradesuccessful; }
public void LoadFields(BankAccounts ba) { CloseAllPanels(); if (ba.Currency_key != 0) { ddlcurrency.SelectedValue = ba.Currency_key.ToString(); lblcurrencylabels.Text = sitetemp.getcurrencycode(ba.Currency_key); } UpdateRequiredFields(); if (ba.First_name != null) { txtfirstname.Text = ba.First_name; lblfullname.Text = ba.First_name; } if (ba.Last_name != null) { txtlastname.Text = ba.Last_name; lblfullname.Text += " " + ba.Last_name; } if (ba.Account_number != null) { if (ba.Currency_key == 5) //NZD { if (ba.Account_number.Length >= 2) { txtnzdaccount1.Text = ba.Account_number.Substring(0, 2); lblnzdaccount.Text = ba.Account_number; } if (ba.Account_number.Length >= 6) { txtnzdaccount2.Text = ba.Account_number.Substring(2, 4); } if (ba.Account_number.Length >= 13) { txtnzdaccount3.Text = ba.Account_number.Substring(6, 7); } if (ba.Account_number.Length >= 16) { txtnzdaccount4.Text = ba.Account_number.Substring(13, 3); } } else { txtaccountnumber.Text = ba.Account_number; lblaccountnumber.Text = ba.Account_number; } } if (ba.IBAN != null) { txtIbanAccount.Text = ba.IBAN; lblIbanAccount.Text = ba.IBAN; } if (ba.BIC != null) { txtBankCode.Text = ba.BIC; lblBankCode.Text = ba.BIC; } if (ba.ABArouting != null) { txtABArouting.Text = ba.ABArouting; lblABArouting.Text = ba.ABArouting; } if (ba.Sortcode != null) { if (ba.Sortcode.Length >= 2) { txtsortcode1.Text = ba.Sortcode.Substring(0, 2); } if (ba.Sortcode.Length >= 4) { txtsortcode2.Text = ba.Sortcode.Substring(2, 2); } if (ba.Sortcode.Length >= 6) { txtsortcode3.Text = ba.Sortcode.Substring(4, 2); } lblsortcode.Text = ba.Sortcode; } if (ba.BSB != null) { txtbsb.Text = ba.BSB; lblbsb.Text = ba.BSB; } if (ba.Email != null) { txtemailreceiver.Text = ba.Email; lblemailreceiver.Text = ba.Email; lblemailword.Visible = true; } if (ba.Bankname != null) { txtbankname.Text = ba.Bankname; lblbankname.Text = ba.Bankname; } if (ba.Institutionnumber != null) { txtinstitution.Text = ba.Institutionnumber; lblinstitution.Text = ba.Institutionnumber; } if (ba.Branchcode != null) { txtbranchcode.Text = ba.Branchcode; lblinstitution.Text = ba.Branchcode; } }
public BankAccounts getBankAccounts(int bankaccountkey, Int64 paymentkey) { DataSet dstemp = new DataSet(); BankAccounts tempbankaccount = new BankAccounts(); if (bankaccountkey > 0) { dstemp = Peerfx_DB.SPs.ViewBankAccountsSpecific(bankaccountkey).GetDataSet(); tempbankaccount.Bank_account_key = bankaccountkey; if (dstemp.Tables[0].Rows[0]["payment_object_key"] != DBNull.Value) { tempbankaccount.Payment_object_key = Convert.ToInt64(dstemp.Tables[0].Rows[0]["payment_object_key"]); } } else if (paymentkey > 0) { tempbankaccount.Payment_object_key = paymentkey; dstemp = Peerfx_DB.SPs.ViewBankAccountsSpecificPaymentkey(paymentkey).GetDataSet(); if (dstemp.Tables[0].Rows[0]["bank_account_key"] != DBNull.Value) { tempbankaccount.Bank_account_key = Convert.ToInt32(dstemp.Tables[0].Rows[0]["bank_account_key"]); } } Boolean islocalpayment = false; if (dstemp.Tables[0].Rows[0]["payment_object_type"] != DBNull.Value) { tempbankaccount.Payment_object_type = Convert.ToInt32(dstemp.Tables[0].Rows[0]["payment_object_type"]); } if (dstemp.Tables[0].Rows[0]["date_created"] != DBNull.Value) { tempbankaccount.Date_created = Convert.ToDateTime(dstemp.Tables[0].Rows[0]["date_created"]); } if (dstemp.Tables[0].Rows[0]["user_key"] != DBNull.Value) { tempbankaccount.User_key = Convert.ToInt32(dstemp.Tables[0].Rows[0]["user_key"]); } if (dstemp.Tables[0].Rows[0]["organization_key"] != DBNull.Value) { tempbankaccount.Organization_key = Convert.ToInt32(dstemp.Tables[0].Rows[0]["organization_key"]); } if (dstemp.Tables[0].Rows[0]["bank_account_description"] != DBNull.Value) { tempbankaccount.Bank_account_description = dstemp.Tables[0].Rows[0]["bank_account_description"].ToString(); } if (dstemp.Tables[0].Rows[0]["user_key_updated"] != DBNull.Value) { tempbankaccount.User_key_updated = Convert.ToInt32(dstemp.Tables[0].Rows[0]["user_key_updated"]); } if (dstemp.Tables[0].Rows[0]["ip_address"] != DBNull.Value) { tempbankaccount.Ip_address = dstemp.Tables[0].Rows[0]["ip_address"].ToString(); } if (dstemp.Tables[0].Rows[0]["business_name"] != DBNull.Value) { tempbankaccount.Business_name = dstemp.Tables[0].Rows[0]["business_name"].ToString(); } if (dstemp.Tables[0].Rows[0]["last_changed"] != DBNull.Value) { tempbankaccount.Last_changed = Convert.ToDateTime(dstemp.Tables[0].Rows[0]["last_changed"]); } if (dstemp.Tables[0].Rows[0]["bank_account_info"] != DBNull.Value) { tempbankaccount.Bank_account_info = dstemp.Tables[0].Rows[0]["bank_account_info"].ToString(); } if (dstemp.Tables[0].Rows[0]["organization_name"] != DBNull.Value) { tempbankaccount.Organization_name = dstemp.Tables[0].Rows[0]["organization_name"].ToString(); } if (dstemp.Tables[0].Rows[0]["country_text"] != DBNull.Value) { tempbankaccount.Country_text = dstemp.Tables[0].Rows[0]["country_text"].ToString(); } if (dstemp.Tables[0].Rows[0]["currency_text"] != DBNull.Value) { tempbankaccount.Currency_text = dstemp.Tables[0].Rows[0]["currency_text"].ToString(); } if (dstemp.Tables[0].Rows[0]["first_name"] != DBNull.Value) { tempbankaccount.First_name = dstemp.Tables[0].Rows[0]["first_name"].ToString(); } if (dstemp.Tables[0].Rows[0]["last_name"] != DBNull.Value) { tempbankaccount.Last_name = dstemp.Tables[0].Rows[0]["last_name"].ToString(); } if (dstemp.Tables[0].Rows[0]["account_number"] != DBNull.Value) { tempbankaccount.Account_number = dstemp.Tables[0].Rows[0]["account_number"].ToString(); } if (dstemp.Tables[0].Rows[0]["IBAN"] != DBNull.Value) { tempbankaccount.IBAN = dstemp.Tables[0].Rows[0]["IBAN"].ToString(); islocalpayment = true; } if (dstemp.Tables[0].Rows[0]["BIC"] != DBNull.Value) { tempbankaccount.BIC = dstemp.Tables[0].Rows[0]["BIC"].ToString(); } if (dstemp.Tables[0].Rows[0]["ABArouting"] != DBNull.Value) { tempbankaccount.ABArouting = dstemp.Tables[0].Rows[0]["ABArouting"].ToString(); islocalpayment = true; } if (dstemp.Tables[0].Rows[0]["BSB"] != DBNull.Value) { tempbankaccount.BSB = dstemp.Tables[0].Rows[0]["BSB"].ToString(); islocalpayment = true; } if (dstemp.Tables[0].Rows[0]["SortCode"] != DBNull.Value) { tempbankaccount.Sortcode = dstemp.Tables[0].Rows[0]["SortCode"].ToString(); islocalpayment = true; } if (dstemp.Tables[0].Rows[0]["email"] != DBNull.Value) { tempbankaccount.Email = dstemp.Tables[0].Rows[0]["email"].ToString(); } if (dstemp.Tables[0].Rows[0]["currency_key"] != DBNull.Value) { tempbankaccount.Currency_key = Convert.ToInt32(dstemp.Tables[0].Rows[0]["currency_key"].ToString()); } if (dstemp.Tables[0].Rows[0]["bank_name"] != DBNull.Value) { tempbankaccount.Bankname = dstemp.Tables[0].Rows[0]["bank_name"].ToString(); } if (dstemp.Tables[0].Rows[0]["branch_code"] != DBNull.Value) { tempbankaccount.Branchcode = dstemp.Tables[0].Rows[0]["branch_code"].ToString(); } if (dstemp.Tables[0].Rows[0]["institution_number"] != DBNull.Value) { tempbankaccount.Institutionnumber = dstemp.Tables[0].Rows[0]["institution_number"].ToString(); } tempbankaccount.Islocalpayment = islocalpayment; return tempbankaccount; }