예제 #1
0
파일: Tnet_Recharge.cs 프로젝트: Baiqu/User
        public bool ListByUserId_AccountType(int userId, eBankAccountType accountType)
        {
            string condition = string.Format("{0}=:{0} AND {1}=:{1} ORDER BY {2} DESC", Tnet_Recharge._RECHARGE_TYPE, Tnet_Recharge._USER_ID, Tnet_Recharge._CREATE_TIME);

            AddParameter(Tnet_Recharge._RECHARGE_TYPE, accountType);
            AddParameter(Tnet_Recharge._USER_ID, userId);
            return(ListByCondition(condition));
        }
예제 #2
0
 public RechargeOrderCreationProvider(int userId, eBankAccountType rechargeType, PayType payType, decimal amount, string notifyUrl)
 {
     this._userId       = userId;
     this._rechargeType = rechargeType;
     this._payType      = payType;
     this._amount       = amount;
     this._notifyUrl    = notifyUrl;
 }
예제 #3
0
        /// <summary>
        /// 获取账单
        /// </summary>
        /// <returns></returns>
        public ActionResult List(TradeDetailsArgs arg)
        {
            UserPurseProvider upp = new UserPurseProvider();
            FuncResult <Winner.Balance.WebService.Client.Modes.UserPurse> purseResult = null;
            eBankAccountType acctType = (eBankAccountType)arg.AccountType;

            switch (acctType)
            {
            case eBankAccountType.金币:
                purseResult = upp.UserGoldCoinPurse(Package.UserId);
                break;

            case eBankAccountType.现金:
                purseResult = upp.UserCashPurse(Package.UserId);
                break;
            }
            if (purseResult == null)
            {
                return(Json(FuncResult.FailResult("未找到账单信息", (int)ApiStatusCode.DATA_QUERY_FAIL)));
            }

            if (!purseResult.Success)
            {
                return(Json(purseResult));
            }

            QueryProvider qp             = new QueryProvider();
            var           purseHisResult = qp.PurseHis(purseResult.Content.PurseCode, null, arg.PageIndex, arg.PageSize, arg.StartDate, arg.EndDate);

            if (!purseHisResult.Success)
            {
                return(Json(purseHisResult));
            }
            FuncResult <object> listResult = new FuncResult <object>();

            listResult.Success    = true;
            listResult.Message    = null;
            listResult.StatusCode = 1;
            if (purseHisResult.Content != null && purseHisResult.Content.Data != null)
            {
                List <object> list = new List <object>();
                foreach (var item in purseHisResult.Content.Data)
                {
                    var li = new
                    {
                        Createtime = item.Createtime,
                        Amount     = item.Amount,
                        Remarks    = item.Remarks
                    };
                    list.Add(li);
                }
                listResult.Content = PageList <object> .Instance(arg.PageIndex, arg.PageSize, purseHisResult.Content.Count, list);
            }
            return(Json(listResult));
        }
예제 #4
0
        private bool DoRechargeTransfer(int userId, Currency currency, eBankAccountType accountType, string remarks, out int transferId)
        {
            bool result = false;

            transferId = -1;
            switch (accountType)
            {
            case eBankAccountType.金币:
                result = RechargeGoldCoin(userId, currency, remarks, out transferId);
                break;

            case eBankAccountType.现金:
                result = RechargeCash(userId, currency, remarks, out transferId);
                break;
            }
            return(result);
        }
예제 #5
0
        /// <summary>
        /// Sets up the CustomerAccount to pay for services on a recurring basis
        /// using a credit card.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        public void ActivateRecurringUsingDirectDebit(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.RecurringCheck,
                this.m_can.AccountNumber16);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.RecurringDirectDebit;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    int intStatementCode = 0;
                    try{ intStatementCode = int.Parse(m_can.StatementCode); }
                    catch { /*don't care*/ }

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00074 inl74 =
                        new INL00074Helper(dal.GetMopByUserPaymentType(UserName, (int)ept),
                                           strBankAccountNumber, strBankRouteNumber, strCustomerName,
                                           (char)TypeDescriptor.GetConverter(typeof(eBankAccountType)).ConvertTo(ebatAccountType, typeof(char)),
                                           intStatementCode, false);
                    Request.MAC00027 mac27 = new Mac00027Helper(SiteId.ToString(),
                                                                m_can.AccountNumber9, CmConstant.kstrDefaultTaskCode, inl74);

                    this.Invoke((Request.MAC00027)mac27);
                }
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                }
            }
        }
예제 #6
0
        /// <summary>
        /// This method provides functionality to pay a statement using
        /// electronic check as the method of payment.
        /// </summary>
        /// <param name="strCustomerName"></param>
        /// <param name="strBankRouteNumber"></param>
        /// <param name="strBankAccountNumber"></param>
        /// <param name="ebatAccountType"></param>
        /// <param name="dblAmount"></param>
        /// <returns></returns>
        public PaymentReceipt PayUsingElectronicCheck(
            string strCustomerName,
            [RequiredItem()][StringLength(1, 9)][NumericAttribute()] string strBankRouteNumber,
            [RequiredItem()][StringLength(1, 20)] string strBankAccountNumber,
            [RequiredItem()] eBankAccountType ebatAccountType,
            [RequiredItem()][DoubleRange(0.00, 9999999.99)] double dblAmount)
        {
            BillingLogEntry logEntry = new BillingLogEntry(
                eBillingActivityType.PayCheck,
                this.m_can.AccountNumber16, dblAmount);

            using (Log log = CreateLog(logEntry))
            {
                try
                {
                    // validate the parameters.
                    MethodValidator validator = new MethodValidator(MethodBase.GetCurrentMethod(),
                                                                    strCustomerName, strBankRouteNumber, strBankAccountNumber, ebatAccountType, dblAmount);
                    validator.Validate();

                    // In this case, we are hard-coding the payment type
                    ePaymentType ept = ePaymentType.ElectronicCheck;
                    logEntry.PaymentType = ept;

                    // set the siteId information
                    logEntry.SiteId = SiteId;

                    //use stopped check dal to verfiy the account does not have a stop on it
                    DalStoppedCheck dalSC = new DalStoppedCheck();
                    if (dalSC.IsStoppedCheck(strBankRouteNumber, strBankAccountNumber))
                    {
                        //the account has a stop placed on it
                        throw new MopAuthorizationFailedException(string.Format(__stoppedCheckErrorMessage + "\nBank Routing Number: {0} \nBank Account Number: {1}", strBankRouteNumber, strBankAccountNumber));
                    }

                    checkNSFStatus(false);

                    // Create a DAL to transalate Mop codes
                    DalMethodOfPayment dal = new DalMethodOfPayment();
                    DalPaymentReceipt  dalPaymentReceipt = new DalPaymentReceipt();

                    string paymentReceiptType = dalPaymentReceipt.GetPaymentReceiptType(_userId);
                    paymentReceiptType = paymentReceiptType == string.Empty?CmConstant.kstrDefaultReceiptType:paymentReceiptType;

                    PaymentReceipt rcpt = new PaymentReceipt();

                    // need to get the customer's name.
                    if (strCustomerName != null)
                    {
                        strCustomerName = strCustomerName.Trim();
                    }
                    if (strCustomerName == null || strCustomerName.Length == 0)
                    {
                        DalAccount dalAccount = new DalAccount();
                        CustomerAccountSchema.CustomerName custName =
                            dalAccount.GetCustomerName(_siteId, _siteCode, m_can.AccountNumber9);
                        if (custName == null)
                        {
                            throw new InvalidAccountNumberException();
                        }
                        strCustomerName = (string)new CustomerName(custName.FirstName, custName.MiddleInitial, custName.LastName);
                        if (strCustomerName == null || strCustomerName.Length == 0)
                        {
                            strCustomerName = CmConstant.kstrDefaultAccountTitle;
                        }
                    }

                    // assure that the length of the customer name does NOT exceed 32 characters!
                    if (strCustomerName.Length >= 32)
                    {
                        strCustomerName = strCustomerName.Substring(0, 31);
                    }

                    // Build input elements
                    Request.INL00047 inl47 = new INL00047Helper(dblAmount, dblAmount,
                                                                (eBankAccountType.Checking == ebatAccountType)?
                                                                CmConstant.kstrAccountTypeChecking:
                                                                CmConstant.kstrAccountTypeSavings,
                                                                CmConstant.kstrNegative, strBankRouteNumber, strBankAccountNumber,
                                                                strCustomerName, dal.GetMopByUserPaymentType(
                                                                    UserName, (int)ept), CmConstant.kstrNegative, m_can.StatementCode,
                                                                paymentReceiptType, CmConstant.kstrDefaultWorkstation);

                    Request.MAC00027 mac27 =
                        new Mac00027Helper(SiteId.ToString(), m_can.AccountNumber9,
                                           CmConstant.kstrDefaultTaskCode, inl47);

                    // Use inherited functions to get a response
                    Response.MAC00027 mac27Response = (Response.MAC00027)
                                                      this.Invoke((Request.MAC00027)mac27);
                    Response.INL00047 inl47Response = mac27Response.Items[0] as Response.INL00047;

                    int intErrorCode = toInt32(inl47Response.IGIRTRNCODE);
                    if (intErrorCode > 0)
                    {
                        throw TranslateCmException(
                                  intErrorCode,
                                  string.Format("Authorization failed with error - ErrorCode: {0} ErrorText: {1}",
                                                inl47Response.IGIRTRNCODE,
                                                inl47Response.IGIMESGTEXT),
                                  null);
                    }

                    rcpt.AccountNumber16 = m_can.AccountNumber16;
                    rcpt.AmountPaid      = (inl47Response.AMNTTOAPLYUSR.Length > 0) ? Double.Parse(inl47Response.AMNTTOAPLYUSR): 0.00;
                    rcpt.PaymentType     = ePaymentType.ElectronicCheck;
                    rcpt.Status          = ePaymentStatus.Success;
                    rcpt.TransactionDate = new IcomsDate(inl47Response.ATHRZTNDATE).Date;

                    return(rcpt);
                }                 // try
                catch (BusinessLogicLayerException blle)
                {
                    //the dal threw an exception
                    logEntry.SetError(blle.Message);
                    throw;
                }
                catch (DataSourceException excDSE)
                {
                    //the dal threw an exception
                    logEntry.SetError(excDSE.Message);
                    throw new DataSourceUnavailableException(excDSE);
                }
                catch (CmErrorException excCm)
                {
                    logEntry.SetError(excCm.Message, excCm.ErrorCode);
                    throw TranslateCmException(excCm);
                }                 // catch( CmErrorException excCm )
                catch (Exception exc)
                {
                    logEntry.SetError(exc.Message);
                    throw;
                } // catch( Exception exc )
            }     // using( Log log =  )
        }         // PayUsingElectronicCheck()