Beispiel #1
0
        protected void btnContinue2_Click(object sender, EventArgs e)
        {
            //save to db
            string strpassport = txtPassport1.Text + txtPassport2.Text + txtPassport3.Text + txtPassport4.Text + txtPassport5.Text + txtPassport6.Text + txtPassport7.Text + txtPassport8.Text + txtPassport9;
            int phonecountrycode2 = 0;
            if (ddlPhoneCountryCode2.SelectedIndex > -1)
            {
                phonecountrycode2 = Convert.ToInt32(ddlPhoneCountryCode2.SelectedValue);
            }
            int phonetype2 = 0;
            if (ddlPhoneType2.SelectedIndex > -1)
            {
                phonetype2 = Convert.ToInt32(ddlPhoneType2.SelectedValue);
            }

            Peerfx_DB.SPs.UpdateUsersInfo(user_key, txtAddress1.Text, txtAddress2.Text, txtCity.Text, txtState.Text, Convert.ToInt32(ddlCountrytab2.SelectedValue), txtpostalzipcode.Text, Convert.ToInt32(ddlPhoneCountryCode1.SelectedValue), Convert.ToInt32(ddlPhoneType1.SelectedValue), txtPhone1.Text, phonecountrycode2, phonetype2, txtPhone2.Text, Convert.ToInt32(ddlIdentityNationality.SelectedValue), txtOccupation.Text, strpassport,txtssn.Text.Replace("-","")).Execute();

            if (txtssn.Text.Length > 0)
            {
                //if entered ssn # then open bancbox account
                Peerfx.External_APIs.BancBox bb = new External_APIs.BancBox();
                Models.Users user = sitetemp.get_user_info(user_key);
                bb.OpenAccount(user);
            }

            //Check Passport info

            //mixpanel

            //send email

            //go to next screen
            changetab(2);
        }
Beispiel #2
0
        public void AdjustExternalBanks(Payment paymenttemp)
        {
            Users user_sender = get_user_info(paymenttemp.Requestor_user_key);
            Users user_treasury = get_treasury_account(1);
            External_APIs.BancBox bb = new External_APIs.BancBox();

            //Adjust Sender's ext banks
            if ((paymenttemp.Buy_currency == 3) && (user_sender.Bancbox_payment_object_key > 0) && (paymenttemp.Payment_object_receiver_type != 1)){ //USD & sender has BB
                bb.SendFunds_Internal(user_sender.User_key, user_treasury.User_key, paymenttemp.Buy_amount, "Adjust External Banks", false, 1, paymenttemp.Payments_Key);
            }

            //Adjust Receiver's ext banks
            if (paymenttemp.Payment_object_receiver_type == 3) //going to user's Balance
            {
                Users user_receiver = get_user_from_paymentobject(paymenttemp.Payment_object_receiver);
                if ((paymenttemp.Buy_currency == 3) && (user_receiver.Bancbox_payment_object_key > 0))
                {
                    bb.SendFunds_Internal(user_treasury.User_key, user_receiver.User_key, paymenttemp.Buy_amount, "Adjust External Banks", false, 1, paymenttemp.Payments_Key);
                }
            }
        }
Beispiel #3
0
        public void payment_complete(Payment paymenttemp)
        {
            int paymentkey = paymenttemp.Payments_Key;
            Int64 payment_payment_object_key = getpaymentobject(6, paymentkey);
            Users user_requestor = get_user_info(paymenttemp.Requestor_user_key);

            //Check if does not require manual export
            if (!paymenttemp.Requiresmanualexport)
            {
                Peerfx.External_APIs.SendGrid sg = new Peerfx.External_APIs.SendGrid();
                //Automatically complete payment

                //If Applicable - Ownership of funds is changing, so need to change ownership of funds in ext bank accounts , eg. bancbox
                AdjustExternalBanks(paymenttemp);

                if (paymenttemp.Payment_object_receiver_type == 3) //going to user balance
                {
                    Peerfx_DB.SPs.UpdateTransactionsInternal(0, 2, paymenttemp.Buy_currency, paymenttemp.Buy_amount, payment_payment_object_key, paymenttemp.Payment_object_receiver, get_ipaddress(), paymenttemp.Requestor_user_key, "From Payment to User Balance", 0, 1, paymentkey).Execute();
                    Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 5).Execute(); //payment delivered

                    //payment completed, send email
                    sg.Send_Email_Payment_Completed(paymenttemp.Payments_Key, user_requestor);
                }
                else if (paymenttemp.Payment_object_receiver_type == 7) //Embee top up
                {
                    //Send Top Up
                    EmbeeObject embeetemp = getEmbeeObject(paymenttemp.Payments_Key);
                    External_APIs.Embee embeecalls = new External_APIs.Embee();
                    int newtransid = embeecalls.RequestPurchase(embeetemp.Productid.ToString(), embeetemp.Phone, user_requestor.Email, get_ipaddress(), user_requestor.User_key, paymentkey);
                    Peerfx_DB.SPs.UpdateEmbeeNewtransid(newtransid, embeetemp.Embee_object_key).Execute();
                    Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 6).Execute();

                    Int64 embee_paymentobjectkey = getpaymentobject(7, embeetemp.Embee_object_key);
                    Peerfx_DB.SPs.UpdateTransactionsExternal(0, 1, paymenttemp.Buy_currency, paymenttemp.Buy_amount, payment_payment_object_key, embee_paymentobjectkey, get_ipaddress(), paymenttemp.Requestor_user_key, "From Payment to Embee Object", "", 0, 1, paymentkey).Execute();

                    //send receiver note
                    try
                    {
                        string thebody = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("/SMS/payment_confirmed_Embee.txt"));
                        thebody = thebody.Replace("FIRST_NAME", user_requestor.First_name);
                        thebody = thebody.Replace("LAST_NAME", user_requestor.Last_name);
                        thebody = thebody.Replace("TOPUP_NAME", embeetemp.Productname);

                        External_APIs.Twilio twillio = new External_APIs.Twilio();
                        twillio.SendSMS(embeetemp.Phone, thebody, embeetemp.Country);
                    }
                    catch
                    {
                    }
                }
                else if ((paymenttemp.Buy_currency == 3) && (user_requestor.Bancbox_payment_object_key > 0) && (IsBankAccount(paymenttemp.Payment_object_receiver)))
                {
                    //Send out money via Bancbox account
                    External_APIs.BancBox bb = new External_APIs.BancBox();
                    bb.SendFunds_External(user_requestor.User_key, paymenttemp.Payment_object_receiver, paymenttemp.Buy_amount, "External Transfer", false, 1, paymenttemp.Payments_Key);
                    Peerfx_DB.SPs.UpdateTransactionsExternal(0, 1, paymenttemp.Buy_currency, paymenttemp.Buy_amount, payment_payment_object_key, paymenttemp.Payment_object_receiver, get_ipaddress(), paymenttemp.Requestor_user_key, "From Payment to Ext US Bank", "", 0, 1, paymentkey).Execute();

                    //change status to Transaction Complete
                    Peerfx_DB.SPs.UpdatePaymentStatus(paymentkey, 5).Execute();

                    //payment in Payment Sent, send email
                    sg.Send_Email_Payment_Completed(paymenttemp.Payments_Key, user_requestor);
                }
            }
            else
            {
                //notify admin manual export is required

                //change status to processing transaction / awaiting withdrawl
                Peerfx_DB.SPs.UpdatePaymentStatus(paymenttemp.Payments_Key, 10).Execute();
            }
        }