コード例 #1
0
ファイル: CreditCardService.cs プロジェクト: sun2dar/MKCRMApi
        public static CreditCardRetrieveMultipleStatementDate RetrieveCreditCardStatementDates(Params request)
        {
            CreditCardRetrieveMultipleStatementDate response = new CreditCardRetrieveMultipleStatementDate();

            try
            {
                if (request.Parameter.ContainsKey("cardNo"))
                {
                    string cardNo = request.Parameter["cardNo"];
                    CreditCardInformation information = RetrieveCreditCardDetail(cardNo, RetrieveCreditCardType(cardNo));
                    if (!string.IsNullOrEmpty(information.CustomerNo))
                    {
                        request.Parameter.Add("custNo", information.CustomerNo);
                    }
                }

                if (request.Parameter.ContainsKey("custNo"))
                {
                    Params param = new Params()
                    {
                        Parameter = new Dictionary <string, string>()
                    };
                    param.RequestTransType = "GetHistoryCreditCardTransaction";
                    param.Parameter.Add("custNo", request.Parameter["custNo"]);
                    param.WSDL = "CCStatementDateHistory";
                    ESBData data = EAI.RetrieveESBData(param);

                    if (data.Result != null && data.Result.Count != 0)
                    {
                        response.MinimumPayment = Formatter.GetParsedDouble(data.Result[0]["minPayment"], false);
                        response.Name           = data.Result[0]["name1"];
                        response.Address1       = data.Result[0]["addr1"];
                        response.Address2       = data.Result[0]["addr2"];
                        response.City           = data.Result[0]["city"];
                    }

                    foreach (StringDictionary eachRecord in data.Result)
                    {
                        if (eachRecord.ContainsKey("stateDate"))
                        {
                            response.Statements.Add(new CreditCardStatementInformation()
                            {
                                StatementDateInJulianFormat = eachRecord["stateDate"],
                                StatementDate = Formatter.ParseExact(eachRecord["stateDate"], "JY")
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(response);
        }
コード例 #2
0
        public void CompletingInformation(CreditCardRetrieveMultipleStatementDate statement)
        {
            Information.Name           = statement.Name;
            Information.Address        = statement.Address1 + " " + statement.Address2;
            Information.MinimumPayment = statement.MinimumPayment;
            Information.NewBalance     = 0.0;

            foreach (CreditCardInformation card in CreditCards)
            {
                if (!string.IsNullOrEmpty(card.CreditCardNo))
                {
                    GridCreditCardTransaction data = new GridCreditCardTransaction();
                    data.CreditCardNo   = card.CreditCardNo;
                    data.CardholderName = card.CardholderName;

                    double?NegativeAmount  = 0.0;
                    double?PositiveAmount  = 0.0;
                    double?PreviousBalance = 0.0;

                    foreach (CreditCardTransaction trx in Transactions)
                    {
                        if (trx.CreditCardNo == card.CreditCardNo)
                        {
                            if (CCTransaction.HistoricalTransactionCodesForNegativeAmount.Contains(trx.TransactionCode))
                            {
                                NegativeAmount += trx.Amount;
                            }
                            else
                            {
                                PositiveAmount += trx.Amount;
                            }
                            PreviousBalance += trx.PreviousBalance;
                            if (!"INTEREST".Equals(trx.Description))
                            {
                                data.Trx.Add(trx);
                            }
                        }
                    }
                    data.PreviousBalance = PreviousBalance;
                    data.SubTotal        = PositiveAmount - NegativeAmount + PreviousBalance;
                    TransactionData.Add(data);
                    Information.NewBalance += data.SubTotal;
                }
            }
            Information.NewBill = Information.NewBalance - (Information.OldBalance + Information.Credit);
        }