コード例 #1
0
        private bool savePaymentDetails(PaymentNotificationRequestHelper pnr)
        {
            BettingSuiteDataContext db = new BettingSuiteDataContext();

            if (iSNotDuplicate(pnr.getPaymentLogId(), db))
            {
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        PaymentNotificationRequest pr = setPaymentRequestObjAndSave(pnr, db);
                        shop shop = new CRUD.shop_crud().find_shop_By_ID(pr.CustReference);
                        foreach (PaymentItemHelper it in pnr.getPaymentItems())
                        {
                            if (it.getItemCode().Equals(ConfigurationManager.AppSettings["SalesCode"].ToString()))
                            {
                                AddSalesTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["LEASE DEBT"].ToString()))
                            {
                                //do lease debt lodgement
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["OPERATIONAL DEBT"].ToString()))
                            {
                                //do operational debt lodgement
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["ONLINE AGENCY"].ToString()))
                            {
                                //send online dept updates on online agency
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["ONLINE USER"].ToString()))
                            {
                                //send online dept updates on online user
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["PAYMENT COMMISION"].ToString()))
                            {
                                //futute implementation
                            }
                            else
                            {
                                //send acknologement message of payments
                            }
                        }

                        db.SubmitChanges();
                        scope.Complete();

                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
            }
            return(false);
        }
コード例 #2
0
        private XDocument generatePaymentNotificationRequests(XDocument doc, IEnumerable <XElement> requests)
        {
            List <PaymentNotificationRequestHelper> pnrequests = new List <PaymentNotificationRequestHelper>(requests.Count());


            foreach (var request in requests)
            {
                string a = request.Name.ToString();
                PaymentNotificationRequestHelper pnr = new PaymentNotificationRequestHelper();
                string b = request.Element("PaymentLogId").ToString();
                pnr.setPaymentLogId(int.Parse(request.Element("PaymentLogId").Value));
                pnr.setCustReference(request.Element("CustReference").Value);
                pnr.setAlternateCustReference(request.Element("AlternateCustReference").Value);
                pnr.setAmount(decimal.Parse(request.Element("Amount").Value));
                pnr.setPaymentStatus(int.Parse(request.Element("PaymentStatus").Value));
                pnr.setPaymentMethod(request.Element("PaymentMethod").Value);
                pnr.setPaymentReference(request.Element("PaymentReference").Value);
                pnr.setTerminalId((request.Element("TerminalId").Value));
                pnr.setChannelName((request.Element("ChannelName").Value));
                pnr.setLocation((request.Element("Location").Value));
                pnr.setReversal(Boolean.Parse(request.Element("IsReversal").Value));
                pnr.setPaymentDate(DateTime.ParseExact(request.Element("PaymentDate").Value, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture));
                pnr.setSettlementDate(DateTime.ParseExact(request.Element("SettlementDate").Value, "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture));
                pnr.setInstitutionID((request.Element("InstitutionId").Value));
                pnr.setInstitutionName((request.Element("InstitutionName").Value));
                pnr.setBranchName((request.Element("BranchName").Value));
                pnr.setBankName((request.Element("BankName").Value));
                pnr.setFeeName((request.Element("FeeName").Value));
                pnr.setCustomerName((request.Element("CustomerName").Value));
                pnr.setOtherCustomerInfo((request.Element("OtherCustomerInfo").Value));
                pnr.setReceiptNo((request.Element("ReceiptNo").Value));
                pnr.setCollectionsAccount((request.Element("CollectionsAccount").Value));
                pnr.setThirdPartyCode((request.Element("ThirdPartyCode").Value));
                pnr.setPaymentItems(request.Element("PaymentItems").Elements());
                pnr.setBankCode((request.Element("BankCode").Value));
                pnr.setCustomerAddress((request.Element("CustomerAddress").Value));
                pnrequests.Add(pnr);
            }
            doc = ProcessNotificationRequestsAndGetResponse(pnrequests);
            return(doc);
        }
コード例 #3
0
 private PaymentNotificationRequest setPaymentRequestObjAndSave(PaymentNotificationRequestHelper pnr, BettingSuiteDataContext db)
 {
     try
     {
         PaymentNotificationRequest newpr = new PaymentNotificationRequest();
         newpr.Amount                   = Math.Abs(pnr.getAmount());
         newpr.BankCode                 = pnr.getBankCode();
         newpr.BankName                 = pnr.getBankName();
         newpr.BranchName               = pnr.getBranchName();
         newpr.CategoryCode             = pnr.getCategoryCode();
         newpr.CategoryName             = pnr.getCategoyName();
         newpr.ChannelName              = pnr.getChannelName();
         newpr.CollectionsAccount       = pnr.getCollectionsAccount();
         newpr.CustomerAddress          = pnr.getCustomerAddress();
         newpr.CustomerName             = pnr.getCustomerName();
         newpr.CustomerPhoneNumber      = pnr.getCustomerPhoneNumber();
         newpr.CustReference            = int.Parse(pnr.getCustReference().Substring(1));
         newpr.DepositorName            = pnr.getDepositorName();
         newpr.FeeName                  = pnr.getFeeName();
         newpr.FTPPassword              = pnr.getFTPPassword();
         newpr.FTPUsername              = pnr.getFTPUsername();
         newpr.InstitutionId            = pnr.getInstitutionID();
         newpr.InstitutionName          = pnr.getInstitutionName();
         newpr.isReversal               = pnr.isReversal();
         newpr.Location                 = pnr.getLocation();
         newpr.OriginalPaymentLogid     = pnr.getOriginalPaymentLogId();
         newpr.OriginalPaymentName      = pnr.getOriginalPaymentName();
         newpr.OriginalPaymentReference = pnr.getOriginalPaymentReference();
         newpr.OtherCustomerInfo        = pnr.getOtherCustomerInfo();
         newpr.PaymentCurrency          = pnr.getPaymentCurrency();
         newpr.PaymentDate              = pnr.getPaymentDate();
         newpr.PaymentLogId             = pnr.getPaymentLogId();
         newpr.PaymentMethod            = pnr.getPaymentMethod();
         newpr.PaymentReference         = pnr.getPaymentReference();
         newpr.PaymentStatus            = pnr.getPaymentStatus();
         newpr.ServicePassword          = pnr.getServicePassword();
         newpr.ServiceUsername          = pnr.getServiceUsername();
         newpr.SettlementDate           = pnr.getSettlementDate();
         List <PaymentItem>       pItems = null;
         List <PaymentItemHelper> phs    = pnr.getPaymentItems();
         // List<Item> t = db.Items.ToList<Item>();
         if (phs.Count > 0)
         {
             pItems = new List <PaymentItem>();
             foreach (PaymentItemHelper pay in phs)
             {
                 PaymentItem p = new PaymentItem();
                 p.ItemAmount      = pay.getItemAmount();
                 p.LeadBankCbnCode = pay.getLeadBankCbnCode();
                 p.LeadBankCode    = pay.getLeadBankCode();
                 p.LeadBankName    = pay.getLeadBankName();
                 p.Item            = db.Items.SingleOrDefault(a => a.code.Equals(pay.getItemCode())).id;
                 pItems.Add(p);
                 // setItemCodeLater
             }
             db.PaymentItems.InsertAllOnSubmit(pItems);
             db.PaymentNotificationRequests.InsertOnSubmit(newpr);
         }
         return(newpr);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #4
0
        private bool savePaymentDetails(PaymentNotificationRequestHelper pnr)
        {
            BettingSuiteDataContext db = new BettingSuiteDataContext();

            if (iSNotDuplicate(pnr.getPaymentLogId(), db))
            {
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        PaymentNotificationRequest pr = setPaymentRequestObjAndSave(pnr, db);
                        shop shop = new CRUD.shop_crud().find_shop_By_ID(pr.CustReference);
                        foreach (PaymentItemHelper it in pnr.getPaymentItems())
                        {
                            if (it.getItemCode().Equals(ConfigurationManager.AppSettings["SalesCode"].ToString()))
                            {
                                AddSalesTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["LeaseDebtCode"].ToString()))
                            {
                                AddDebtTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["OperationalDebtCode"].ToString()))
                            {
                                AddDebtTransaction(shop, pr, db);
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Online Agency"].ToString()))
                            {
                                //sendmail
                                MailClient mc   = new MailClient();
                                mail       mail = new CRUD.mail_crud().findByCode("OL");
                                string     body = mail.content;
                                body = body.Replace("{shop_code}", shop.shop_code);
                                body = body.Replace("{account_name}", pnr.getCustomerName());
                                body = body.Replace("{amount}", "₦" + pr.Amount.ToString());
                                body = body.Replace("{amount_to_lodge}", "₦" + (decimal.Multiply(pr.Amount, decimal.Parse("1.10"))).ToString());
                                body = body.Replace("{payment_method}", "InterSwitch");

                                mc.SendBulkMail(ConfigurationManager.AppSettings["ONLINE SENDING MAIL"].ToString(), shop.shop_code + " (₦" + pr.Amount.ToString() + ") ", body);
                                //send sms to agent
                                SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                                sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                                bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                                if (smsvalidity)
                                {
                                    sms message = new sms();
                                    if (message.initializeParameters(shop, "Online Lodgement Confirmation" + "\r\n" + "Your lodgement of " + pr.Amount.ToString() + " for online agency has being confirmed. You would be credited with " + (decimal.Multiply(pr.Amount, decimal.Parse("1.10"))).ToString() + "\r\n" + "", pr.PaymentDate))
                                    {
                                        message.CustomizeAndSendSMS();
                                    }
                                }
                                //send online dept updates on online user
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Online User"].ToString()))
                            {
                            }
                            else if (it.getItemCode().Equals(ConfigurationManager.AppSettings["Payment Commision"].ToString()))
                            {
                                //futute implementation
                            }
                            else
                            {
                                SMS_Vendor_Validity_Helper valhelp = new SMS_Vendor_Validity_Helper();
                                sms_vendor vendor = valhelp.getVendorsByName("50kobo");

                                bool smsvalidity = (DateTime.Today <= vendor.expiry_date) ? true : false;

                                if (smsvalidity)
                                {
                                    sms message = new sms();
                                    if (message.initializeParameters(shop, "Payment Confirmation" + "\r\n" + "Your lodgement of " + pr.Amount.ToString() + " for " + it.getItemName() + " has being confirmed and would be processed shortly" + "\r\n" + "call 014609630 for info/complaints", pr.PaymentDate))
                                    {
                                        message.CustomizeAndSendSMS();
                                    }
                                }
                            }
                        }

                        db.SubmitChanges();
                        scope.Complete();

                        return(true);
                    }
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
            }
            return(false);
        }