private string CreateGTokenTransaction(coin_transaction coinTransaction, GtokenPackage package, customer_account user, decimal totalAmount) { var gTokenTransaction = GoPlayApi.Instance.CreateGTokenTransaction(new GTokenTransaction { username = CurrentUser.UserName, order_id = coinTransaction.order_id, original_price = package.getPrice(user), original_final_amount = totalAmount, original_currency = ConstantCommon.DEFAULT_PAYPAL_CURRENCY, currency = ConstantValues.S_CURRENCY_SGD, discount_percentage = user.HasDiscount() ? 0.1m : 0, payment_method = "PayPal", description = coinTransaction.description, status = ConstantValues.S_PENDING, revenue_percentage = decimal.Parse(ConfigurationManager.AppSettings["REVENUE_PERCENTAGE"].ToString()) }); if (!gTokenTransaction.Succeeded) { return string.Empty; } return gTokenTransaction.Data.transaction.gtoken_transaction_id; }
private coin_transaction GenerateCoinTransaction(GtokenPackage package = null) { bool debug = false; bool.TryParse(ConfigurationManager.AppSettings["UPOINT_DEBUG"], out debug); decimal? totalAmount = 0; decimal? gtokenAmount = 0; var transaction = new coin_transaction() { order_id = Guid.NewGuid().ToString(), customer_account_id = 3,//TODO/CurrentUser.Id, }; if (package != null) { transaction.gtoken_package_id = package.id; transaction.description = package.name; } if (!debug && package != null) { var user = GoPlayApi.Instance.GetUserById(CurrentUser.Id).Data; gtokenAmount = package.GetPlayToken(user); totalAmount = package.price; } transaction.amount = gtokenAmount; transaction.price = totalAmount; return transaction; }
private coin_transaction CreateCoinTransactionEntity(GtokenPackage package, decimal playTokenAmount, decimal totalAmount) { var transaction = new coin_transaction(); transaction.order_id = Guid.NewGuid().ToString(); transaction.customer_account_id = CurrentUser.Id; transaction.amount = playTokenAmount; transaction.price = totalAmount; transaction.payment_method = "PayPal"; transaction.gtoken_package_id = package.id; transaction.description = String.Format("You topped up {0} Play Token", Helper.displayDecimal(playTokenAmount)); transaction.status = "payment_pending"; transaction.use_gtoken = false; IPAddress ip = WebIpHelper.GetClientIp(Request); var country_name = String.Empty; ip.GetCountryCode(c => transaction.country_code = c, n => country_name = n); transaction.ip_address = ip.ToString(); return transaction; }