コード例 #1
0
 public decimal getPrice(customer_account user = null)
 {
     if (user == null || !user.HasDiscount())
     {
         return this.price.Value;
     }
     return Math.Round(this.price.Value * 0.9m, 2);
 }
コード例 #2
0
 public decimal? GetPlayToken(customer_account user = null)
 {
     if (user == null || !user.HasDiscount())
         return this.play_token_amount;
     if (!this.price.HasValue)
         return null;
     var price = this.price.Value * (decimal)1.1;
     return Math.Round(price, 2);
 }
コード例 #3
0
        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;
        }