Esempio n. 1
0
        /// <summary>
        /// Check if this is a special response
        /// If a special response then call the special response handler to modify the response xml
        /// </summary>
        /// <param name="responseData">The PaymentItems response string xml data</param>
        /// <returns>The response string xml data, modified if a special response else the inputed xml data</returns>
        public XmlDocument SpecialResponse(XmlDocument response, string noun, string verb, ServerStores serverStores)
        {
            MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();

            Dictionary <string, string> specialResponses = new Dictionary <string, string>();

            specialResponses.Add("GetUserInventory", "HangoutUsers");
            specialResponses.Add("PurchaseGameCurrencyPayPal", "HangoutPurchase");
            specialResponses.Add("PurchaseGameCurrencyCreditCard", "HangoutPurchase");
            specialResponses.Add("PurchaseItems", "HangoutUsers");

            string value = SpecialCommand(noun, verb, specialResponses);

            switch (value)
            {
            case "GetUserInventory":
                response = PaymentItemsSortFilter.AddItemsToUserInventory(response, serverStores);
                break;

            case "PurchaseItems":
                response = PaymentItemsSortFilter.AddAssetsToPurchaseResponse(response, serverStores);
                break;

            case "PurchaseGameCurrencyPayPal":
                moneyLog.PayPalLogResponse(response, "InProgress");
                break;

            case "PurchaseGameCurrencyCreditCard":
                moneyLog.CreditCardLogResponse(response);
                break;
            }

            return(response);
        }
        public string PayPalCallBack(string xmlInfo, string baseServicesRoot)
        {
            string response = "";

            try
            {
                XmlDocument callBackInfo = new XmlDocument();
                callBackInfo.LoadXml(xmlInfo);

                MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();
                moneyLog.PayPalLogResponse(callBackInfo, "CallBackBegin");

                XmlDocument callBackResponse = ProcessCallBack(xmlInfo, baseServicesRoot);

                moneyLog.PayPalLogResponse(callBackResponse, "CallBackComplete");

                response = parseCallBackResponse(callBackResponse);
            }

            catch (Exception ex)
            {
                mErrorLogger.Error("PayPalCallBack Error", ex);
            }

            return(response);
        }
Esempio n. 3
0
        public void PurchaseGameCurrencyZong(string piUserId, string hangoutUserId, string sessionGuid, string emailAddress, string offerDesc, string transactionRef, string ipAddress, string baseServicesRoot)
        {
            NameValueCollection logInfo = new NameValueCollection();

            logInfo.Add("userId", piUserId);
            logInfo.Add("transactionRef", transactionRef);
            logInfo.Add("externalTxnId", Guid.NewGuid().ToString());
            logInfo.Add("offerId", offerDesc);
            logInfo.Add("ipAddress", ipAddress);

            MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();

            moneyLog.LogMoneyPaymentCommand(hangoutUserId, sessionGuid, logInfo, emailAddress, "Zong");
        }
Esempio n. 4
0
        public string PurchaseGameCurrencyCreditCard(string transactionId, string piUserId, string hangoutUserId, string sessionGuid, string emailAddress, string offerId, CreditCardInfo creditCardInfo, string ipAddress, string baseServicesRoot)
        {
            PaymentCommand paymentCommand = CreatePurchaseGameCurrencyCreditCard(transactionId, piUserId, offerId, creditCardInfo, ipAddress);

            MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();

            moneyLog.LogMoneyPaymentCommand(hangoutUserId, sessionGuid, paymentCommand.Parameters, emailAddress, "CreditCard");

            XmlDocument xmlResponse = ProcessPaymentItem(paymentCommand, baseServicesRoot);

            moneyLog.CreditCardLogResponse(xmlResponse);

            return(ParseCreditCardResult(xmlResponse));
        }
Esempio n. 5
0
        public string PurchaseGameCurrencyPayPal(string piUserId, string hangoutUserId, string sessionGuid, string emailAddress, string offerId, string ipAddress, string baseServicesRoot)
        {
            PaymentCommand paymentCommand = CreatePurchaseGameCurrencyPayPal(piUserId, offerId, ipAddress);

            MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();

            moneyLog.LogMoneyPaymentCommand(hangoutUserId, sessionGuid, paymentCommand.Parameters, emailAddress, "Paypal");

            XmlDocument xmlResponse = ProcessPaymentItem(paymentCommand, baseServicesRoot);

            moneyLog.PayPalLogResponse(xmlResponse, "InProgress");
            string paypalURL = xmlResponse.SelectSingleNode("/Response/paypalURL").InnerText;

            return(paypalURL);
        }
Esempio n. 6
0
        public string GambitCallBack(string xmlInfo, string baseServicesRoot)
        {
            string response = "";

            try
            {
                XmlDocument callBackInfo = new XmlDocument();
                callBackInfo.LoadXml(xmlInfo);

                MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();
                moneyLog.GambitLogResponse(callBackInfo, "CallBackBegin");

                response = GambitAddMoneyToAccount(callBackInfo, baseServicesRoot);

                moneyLog.GambitLogResponse(callBackInfo, response);
            }

            catch (Exception ex)
            {
                mErrorLogger.Error("GambitCallBack Error", ex);
            }

            return(response);
        }
Esempio n. 7
0
        /// <summary>
        /// Parse the client PaymentItems Command
        /// Converts the client PaymentItems command to a PaymentItems command
        /// </summary>
        /// <param name="clientCommand">Client PaymentItems command</param>
        /// <returns>PaymentItems command</returns>
        private PaymentCommand ParseClientPaymentCommand(PaymentCommand clientCommand)
        {
            MoneyTransactionLogging moneyLog       = new MoneyTransactionLogging();
            PaymentCommand          paymentCommand = null;

            switch (clientCommand.Verb)
            {
            case "GetUserBalance":
                paymentCommand = CreateSimpleCommand("HangoutUsers", "GetUserBalance", clientCommand.Parameters);
                break;

            case "AddVirtualCoinForUser":
                paymentCommand = AddVirtualCoinForUser(clientCommand.Parameters);
                break;

            case "GetUserInventory":
                paymentCommand = GetUserInventory(clientCommand.Parameters);
                break;

            case "GetStoreInventory":
                paymentCommand = GetStoreInventory(clientCommand.Parameters);
                break;

            case "PurchaseOffers":
                paymentCommand = CreateSimpleCommand("HangoutPurchase", "PurchaseCashOffers", clientCommand.Parameters);
                break;

            case "PurchaseCoinOffers":
                paymentCommand = CreateSimpleCommand("HangoutPurchase", "PurchaseCoinOffers", clientCommand.Parameters);
                break;

            case "PurchaseItems":
                paymentCommand = PurchaseItems(clientCommand.Parameters, false);
                break;

            case "PurchaseItemsGift":
                paymentCommand = PurchaseItems(clientCommand.Parameters, true);
                break;

            case "PurchaseGameCurrencyPayPal":
                paymentCommand = PurchaseGameCurrencyPayPal(clientCommand.Parameters);
                moneyLog.LogMoneyPaymentCommand("", "", paymentCommand.Parameters, "", "Paypal");
                break;

            case "PurchaseGameCurrencyCreditCard":
                paymentCommand = PurchaseGameCurrencyCreditCard(clientCommand.Parameters);
                moneyLog.LogMoneyPaymentCommand("", "", paymentCommand.Parameters, "", "CreditCard");
                break;

            case "HealthCheck":
                paymentCommand      = new PaymentCommand();
                paymentCommand.Noun = "HangoutInfo";
                paymentCommand.Verb = "HealthCheck";
                break;

            case "SecurePaymentInfo":
                paymentCommand      = new PaymentCommand();
                paymentCommand.Noun = "HangoutUsers";
                paymentCommand.Verb = "SecurePaymentInfo";
                break;

            default:
                StateServerAssert.Assert(new System.Exception("Invalid Payment Items Command"));
                break;
            }

            return(paymentCommand);
        }
Esempio n. 8
0
        private void CallLogEvent(string externalTransactionId, string moneyType)
        {
            MoneyTransactionLogging transaction = new MoneyTransactionLogging();

            transaction.NotifyClientComplete(externalTransactionId, moneyType);
        }