Ejemplo n.º 1
0
        public override void ProcessRequest()
        {
            string strRequest = context.Request.GetFromBodyString();

            //Set variables
            dynamic json = JObject.Parse(strRequest);

            Amount       = json.data.invoice.amount;
            Currency     = json.data.invoice.currency;
            State        = json.data.invoice.state;
            Id           = json.data.invoice.id;
            CustomFields = json.data.invoice.description;

            try
            {
                //Parse Args & CommandName
                var values        = HashingManager.Base64Decode(CustomFields);
                var splitedValues = values.Split('#');
                CommandName = splitedValues[0];
                Args        = splitedValues[1];

                //Check IPs
                //CheckIP();

                //Check security hash
                //CheckIncomeHash();

                //Check duplicated transactions
                CheckIfNotDoneYet(Id);

                //Check if we are the merchant
                //CheckMerchant(LocalBitcoinsAccountDetails.Exists(WalletId));

                //Check currency
                CheckCurrency(Currency);

                //Check status
                //CheckStatus(Status, "completed");

                if (!CheckInvoice())
                {
                    return;
                }

                //All OK, let's proceed
                Assembly    assembly = Assembly.GetAssembly(typeof(IIpnHandler));
                var         type     = assembly.GetType(CommandName, true, true);
                IIpnHandler command  = Activator.CreateInstance(type) as IIpnHandler;

                command.HandleLocalBitcoins(Args, Id, Amount);
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
                context.Response.Write(Id + "|error");
            }
        }
Ejemplo n.º 2
0
        public override void ProcessRequest()
        {
            string pre1 = context.Request["pre1"];
            string pre2 = context.Request["pre2"];

            pre1 = HashingManager.Base64Decode(pre1);
            string orderId    = pre1.Split('+')[0];
            string statusCode = pre1.Split('+')[1];

            string key = orderId + "+" + statusCode;

            key = HashingManager.Base64Encode(key);
            string md5String = HashingManager.GenerateMD5(key + PaparaAccountDetails.GetSecretKey());

            //Papara transaction OK check
            if (md5String == pre2)
            {
                //Set variables
                OrderID = orderId;

                try
                {
                    PaparaOrder Order = PaparaOrder.Get(Convert.ToInt32(OrderID));

                    Args          = Order.Args;
                    TransactionID = OrderID;
                    Amount        = Order.Amount.ToShortClearString();
                    CommandName   = Order.CommandName;

                    //Check duplicated transactions
                    CheckIfNotDoneYet(OrderID);

                    //All OK, let's proceed
                    Assembly    assembly = Assembly.GetAssembly(typeof(IIpnHandler));
                    var         type     = assembly.GetType(CommandName, true, true);
                    IIpnHandler command  = Activator.CreateInstance(type) as IIpnHandler;

                    command.HandlePapara(Args, TransactionID, Amount);

                    Order.IsPaid = true;
                    Order.Save();

                    context.Response.Redirect(ButtonGenerationStrategy.SUCCESS_URL);
                }
                catch (Exception ex)
                {
                    ErrorLogger.Log(ex);
                    context.Response.Redirect(ButtonGenerationStrategy.FAILURE_URL);
                }
            }
            else
            {
                context.Response.Redirect(ButtonGenerationStrategy.FAILURE_URL);
            }
        }
Ejemplo n.º 3
0
        public override void ProcessRequest()
        {
            //Set variables
            TransactionID   = context.Request["m_operation_id"];
            OrderID         = context.Request["m_orderid"];
            PaymentMethod   = context.Request["m_operation_ps"];
            SentHash        = context.Request["m_sign"];
            Amount          = context.Request["m_amount"];
            Currency        = context.Request["m_curr"];
            MerchantAccount = context.Request["m_shop"];
            Status          = context.Request["m_status"];
            Args            = context.Request["m_desc"];

            try
            {
                //Parse Args
                Args        = HashingManager.Base64Decode(Args);
                Args        = Args.Substring(Args.IndexOf("**") + 2);
                CommandName = Args.Substring(0, Args.IndexOf("#"));
                Args        = Args.Substring(Args.IndexOf("#") + 1);

                //Check IPs
                CheckIP("185.71.65.92,185.71.65.189,149.202.17.210");

                //Check security hash
                CheckIncomeHash();

                //Check duplicated transactions
                CheckIfNotDoneYet(TransactionID);

                //Check if we are the merchant
                CheckMerchant(PayeerAccountDetails.Exists(MerchantAccount));

                //Check currency
                CheckCurrency(Currency);

                //Check status
                CheckStatus(Status, "success");

                //All OK, let's proceed
                Assembly    assembly = Assembly.GetAssembly(typeof(IIpnHandler));
                var         type     = assembly.GetType(CommandName, true, true);
                IIpnHandler command  = Activator.CreateInstance(type) as IIpnHandler;

                command.HandlePayeer(Args, TransactionID, Amount);

                context.Response.Write(OrderID + "|success");
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
                context.Response.Write(OrderID + "|error");
            }
        }
Ejemplo n.º 4
0
        protected override void handle(string[] args, string transactionId, string amountSent, string from, string cryptoCurrencyInfo = "")
        {
            string username        = args[0];
            int    productId       = Convert.ToInt32(args[1]);
            int    quantity        = Convert.ToInt32(args[3]);
            string deliveryAddress = args[4];


            var    values     = args[5].Split('#');
            string email      = HashingManager.Base64Decode(values[0]);
            int?   promotorId = Convert.ToInt32(HashingManager.Base64Decode(values[1]));

            Money amount = Money.Parse(amountSent);

            BuyMarketplaceProduct(username, amount, from, transactionId, productId, quantity, deliveryAddress, email, promotorId, cryptoCurrencyInfo);
        }
Ejemplo n.º 5
0
        public override void ProcessRequest()
        {
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("https://checkout.okpay.com/ipn-verify");

            //Set values for the request back
            req.Method      = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            string strRequest = context.Request.GetFromBodyString();

            strRequest       += "&ok_verify=true";
            req.ContentLength = Encoding.UTF8.GetByteCount(strRequest);

            //Send the request to OKPAY and get the response
            string strResponse = "";

            using (StreamWriter streamOut = new StreamWriter(req.GetRequestStream()))
            {
                streamOut.Write(strRequest);
                streamOut.Close();
                using (StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()))
                {
                    strResponse = streamIn.ReadToEnd();
                    streamIn.Close();
                }
            }

            if (strResponse == "VERIFIED")
            {
                //Set variables
                TransactionID = context.Request["ok_ipn_id"];
                OrderID       = context.Request["ok_invoice"];
                PaymentMethod = context.Request["ok_txn_payment_method"];
                Amount        = context.Request["ok_txn_net"];
                Currency      = context.Request["ok_txn_currency"];
                WalletId      = context.Request["ok_receiver_wallet"];
                Status        = context.Request["ok_txn_status"];
                Args          = context.Request["ok_item_1_custom_2_value"];
                CommandName   = context.Request["ok_item_1_custom_1_value"];

                try
                {
                    //Parse Args
                    Args = HashingManager.Base64Decode(Args);

                    //Check IPs
                    //CheckIP();

                    //Check security hash
                    //CheckIncomeHash();

                    //Check duplicated transactions
                    CheckIfNotDoneYet(TransactionID);

                    //Check if we are the merchant
                    CheckMerchant(OKPayAccountDetails.Exists(WalletId));

                    //Check currency
                    CheckCurrency(Currency);

                    //Check status
                    CheckStatus(Status, "completed");

                    //All OK, let's proceed
                    Assembly    assembly = Assembly.GetAssembly(typeof(IIpnHandler));
                    var         type     = assembly.GetType(CommandName, true, true);
                    IIpnHandler command  = Activator.CreateInstance(type) as IIpnHandler;

                    command.HandleOKPay(Args, TransactionID, Amount);
                }
                catch (Exception ex)
                {
                    ErrorLogger.Log(ex);
                    context.Response.Write(OrderID + "|error");
                }
            }
            else if (strResponse == "INVALID")
            {
                context.Response.Write(OrderID + "|invalid");
            }
            else
            {
                context.Response.Write(OrderID + "|other");
            }
        }
Ejemplo n.º 6
0
        public override void ProcessRequest()
        {
            try
            {
                string secretKey = HashingManager.GenerateMD5(AppSettings.Offerwalls.UniversalHandlerPassword + "Neteller");

                string documentContents;
                using (Stream receiveStream = context.Request.InputStream)
                {
                    using (StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8))
                    {
                        documentContents = readStream.ReadToEnd();
                    }
                }

                JObject obj = JObject.Parse(documentContents);

                //Parse Args
                Status        = obj["eventType"].ToString();
                SentHash      = obj["key"].ToString();
                TransactionID = obj["id"].ToString();
                //Currency
                //Amount
                //Args?
                //CommandName

                Args        = HashingManager.Base64Decode(Args);
                Args        = Args.Substring(Args.IndexOf("**") + 2);
                CommandName = "Prem.PTC.Payments." + Args.Substring(0, Args.IndexOf("#"));
                Args        = Args.Substring(Args.IndexOf("#") + 1);

                //Check IPs
                //Not available in Neteller

                //Check hash
                CheckHash(secretKey, SentHash);

                //Check duplicated transactions
                CheckIfNotDoneYet(TransactionID);

                //Check if we are the merchant
                //Not available in Neteller

                //Check currency
                CheckCurrency(Currency);

                //Check status
                CheckStatus(Status, "order_payment_succeeded");

                //All OK, let's proceed
                Assembly    assembly = Assembly.GetAssembly(typeof(IIpnHandler));
                var         type     = assembly.GetType(CommandName, true, true);
                IIpnHandler command  = Activator.CreateInstance(type) as IIpnHandler;

                command.HandleNeteller(Args, TransactionID, Amount);

                context.Response.Write("OK");
            }
            catch (Exception ex)
            {
                ErrorLogger.Log(ex);
                context.Response.Write("Error");
            }
        }