コード例 #1
0
        private async Task <NotifEyeTransactionInfo> GetNotifEyePaymentDetails()
        {
            var notifEyeTransaction = new NotifEyeTransactionInfo();

            var user = await _iHttpContextProvider.GetCurrentUser();

            if (user != null && user.Account != null && user.Account.Count > 0)
            {
                AccountSensors accountSensor = new AccountSensors();
                accountSensor.AccountID             = user.Account[0].AccountID;
                accountSensor.NumSensors            = user.Account[0].NumSensors;
                notifEyeTransaction.AccountID       = user.Account[0].AccountID;
                notifEyeTransaction.PrimaryUserName = user.Account[0].UserFullName;
                notifEyeTransaction.Address         = AppUtility.PrepareAddress(user.Account[0].Address, user.Account[0].Address2, user.Account[0].State, user.Account[0].PostalCode, user.Account[0].Country);
                notifEyeTransaction.Email           = user.Account[0].EmailAddress;
                notifEyeTransaction.AccountName     = user.Account[0].CompanyName;
                notifEyeTransaction.CustomerID      = user.Account[0].AccountID;
                notifEyeTransaction.CustomerName    = user.UserName;
                notifEyeTransaction.NumberOfSensor  = user.Account[0].NumSensors;
                notifEyeTransaction.OldRenewalDate  = user.Account[0].SubscriptionExpiry;
                notifEyeTransaction.NewRenewalDate  = user.Account[0].SubscriptionExpiry.AddDays(365);
                var stateTax = await _taxableStateClient.GetTaxableStatebyStateCode(user.Account[0].State);

                notifEyeTransaction.SubscriptionAmount = _accountApplicationService.GetSensorAmount(accountSensor) * 100;
                notifEyeTransaction.TaxString          = stateTax != null?stateTax.Tax.ToString() : "0";

                notifEyeTransaction.TaxAmount = await _accountApplicationService.GetTaxAmount(notifEyeTransaction.SubscriptionAmount, user.Account[0].PostalCode);

                notifEyeTransaction.TotalAmount = await _accountApplicationService.GetSensorAnnualFee(accountSensor, user.Account[0].PostalCode) * 100;
            }
            return(notifEyeTransaction);
        }