コード例 #1
0
 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;
 }