示例#1
0
        public async Task <IActionResult> PostAsync(PaymentNotification request)
        {
            switch (request.PaymentNotificationType)
            {
            case PaymentNotificationTypeEnum.ReceivedOrder:
                await this.SendReceivedOrder(request.CustomerName, request.CustomerEmail, request.AmountInCents, request.CompanyName, request.CompanyEmail);

                break;

            case PaymentNotificationTypeEnum.Boleto:
                await this.SendBoleto(request.CustomerName, request.CustomerEmail, request.BoletoLink, request.CompanyName, request.CompanyEmail);

                break;

            case PaymentNotificationTypeEnum.ComfirmedPayment:
                await this.SendConfirmedPayment(request.CustomerName, request.CustomerEmail, request.CompanyName, request.CompanyEmail);

                break;

            case PaymentNotificationTypeEnum.RefusedPayment:
                await this.SendRefusedPayment(request.CustomerName, request.CustomerEmail, request.RefusedPaymentReason, request.CompanyName, request.CompanyEmail);

                break;
            }
            return(Ok());
        }
示例#2
0
            public static PaymentNotification paymentNotification(T_PaymentNotification item)
            {
                if (item == null)
                {
                    return(null);
                }
                var data = new PaymentNotification()
                {
                    id          = item.id,
                    fileId      = item.fileId,
                    firstName   = item.firstName,
                    lastName    = item.lastName,
                    orderCode   = item.orderCode,
                    paymentDate = item.paymentDate,
                    paymentType = item.paymentType,
                    isActive    = item.isActive,
                    isMapping   = item.isMapping,
                    money       = item.money
                };

                if (item.L_FileUpload != null)
                {
                    data.file = Logs.fileUpload(item.L_FileUpload);
                }

                return(data);
            }
示例#3
0
 /**
  * Handles if the payment had timeout
  * @param paymentNotification
  */
 void HandleTimeout(PaymentNotification paymentNotification)
 {
     if (paymentNotification.IsReverse)
     {
         ReversePayment(paymentNotification);
     }
 }
示例#4
0
        /// <summary>
        /// Add payment
        /// </summary>
        /// <returns>
        /// 1: success
        /// 2: there is no order code
        /// -1: error
        /// </returns>
        public int addPayment(PaymentNotification data)
        {
            try
            {
                var order = db.Orders.FirstOrDefault(m => m.code == data.orderCode);
                if (order == null)
                {
                    return(2);
                }

                db.PaymentNotifications.Add(new PaymentNotification()
                {
                    file        = data.file,
                    fileId      = data.file.id,
                    firstName   = data.firstName,
                    isActive    = true,
                    isMapping   = false,
                    lastName    = data.lastName,
                    money       = data.money,
                    orderCode   = order.code,
                    paymentDate = data.paymentDate,
                    paymentType = PaymentTypes.TRANSFER.ToString()
                });
                db.SaveChanges();

                return(1);
            }
            catch (Exception ex)
            {
                return(-1);
            }
        }
        public void Paid(string notification_type, string operation_id, string label, string datetime,
                         decimal amount, decimal withdraw_amount, string sender, string sha1_hash, string currency, bool codepro)
        {
            string key = "eBy4PpMKwAWIR3o5Fm/V6yDg"; // секретный код
            // проверяем хэш
            string paramString = String.Format("{0}&{1}&{2}&{3}&{4}&{5}&{6}&{7}&{8}",
                                               notification_type, operation_id, amount, currency, datetime, sender,
                                               codepro.ToString().ToLower(), key, label);
            string paramStringHash1 = GetHash(paramString);
            // создаем класс для сравнения строк
            StringComparer comparer = StringComparer.OrdinalIgnoreCase;

            // если хэши идентичны, добавляем данные о заказе в бд
            if (0 == comparer.Compare(paramStringHash1, sha1_hash))
            {
                PaymentNotification nt = new PaymentNotification();
                nt.notification_type = notification_type;
                nt.operation_id      = operation_id;
                nt.label             = label;
                nt.datetime          = datetime;
                nt.amount            = amount;
                nt.withdraw_amount   = withdraw_amount;
                nt.sender            = sender;
                nt.sha1_hash         = sha1_hash;
                nt.currency          = currency;
                nt.codepro           = codepro;


                _db.Payments.Add(nt);
                _db.SaveChanges();


                //Order order = db.Orders.FirstOrDefault(o => o.Id == label);
                //order.Operation_Id = operation_id;
                //order.Date = DateTime.Now;
                //order.Amount = amount;
                //order.WithdrawAmount = withdraw_amount;
                //order.Sender = sender;
                //db.Entry(order).State = EntityState.Modified;
                //db.SaveChanges();
            }


            PaymentNotification nt1 = new PaymentNotification();

            nt1.notification_type = notification_type;
            nt1.operation_id      = operation_id;
            nt1.label             = label;
            nt1.datetime          = datetime;
            nt1.amount            = amount;
            nt1.withdraw_amount   = withdraw_amount;
            nt1.sender            = sender;
            nt1.sha1_hash         = sha1_hash;
            nt1.currency          = currency;
            nt1.codepro           = codepro;


            _db.Payments.Add(nt1);
            _db.SaveChanges();
        }
partial         void HandleImplementation(PaymentNotification message)
        {
            // TODO: PaymentNotificationHandler: Add code to handle the PaymentNotification message.
            Console.WriteLine("Paying received " + message.GetType().Name);

            var response = new PaymentEngine.Internal.Messages.Paying.PaymentNotificationResponse();
            Bus.Reply(response);
        }
示例#7
0
        partial void HandleImplementation(PaymentNotification message)
        {
            // TODO: PaymentNotificationHandler: Add code to handle the PaymentNotification message.
            Console.WriteLine("Paying received " + message.GetType().Name);

            var response = new PaymentEngine.Internal.Messages.Paying.PaymentNotificationResponse();

            Bus.Reply(response);
        }
        private void SuccessNofity(PaymentNotification callbackInfo, Order currentOrder)
        {
            currentOrder.OrderStatus = OrderStatus.Complete;
            var updateRet = oracleRepo.Update <Order>(currentOrder);
            //成功    从通知队列中把通知model删除 记录成功信息
            var callbackNotifyDetails = EntityMapping.Auto <PaymentNotification, CallbackNotification>(callbackInfo);

            callbackNotifyDetails.IsNotifySuccess = true;
            callbackNotifyDetails.LastRequestDate = DateTime.Now;
            var addRet = oracleRepo.Add <CallbackNotification>(callbackNotifyDetails);
        }
        private void FailedNofity(PaymentNotification callbackInfo, Order currentOrder)
        {
            currentOrder.OrderStatus = OrderStatus.Stoped;
            var updateRet = oracleRepo.Update <Order>(currentOrder);

            var callbackNotifyDetails = EntityMapping.Auto <PaymentNotification, CallbackNotification>(callbackInfo);

            callbackNotifyDetails.IsNotifySuccess = false;
            callbackNotifyDetails.LastRequestDate = DateTime.Now;
            var addRet = oracleRepo.Add <CallbackNotification>(callbackNotifyDetails);
        }
示例#10
0
 public String Post([FromBody] PaymentNotification paymentNotification)
 {
     if (paymentNotification.IsTimeoutOperation)
     {
         HandleTimeout(paymentNotification);
     }
     else if (paymentNotification.IsCancelled)
     {
         HandleCancel(paymentNotification);
     }
     else if (paymentNotification.IsPaid)
     {
         HandlePaid(paymentNotification);
     }
     return("Success");
 }
示例#11
0
        //[Fact]
        //public void GetMobileInfoByPhoneNumber_test()
        //{
        //    IRepository repository = new SimpleRepository(ConnectionStrings.Key_ORACLE_LOG, SimpleRepositoryOptions.None);

        //    //var mobile = SMSService.GetMobileInfoByPhoneNumber("");

        //    var citys = repository.All<City>();
        //    var province = repository.All<Province>();



        //}

        // [Fact]
        public void SMSCallbackLogicTest()
        {
            //IRepository repository = new SimpleRepository(ConnectionStrings.KEY_ORACLE_GENERAL, SimpleRepositoryOptions.RunMigrations);
            //repository.Add<Partner>(new Partner() { CallbackURL = "http://fh_charge.auroraorbit.com/sms_callback.ashx", PartnerNo = "1" });

            IRedisService       realRedisService = new RedisService();
            PaymentNotification pn = new PaymentNotification()
            {
                OutOrderNo  = "outOrderNo",
                CallbackURL = "http://fh_charge.auroraorbit.com/sms_callback.ashx",
                OrderNo     = "orderNo",
                ResultCode  = 2
            };

            //realRedisService.AddItemToQueue<PaymentNotification>();
            realRedisService.AddItemToQueue <PaymentNotification>(BillingConsts.KEY_CARD_PAYMENT_CALLBACK_PROCESSING_QUEUE, pn);
        }
示例#12
0
 internal void SMSCallbackLogic(Order order)
 {
     if (order.PartenerNo != null)
     {
         var cardPaymentCallbackResult = new PaymentNotification();
         cardPaymentCallbackResult.OrderNo       = order.OrderNo;
         cardPaymentCallbackResult.SuccessAmount = order.PayedAmount;
         cardPaymentCallbackResult.RequestAmount = order.Amount;
         cardPaymentCallbackResult.ResultCode    = (int)order.OrderStatus;
         cardPaymentCallbackResult.OutOrderNo    = order.OutOrderNo;
         var partner = this.Single <Partner>(s => s.PartnerNo == order.PartenerNo);
         if (partner != null)
         {
             cardPaymentCallbackResult.CallbackURL = partner.CallbackURL;
             this.RedisService.AddItemToQueue <PaymentNotification>(BillingConsts.KEY_CARD_PAYMENT_CALLBACK_PROCESSING_QUEUE, cardPaymentCallbackResult);
         }
     }
 }
示例#13
0
        private async Task OnPaymentNotificationAsync(PaymentNotification notification, CancellationToken ct)
        {
            if (string.IsNullOrEmpty(notification.Error))
            {
                var coin = poolConfigs[notification.PoolId].Template;

                // prepare tx links
                var txLinks = new string[0];

                if (!string.IsNullOrEmpty(coin.ExplorerTxLink))
                {
                    txLinks = notification.TxIds.Select(txHash => string.Format(coin.ExplorerTxLink, txHash)).ToArray();
                }

                const string subject = "Payout Success Notification";
                var          message = $"Paid {FormatAmount(notification.Amount, notification.PoolId)} from pool {notification.PoolId} to {notification.RecpientsCount} recipients in transaction(s) {(string.Join(", ", txLinks))}";

                if (clusterConfig.Notifications?.Admin?.NotifyPaymentSuccess == true)
                {
                    await Guard(() => SendEmailAsync(adminEmail, subject, message, ct), LogGuarded);

                    if (clusterConfig.Notifications?.Pushover?.Enabled == true)
                    {
                        await Guard(() => pushoverClient.PushMessage(subject, message, PushoverMessagePriority.None, ct), LogGuarded);
                    }
                }
            }

            else
            {
                const string subject = "Payout Failure Notification";
                var          message = $"Failed to pay out {notification.Amount} {poolConfigs[notification.PoolId].Template.Symbol} from pool {notification.PoolId}: {notification.Error}";

                await Guard(() => SendEmailAsync(adminEmail, subject, message, ct), LogGuarded);

                if (clusterConfig.Notifications?.Pushover?.Enabled == true)
                {
                    await Guard(() => pushoverClient.PushMessage(subject, message, PushoverMessagePriority.None, ct), LogGuarded);
                }
            }
        }
        internal void ProcessCallbackRequest(PaymentNotification callbackInfo, int retryCount)
        {
            if (string.IsNullOrEmpty(callbackInfo.CallbackURL))
            {
                var currentOrder = oracleRepo.Single <Order>(s => s.OrderNo == callbackInfo.OrderNo);
                if (currentOrder != null)
                {
                    FailedNofity(callbackInfo, currentOrder);
                }

                return;
            }

            // 有了用的 var url = string.Format("{0}?orderno={1}&resultcode={2}&requestamount={3}&successamount={4}&desc={5}", callbackInfo.CallbackURL, callbackInfo.OrderNo, callbackInfo.ResultCode.ToString(), callbackInfo.RequestAmount.ToString(), callbackInfo.SuccessAmount.ToString(), callbackInfo.Description);
            var url = string.Format("{0}?orderId={1}&status={2}&globalId={3}", callbackInfo.CallbackURL, callbackInfo.OutOrderNo, callbackInfo.ResultCode.ToString(), callbackInfo.OrderNo);

            var response = RESTfullClient.Get(url, timeoutMilliSeconds);

            LogHelper.WriteInfo(string.Format("Send call back to client, order no : {0}, request result : {1}", callbackInfo.OrderNo, response), ConsoleColor.Green);

            if (!string.IsNullOrEmpty(response) && response.StartsWith("success", StringComparison.OrdinalIgnoreCase))
            {
                var currentOrder = oracleRepo.Single <Order>(s => s.OrderNo == callbackInfo.OrderNo);
                if (currentOrder != null)
                {
                    if (currentOrder.OrderStatus == OrderStatus.Processing)
                    {
                        //processing status without operation
                    }
                    else
                    {
                        SuccessNofity(callbackInfo, currentOrder);
                    }
                }
            }
            else
            {
                RetryNotify(callbackInfo, retryCount);
            }
        }
 private int RetryNotify(PaymentNotification callbackInfo, int retryCount)
 {
     callbackInfo.LastRequestDate = DateTime.Now;
     retryCount++;
     if (retryCount <= retryTimesLimitation)
     {
         RedisService.AddItemToQueue <PaymentNotification>(BillingConsts.KEY_CARD_PAYMENT_CALLBACK_RETRY_QUEUE + retryCount, callbackInfo);
     }
     else// final failed
     {
         Order currentOrder = oracleRepo.Single <Order>(s => s.OrderNo == callbackInfo.OrderNo);
         if (currentOrder.OrderStatus == OrderStatus.Processing)
         {
             //processing status without operation
         }
         else
         {
             FailedNofity(callbackInfo, currentOrder);
         }
     }
     return(retryCount);
 }
示例#16
0
        public void do_not_notify_if_callback_url_is_null()
        {
            var callbackIn = new PaymentNotification()
            {
                CallbackURL = string.Empty,
                OrderNo     = "20071110558487745",
            };
            Order order = new Order()
            {
                Id     = 1,
                Amount = 100,
                CardPaymentRequestStatus  = CardPaymentRequestStatus.Success,
                CardPaymentCallBackStatus = CardPaymentCallBackStatus.Success,
                Currency    = "CNY",
                OrderNo     = "20071110558487745",
                OrderStatus = OrderStatus.Successed,
                PayedAmount = 100,
            };

            _repository.Setup(s => s.Single <Order>(It.IsAny <Expression <Func <Order, bool> > >())).Returns(order);

            cardPaymentProcessor.ProcessCallbackRequest(callbackIn, 1);
            _repository.Verify(s => s.Update <Order>(It.IsAny <Order>()));
        }
示例#17
0
 public int addPayment([FromBody] PaymentNotification data)
 {
     return(this.orderService.addPayment(data));
 }
示例#18
0
 /**
  * Handles if the payment is paid
  * @param paymentNotification
  */
 void HandlePaid(PaymentNotification paymentNotification)
 {
 }
示例#19
0
 /**
  * Handles if the payment is cancelled
  * @param paymentNotification
  */
 void HandleCancel(PaymentNotification paymentNotification)
 {
 }
        public void SendCardPaymentCallBack()
        {
            PaymentNotification callbackInfo = RedisService.RetrieveItemFromQueue <PaymentNotification>(BillingConsts.KEY_CARD_PAYMENT_CALLBACK_PROCESSING_QUEUE);

            ProcessCallbackRequest(callbackInfo, 0);
        }
示例#21
0
 /**
  * Handles if payment has to be reversed
  * @param paymentNotification
  */
 void ReversePayment(PaymentNotification paymentNotification)
 {
 }
 partial void ConfigurePaymentNotification(PaymentNotification message);
 public void Send(PaymentNotification message)
 {
     ConfigurePaymentNotification(message);
     Bus.Send(message);
 }
        public async Task <User> Add(PaymentNotification paymentNotification, IFormFile[] images)
        {
            var user = await _context.Users.Where(x => x.Email == paymentNotification.Email).FirstOrDefaultAsync();

            if (user == null)
            {
                throw new AppException("User is not found");
            }

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    if (images[i] != null && images[i].Length > 0)
                    {
                        var file = images[i];
                        if (file.Length > 0)
                        {
                            if (!file.ContentType.StartsWith("image"))
                            {
                                var fileLength    = file.Length / 1024;
                                var maxFileLength = 5120;
                                if (fileLength > maxFileLength)
                                {
                                    throw new AppException("Uploaded file must not be more than 5MB!");
                                }
                            }
                        }
                    }
                }
            }

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    Bitmap originalFile = null;
                    Bitmap resizedFile  = null;
                    int    imgWidth     = 0;
                    int    imgHeigth    = 0;
                    if ((i == 0) && (images[i] != null) && (images[i].Length > 0))
                    {
                        var uploads = Path.GetFullPath(Path.Combine(GlobalVariables.ImagePath, @"images\payment"));
                        var file    = images[i];
                        if (file.Length > 0)
                        {
                            var    fileName              = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim();
                            string uniqueFileName        = paymentNotification.FirstName.Substring(0, 5) + i + DateTime.Now + file.FileName;
                            string uniqueFileNameTrimmed = uniqueFileName.Replace(":", "").Replace("-", "").Replace(" ", "").Replace("/", "");

                            using (var fileStream = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                            {
                                await file.CopyToAsync(fileStream);

                                paymentNotification.ImageNames = uniqueFileNameTrimmed;

                                if (file.ContentType.StartsWith("image"))
                                {
                                    int width  = 200;
                                    int height = 200;
                                    originalFile = new Bitmap(fileStream);
                                    resizedFile  = ResizeImage.GetResizedImage(fileStream, width, height, width, height);
                                }
                            }

                            if (resizedFile != null)
                            {
                                imgWidth  = resizedFile.Width;
                                imgHeigth = resizedFile.Height;
                                using (var fileStreamUp = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                                {
                                    resizedFile.Save(fileStreamUp, ImageFormat.Jpeg);
                                }
                            }
                        }
                    }
                }
            }

            DateTime paymentNotificationLocalDate_Nigeria = new DateTime();
            string   windowsTimeZone = GetWindowsFromOlson.GetWindowsFromOlsonFunc("Africa/Lagos");

            paymentNotificationLocalDate_Nigeria = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(windowsTimeZone));
            paymentNotification.DateAdded        = paymentNotificationLocalDate_Nigeria;

            int length              = GlobalVariables.RandomStringLengthShort();
            var randomKey           = "";
            var keyIsAlreadyPresent = true;

            do
            {
                randomKey           = GlobalVariables.RandomString(length);
                keyIsAlreadyPresent = _context.PaymentNotifications.Any(x => x.Reference == randomKey);
            } while (keyIsAlreadyPresent);
            paymentNotification.Reference = randomKey;

            paymentNotification.Confirmed     = "No";
            paymentNotification.UpdateAllowed = true;
            await _context.PaymentNotifications.AddAsync(paymentNotification);

            if (paymentNotification.TransactionType == "Activation")
            {
                user.ActivationRequested = true;
                _context.Users.Update(user);
            }
            await _context.SaveChangesAsync();

            //ThreadPool.QueueUserWorkItem(o => {
            string body = "Dear " + paymentNotification.FirstName + ",<br/><br/>Thank you for submitting your payment notification.<br/><br/>" +
                          "We will confirm your payment and update your online profile.<br/><br/>" +
                          "You will also receive an email from us as soon as we have confirmed your payment<br/><br/>" +
                          "Thanks,<br/>The RotatePay Team<br/>";
            var message = new Message(new string[] { paymentNotification.Email }, "[RotatePay] Payment Notification Received", body, null);

            _emailSenderService.SendEmail(message);

            string body1    = paymentNotification.FirstName + "(" + paymentNotification.Email + ") has submitted the payment notification form.<br/><br/><br/>";
            var    message1 = new Message(new string[] { GlobalVariables.AdminEmail }, "[RotatePay] Payment receipt by " + paymentNotification.Email, body1, images);

            _emailSenderService.SendEmail(message1);
            //});

            //await _logService.Create(log);
            return(user);
        }
        public async Task <PaymentNotification> Update(PaymentNotification paymentNotificationParam, IFormFile[] images)
        {
            var paymentNotification = await _context.PaymentNotifications.Where(x => x.Reference == paymentNotificationParam.Reference).FirstOrDefaultAsync();

            if (paymentNotification == null)
            {
                throw new AppException("Payment notification not found");
            }

            if (!paymentNotification.UpdateAllowed)
            {
                throw new AppException("Invalid payment notification update attempted");
            }

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    if (images[i] != null && images[i].Length > 0)
                    {
                        var file = images[i];
                        if (file.Length > 0)
                        {
                            if (!file.ContentType.StartsWith("image"))
                            {
                                var fileLength    = file.Length / 1024;
                                var maxFileLength = 5120;
                                if (fileLength > maxFileLength)
                                {
                                    throw new AppException("Uploaded file must not be more than 5MB!");
                                }
                            }
                        }
                    }
                }
            }

            paymentNotification.AmountPaid         = paymentNotificationParam.AmountPaid;
            paymentNotification.PaymentChannel     = paymentNotificationParam.PaymentChannel;
            paymentNotification.PaymentDateAndTime = paymentNotificationParam.PaymentDateAndTime;
            paymentNotification.DepositorName      = paymentNotificationParam.DepositorName;
            paymentNotification.AdditionalDetails  = paymentNotificationParam.AdditionalDetails;

            if (images != null)
            {
                for (int i = 0; i < images.Length; i++)
                {
                    Bitmap originalFile = null;
                    Bitmap resizedFile  = null;
                    int    imgWidth     = 0;
                    int    imgHeigth    = 0;
                    if ((i == 0) && (images[i] != null) && (images[i].Length > 0))
                    {
                        var uploads = Path.GetFullPath(Path.Combine(GlobalVariables.ImagePath, @"images\payment"));
                        var file    = images[i];
                        if (file.Length > 0)
                        {
                            var    fileName              = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim();
                            string uniqueFileName        = paymentNotification.FirstName.Substring(0, 5) + i + DateTime.Now + file.FileName;
                            string uniqueFileNameTrimmed = uniqueFileName.Replace(":", "").Replace("-", "").Replace(" ", "").Replace("/", "");

                            using (var fileStream = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                            {
                                await file.CopyToAsync(fileStream);

                                paymentNotification.ImageNames = uniqueFileNameTrimmed;

                                if (file.ContentType.StartsWith("image"))
                                {
                                    int width  = 200;
                                    int height = 200;
                                    originalFile = new Bitmap(fileStream);
                                    resizedFile  = ResizeImage.GetResizedImage(fileStream, width, height, width, height);
                                }
                            }

                            if (resizedFile != null)
                            {
                                imgWidth  = resizedFile.Width;
                                imgHeigth = resizedFile.Height;
                                using (var fileStreamUp = new FileStream(Path.Combine(uploads, uniqueFileNameTrimmed), FileMode.Create))
                                {
                                    resizedFile.Save(fileStreamUp, ImageFormat.Jpeg);
                                }
                            }
                        }
                    }
                }
            }

            DateTime paymentNotificationLocalDate_Nigeria = new DateTime();
            string   windowsTimeZone = GetWindowsFromOlson.GetWindowsFromOlsonFunc("Africa/Lagos");

            paymentNotificationLocalDate_Nigeria = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(windowsTimeZone));
            paymentNotification.DateEdited       = paymentNotificationLocalDate_Nigeria;

            _context.PaymentNotifications.Update(paymentNotification);
            await _context.SaveChangesAsync();

            //ThreadPool.QueueUserWorkItem(o => {
            string body = "Dear " + paymentNotification.FirstName + ",<br/><br/>Thank you for updating your payment notification.<br/><br/>" +
                          "We will check your updated payment notification and update your online profile.<br/><br/>" +
                          "You will also receive an email from us as soon as we have taken any action on your updated payment notification<br/><br/>" +
                          "Thanks,<br/>The RotatePay Team<br/>";
            var message = new Message(new string[] { paymentNotification.Email }, "[RotatePay] Updated Payment Notification Received", body, null);

            _emailSenderService.SendEmail(message);

            string body1    = paymentNotification.FirstName + "(" + paymentNotification.Email + ") has updated their payment notification with reference " + paymentNotification.Reference + ".<br/><br/><br/>";
            var    message1 = new Message(new string[] { GlobalVariables.AdminEmail }, "[RotatePay] Updated Payment Notification by " + paymentNotification.Email, body1, images);

            _emailSenderService.SendEmail(message1);
            //});

            //await _logService.Create(log);
            return(paymentNotification);
        }
示例#26
0
 public int addPayment(PaymentNotification data)
 {
     this.db.PaymentNotifications.Add(data);
     this.db.SaveChanges();
     return(-1);
 }
示例#27
0
 public int confirmPayment([FromBody] PaymentNotification data)
 {
     return(this.service.addPayment(data));
 }
示例#28
0
        static void Main(string[] args)
        {
            Console.WriteLine("Business Rules Engine : Select below option for different payments");
            Console.WriteLine("\n");
            Console.WriteLine("01 - Physical Products");
            Console.WriteLine("02 - Books");
            Console.WriteLine("03 - Membership");
            Console.WriteLine("04 - Upgrade to Membership");
            Console.WriteLine("05 - Membership or Upgrade");
            Console.WriteLine("06 - LearningToSki");
            Console.WriteLine("07 - Physical Products or Books");

            string selectedOption = Console.ReadLine();

            switch (Convert.ToInt32(selectedOption))
            {
            case 1:

                //PhysicalProducts PhysicalProducts = new PhysicalProducts();

                PaymentNotification PhysicalProducts = new PaymentNotification(new PhysicalProducts());
                //if (PhysicalProducts.PackingSlip() && PhysicalProducts.AgentCommission())
                if (PhysicalProducts.DoPaymentNotify())
                {
                    Console.WriteLine("Physical Products : Packing slip Generated for shiping");
                    //Console.WriteLine("Physical Products or Books : Generated a Commission payment for agent");
                }
                else
                {
                    Console.WriteLine("Physical Products : Packing slip not Generated for shiping");
                    //Console.WriteLine("Physical Products or Books : Generated a Commission payment for agent");
                }

                break;

            case 2:

                //Books book = new Books();

                PaymentNotification book = new PaymentNotification(new PhysicalProducts());
                //if (book.PackingSlip() && book.AgentCommission())
                if (book.DoPaymentNotify())
                {
                    Console.WriteLine("Books : Duplicate packing slip Created for the royalty department");
                    //Console.WriteLine("Physical Products or Books : Generated a Commission payment for agent");
                }
                else
                {
                    Console.WriteLine("Books : Duplicate packing slip not Created for the royalty department");
                    //Console.WriteLine("Physical Products or Books : Generated a Commission payment for agent");
                }

                break;

            case 3:

                IActivate iActivate = new Membership();

                if (iActivate.Activate())
                {
                    Console.WriteLine("Membership : Membership Activated");
                }
                else
                {
                    Console.WriteLine("Membership :  Membership not Activated");
                }
                break;

            case 4:
                IUpgrade iUpgrade = new UpgradeMembership();

                if (iUpgrade.Upgrade())
                {
                    Console.WriteLine("Upgrade to Membership : Applied for upgrade");
                }
                else
                {
                    Console.WriteLine("Upgrade to Membership : Not Applied for upgrade");
                }
                break;

            case 5:

                //we can pass eiher new Membership() or new UpgradeMembership(), Both are inherited by IEmailService
                EmailNotification emailNotification = new EmailNotification(new UpgradeMembership());

                if (emailNotification.DoEmailNotify())
                {
                    Console.WriteLine("Membership or Upgrade : Email Notification sent to owner about Activation/Upgrade ");
                }
                else
                {
                    Console.WriteLine("Membership or Upgrade : Email Notification not sent to owner about Activation/Upgrade ");
                }

                break;

            case 6:

                PaymentNotification learningToSki = new PaymentNotification(new LearningToSki());

                if (learningToSki.DoPaymentNotify())
                {
                    Console.WriteLine("LearningToSki : Free First Aid Vedio Added for packing slip");
                }
                else
                {
                    Console.WriteLine("LearningToSki : Free First Aid Vedio not Added for packing slip");
                }

                break;

            case 7:

                //we can pass eiher new PhysicalProducts() or new Book(), Both are inherited by IAgentCommission
                AgentCommissionNotification iAgentCommission = new AgentCommissionNotification(new PhysicalProducts());

                if (iAgentCommission.DoAgentCommissionNotify())
                {
                    Console.WriteLine("Physical Products or Books : Agent Commission payment Generated");
                }
                else
                {
                    Console.WriteLine("Physical Products or Books : Agent Commission payment not Generated");
                }

                break;

            default:
                Console.WriteLine("Unexpected option selected");
                break;
            }

            Console.ReadLine();
        }