コード例 #1
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");
        }
コード例 #2
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));
        }
コード例 #3
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);
        }
コード例 #4
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);
        }