public ActionResult Invoice(int id) // transaction id
        {
            Models.Invoice objI = new Models.Invoice();

            Transaction        objT = new Transaction(id);
            Customer           objC;
            Business           objB;
            TransactionDetails objTDs;
            Payments           objPs;
            Refunds            objRs;

            if (objT.TransactionsExists)
            {
                objC   = new Customer(objT.CustomerID);
                objB   = new Business(objT.BusinessID);
                objTDs = new TransactionDetails(id);
                objPs  = new Payments(id);
                objRs  = new Refunds(id);


                objI.Customer           = objC;
                objI.Business           = objB;
                objI.TransactionDetails = objTDs;
                objI.Transaction        = objT;
                objI.Payments           = objPs;
                objI.Refunds            = objRs;

                //var t = new Tuple<AHDDManagerClass.Customer, AHDDManagerClass.Business, AHDDManagerClass.TransactionDetails, AHDDManagerClass.Transaction, AHDDManagerClass.Payments>(objC, objB, objTDs, objT, objPs);
                return(View(objI));
            }
            else
            {
                return(View());
            }
        }
예제 #2
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                hash = hash * 23 + Status.GetHashCode();
                hash = hash * 23 + Amount.GetHashCode();
                hash = hash * 23 + Currency.GetHashCode();
                hash = hash * 23 + Description.GetHashCode();
                hash = hash * 23 + Capture.GetHashCode();
                hash = hash * 23 + Authorized.GetHashCode();
                hash = hash * 23 + Reversed.GetHashCode();
                hash = hash * 23 + Paid.GetHashCode();
                hash = hash * 23 + Transaction.GetHashCode();
                hash = hash * 23 + Card.GetHashCode();
                hash = hash * 23 + Refunded.GetHashCode();
                hash = hash * 23 + Refunds.GetHashCode();
                hash = hash * 23 + FailureCode.GetHashCode();
                hash = hash * 23 + FailureMessage.GetHashCode();
                hash = hash * 23 + Customer.GetHashCode();
                hash = hash * 23 + IP.GetHashCode();
                hash = hash * 23 + Dispute.GetHashCode();
                hash = hash * 23 + ReturnURI.GetHashCode();
                hash = hash * 23 + AuthorizeURI.GetHashCode();

                return(hash);
            }
        }
예제 #3
0
        public override int GetHashCode()
        {
            int hashCode = -1519602905;

            if (Context != null)
            {
                hashCode += Context.GetHashCode();
            }

            if (Errors != null)
            {
                hashCode += Errors.GetHashCode();
            }

            if (Refunds != null)
            {
                hashCode += Refunds.GetHashCode();
            }

            if (Cursor != null)
            {
                hashCode += Cursor.GetHashCode();
            }

            return(hashCode);
        }
예제 #4
0
        static async Task SendMessagesAsync()
        {
            try
            {
                // Create a new message to send to the queue
                Refunds refund = new Refunds();
                //Console.WriteLine("Enter Refunds data entry");
                //Console.WriteLine("Enter validatingcarrier value:");
                //refund.validatingcarrier = Console.ReadLine();
                //Console.WriteLine("Enter waivercode value:");
                //refund.waivercode = Console.ReadLine();
                //Console.WriteLine("Enter waiverfield value:");
                //refund.waiverfield = Console.ReadLine();

                // Write the body of the message to the console.

                // Send the message to the queue.
                //for (int i = 0; i < 10; i++)
                //{
                refund.validatingcarrier = "Test" + i;
                refund.waivercode        = "Test" + i;
                refund.waiverfield       = "Test" + i;
                string messageBody = JsonConvert.SerializeObject(refund);
                var    message     = new Message(Encoding.UTF8.GetBytes(messageBody));
                Console.WriteLine($"Sending message: {messageBody}");
                await queueClient.SendAsync(message);

                //  }
                //Console.WriteLine("Message Sent Successfully");
            }
            catch (Exception exception)
            {
                Console.WriteLine($"{DateTime.Now} :: Exception: {exception.Message}");
            }
        }
예제 #5
0
        public JudoPayApi(Func <Type, ILog> logger, IClient client)
        {
            Payments     = new Payments(logger(typeof(Payments)), client);
            Refunds      = new Refunds(logger(typeof(Refunds)), client);
            PreAuths     = new PreAuths(logger(typeof(PreAuths)), client);
            Transactions = new Transactions(logger(typeof(Transactions)), client);
            Collections  = new Collections(logger(typeof(Collections)), client);
            ThreeDs      = new ThreeDs(logger(typeof(ThreeDs)), client);

            Market = new Market
            {
                Refunds      = new MarketRefunds(logger(typeof(MarketRefunds)), client),
                Transactions = new MarketTransactions(logger(typeof(MarketTransactions)), client),
                Collections  = new MarketCollections(logger(typeof(MarketCollections)), client),
                Merchants    = new MarketMerchants(logger(typeof(MarketMerchants)), client)
            };

            WebPayments = new WebPayments
            {
                Payments     = new Clients.WebPayments.Payments(logger(typeof(Clients.WebPayments.Payments)), client),
                PreAuths     = new Clients.WebPayments.PreAuths(logger(typeof(Clients.WebPayments.PreAuths)), client),
                Transactions = new Clients.WebPayments.Transactions(logger(typeof(Clients.WebPayments.Transactions)), client)
            };

            Consumers = new Consumers(logger(typeof(Consumers)), client);
        }
예제 #6
0
        /// <summary>
        /// Retrieve all refunds for the given payment.
        /// </summary>
        /// <param name="id">The id of the payment</param>
        /// <returns></returns>
        public Refunds ListRefunds(string id)
        {
            string  jsonData = LoadWebRequest("POST", "payments" + "/" + id + "/refunds", "");
            Refunds refunds  = JsonConvert.DeserializeObject <Refunds>(jsonData, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            return(refunds);
        }
        public FareInfoDataItem Copy()
        {
            var result = new FareInfoDataItem();

            result.Refunds   = Refunds?.Copy();
            result.Exchanges = Exchanges?.Copy();

            return(result);
        }
예제 #8
0
        public override int GetHashCode()
        {
            int hashCode = 226628405;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (Tenders != null)
            {
                hashCode += Tenders.GetHashCode();
            }

            if (Refunds != null)
            {
                hashCode += Refunds.GetHashCode();
            }

            if (ReferenceId != null)
            {
                hashCode += ReferenceId.GetHashCode();
            }

            if (Product != null)
            {
                hashCode += Product.GetHashCode();
            }

            if (ClientId != null)
            {
                hashCode += ClientId.GetHashCode();
            }

            if (ShippingAddress != null)
            {
                hashCode += ShippingAddress.GetHashCode();
            }

            if (OrderId != null)
            {
                hashCode += OrderId.GetHashCode();
            }

            return(hashCode);
        }
예제 #9
0
        public APIResult UpdateConglomeration()
        {
            _logger.LogInformation("=================【更新拼团状态】UpdateConglomeration服务开始==========");
            var orders = shopDb.ConglomerationOrder.Where(m => !m.IsDel &&
                                                          (m.Status.Equals(ShopOrderStatus.待成团) ||
                                                           m.Status.Equals(ShopOrderStatus.待自提) ||
                                                           m.Status.Equals(ShopOrderStatus.待配送)) &&
                                                          (!m.ConglomerationSetUp.IsDel && m.ConglomerationSetUp.EndTime <= DateTime.Now && (m.ConglomerationSetUp.Status.Equals(ConglomerationSetUpStatus.未成团) || m.ConglomerationSetUp.Status.Equals(ConglomerationSetUpStatus.已取消))))
                         .Include(m => m.ConglomerationSetUp);

            _logger.LogInformation($"需更新订单数量 :{orders.Count()}");

            foreach (var ordersItem in orders)
            {
                try
                {
                    //执行退款改变订单状态
                    var     shop    = shopDb.Shops.Find(ordersItem.ShopId);
                    Refunds refunds = new Refunds(proxyFactory);
                    var     memberTradeForRechange = shopDb.MemberTradeForRechange.FirstOrDefault(m => m.Status.Equals(MemberTradeForRechangeStatus.成功) && m.ConglomerationOrderId.Equals(ordersItem.Id));
                    _logger.LogInformation($"支付记录ID :{memberTradeForRechange.Id}");

                    if (memberTradeForRechange == null)
                    {
                        _logger.LogInformation($"错误无法找到支付记录 订单ID :{ordersItem.Id}");
                        return(Error("无法找到支付记录"));
                    }
                    var isOk = refunds.RefundAction(new RefundArgsModel()
                    {
                        ShopFlag = shop.Flag, TradeNo = memberTradeForRechange.TradeNo
                    });
                    _logger.LogInformation($"退款结果 isOk :{isOk.Status}");

                    if (isOk.Status == MemberTradeForRefundStatus.成功)
                    {
                        ordersItem.Status = ShopOrderStatus.已退款;
                    }
                    if (isOk.Status == MemberTradeForRefundStatus.退款中)
                    {
                        ordersItem.Status = ShopOrderStatus.退款中;
                    }
                    ordersItem.ConglomerationSetUp.Status = ConglomerationSetUpStatus.已取消;
                    ShopConglomerationActivityOptions.RemoveSetup(ordersItem.ConglomerationSetUp.Id);
                }
                catch (Exception e)
                {
                    _logger.LogInformation($"更新出错错误信息{e.Message}    订单ID :{ordersItem.Id}");
                }
            }
            shopDb.SaveChanges();
            _logger.LogInformation("=================【更新拼团状态】UpdateConglomeration服务结束==========");

            return(Success("ok"));
        }
예제 #10
0
        public ActionResult TransactionDetails(int id)
        {
            TransactionDetails objTDs = new TransactionDetails(id);
            Payments           objPs  = new Payments(id);
            Transaction        objT   = new Transaction(id);
            Refunds            objRs  = new Refunds(id);

            var tuple = new Tuple <TransactionDetails, Payments, Transaction, Refunds>(objTDs, objPs, objT, objRs);

            return(View(tuple));
        }
예제 #11
0
        public decimal MaximumRefundAvailable()
        {
            //Not really clear on the domain logic for refunds
            var maxRefundAvailable = 0.0m;

            if (Refunds != null)
            {
                maxRefundAvailable = Refunds.Sum(i => i.Amount);
            }

            return(maxRefundAvailable);
        }
예제 #12
0
        public void TestRefundQuery([FromBody] RefundArgsModel args)
        {
            //  this.LogDbContext.Add(new TaskLog() { TaskName = "TestRefund", ExeResult = "" });
            //this.LogDbContext.SaveChanges();
            Refunds refund = new Refunds(proxyFactory);

            refund.RefundAction(new ZRui.Web.Core.Finance.WechatPay.PayAPIModels.RefundArgsModel()
            {
                ShopFlag = args.ShopFlag,
                TradeNo  = args.TradeNo,
            });
        }
예제 #13
0
        //[Authorize]
        public APIResult OnRefund([FromBody] ConglomerationOrderRequestModel input)
        {
            var order = db.ConglomerationOrder.Find(input.ConglomerationOrderId);

            if (order == null)
            {
                return(Error("未找到订单数据"));
            }
            _logger.LogInformation($"退款订单信息:{order.Id}");

            try
            {
                if (!order.ShopId.Equals(input.ShopId))
                {
                    return(Error("订单与商铺不匹配"));
                }
                if (order.Status.Equals(ShopOrderStatus.待成团) || order.Status.Equals(ShopOrderStatus.待自提) || order.Status.Equals(ShopOrderStatus.待配送) || order.Status.Equals(ShopOrderStatus.退款审批))
                {
                    var     shop    = db.Shops.Find(order.ShopId);
                    Refunds refunds = new Refunds(_proxyFactory);
                    var     memberTradeForRechange = db.MemberTradeForRechange.FirstOrDefault(m => m.Status.Equals(MemberTradeForRechangeStatus.成功) && m.ConglomerationOrderId.Equals(order.Id));
                    if (memberTradeForRechange == null)
                    {
                        return(Error("无法找到支付记录"));
                    }
                    var isOk = refunds.RefundAction(new RefundArgsModel()
                    {
                        ShopFlag = shop.Flag, TradeNo = memberTradeForRechange.TradeNo
                    });
                    if (isOk.Status == MemberTradeForRefundStatus.成功)
                    {
                        order.Status = ShopOrderStatus.已退款;
                        db.SaveChanges();
                        return(Success("您的退款申请已提交,银行处理退款中"));
                    }
                    if (isOk.Status == MemberTradeForRefundStatus.退款中)
                    {
                        order.Status = ShopOrderStatus.退款中;
                        db.SaveChanges();
                        return(Success("您的退款申请已提交,银行处理退款中"));
                    }
                }
                order.Status = ShopOrderStatus.退款中;
                return(Error("退款失败请联系管理员"));
            }
            catch (Exception e)
            {
                _logger.LogInformation($"退款订单信息:{e}");
                return(Error(e.Message));
            }
        }
예제 #14
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is SearchTerminalRefundsResponse other &&
                   ((Context == null && other.Context == null) || (Context?.Equals(other.Context) == true)) &&
                   ((Errors == null && other.Errors == null) || (Errors?.Equals(other.Errors) == true)) &&
                   ((Refunds == null && other.Refunds == null) || (Refunds?.Equals(other.Refunds) == true)) &&
                   ((Cursor == null && other.Cursor == null) || (Cursor?.Equals(other.Cursor) == true)));
        }
예제 #15
0
        // Returns: Amount to refund via PaymentProvider
        public decimal ApplyRefund(Refund refund)
        {
            // If we haven't already tried to apply this refund
            if (Refunds.Select(r => r.IdempotencyKey).Contains(refund.IdempotencyKey))
            {
                throw new Exception();
            }

            refund.AmountRefunded = MaximumRefundAvailable();
            Refunds.Add(refund);

            foreach (Installment installment in Installments)
            {
                // Do this so everything gets set as 'paid'
                installment.SetPaid(Id, DateTime.Now);
            }
            return(refund.AmountRefunded);
        }
예제 #16
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Order other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Source == null && other.Source == null) || (Source?.Equals(other.Source) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((LineItems == null && other.LineItems == null) || (LineItems?.Equals(other.LineItems) == true)) &&
                   ((Taxes == null && other.Taxes == null) || (Taxes?.Equals(other.Taxes) == true)) &&
                   ((Discounts == null && other.Discounts == null) || (Discounts?.Equals(other.Discounts) == true)) &&
                   ((ServiceCharges == null && other.ServiceCharges == null) || (ServiceCharges?.Equals(other.ServiceCharges) == true)) &&
                   ((Fulfillments == null && other.Fulfillments == null) || (Fulfillments?.Equals(other.Fulfillments) == true)) &&
                   ((Returns == null && other.Returns == null) || (Returns?.Equals(other.Returns) == true)) &&
                   ((ReturnAmounts == null && other.ReturnAmounts == null) || (ReturnAmounts?.Equals(other.ReturnAmounts) == true)) &&
                   ((NetAmounts == null && other.NetAmounts == null) || (NetAmounts?.Equals(other.NetAmounts) == true)) &&
                   ((RoundingAdjustment == null && other.RoundingAdjustment == null) || (RoundingAdjustment?.Equals(other.RoundingAdjustment) == true)) &&
                   ((Tenders == null && other.Tenders == null) || (Tenders?.Equals(other.Tenders) == true)) &&
                   ((Refunds == null && other.Refunds == null) || (Refunds?.Equals(other.Refunds) == true)) &&
                   ((Metadata == null && other.Metadata == null) || (Metadata?.Equals(other.Metadata) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((ClosedAt == null && other.ClosedAt == null) || (ClosedAt?.Equals(other.ClosedAt) == true)) &&
                   ((State == null && other.State == null) || (State?.Equals(other.State) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((TotalMoney == null && other.TotalMoney == null) || (TotalMoney?.Equals(other.TotalMoney) == true)) &&
                   ((TotalTaxMoney == null && other.TotalTaxMoney == null) || (TotalTaxMoney?.Equals(other.TotalTaxMoney) == true)) &&
                   ((TotalDiscountMoney == null && other.TotalDiscountMoney == null) || (TotalDiscountMoney?.Equals(other.TotalDiscountMoney) == true)) &&
                   ((TotalTipMoney == null && other.TotalTipMoney == null) || (TotalTipMoney?.Equals(other.TotalTipMoney) == true)) &&
                   ((TotalServiceChargeMoney == null && other.TotalServiceChargeMoney == null) || (TotalServiceChargeMoney?.Equals(other.TotalServiceChargeMoney) == true)) &&
                   ((PricingOptions == null && other.PricingOptions == null) || (PricingOptions?.Equals(other.PricingOptions) == true)) &&
                   ((Rewards == null && other.Rewards == null) || (Rewards?.Equals(other.Rewards) == true)));
        }
예제 #17
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is V1Payment other &&
                   ((Context == null && other.Context == null) || (Context?.Equals(other.Context) == true)) &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((MerchantId == null && other.MerchantId == null) || (MerchantId?.Equals(other.MerchantId) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((CreatorId == null && other.CreatorId == null) || (CreatorId?.Equals(other.CreatorId) == true)) &&
                   ((Device == null && other.Device == null) || (Device?.Equals(other.Device) == true)) &&
                   ((PaymentUrl == null && other.PaymentUrl == null) || (PaymentUrl?.Equals(other.PaymentUrl) == true)) &&
                   ((ReceiptUrl == null && other.ReceiptUrl == null) || (ReceiptUrl?.Equals(other.ReceiptUrl) == true)) &&
                   ((InclusiveTaxMoney == null && other.InclusiveTaxMoney == null) || (InclusiveTaxMoney?.Equals(other.InclusiveTaxMoney) == true)) &&
                   ((AdditiveTaxMoney == null && other.AdditiveTaxMoney == null) || (AdditiveTaxMoney?.Equals(other.AdditiveTaxMoney) == true)) &&
                   ((TaxMoney == null && other.TaxMoney == null) || (TaxMoney?.Equals(other.TaxMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((DiscountMoney == null && other.DiscountMoney == null) || (DiscountMoney?.Equals(other.DiscountMoney) == true)) &&
                   ((TotalCollectedMoney == null && other.TotalCollectedMoney == null) || (TotalCollectedMoney?.Equals(other.TotalCollectedMoney) == true)) &&
                   ((ProcessingFeeMoney == null && other.ProcessingFeeMoney == null) || (ProcessingFeeMoney?.Equals(other.ProcessingFeeMoney) == true)) &&
                   ((NetTotalMoney == null && other.NetTotalMoney == null) || (NetTotalMoney?.Equals(other.NetTotalMoney) == true)) &&
                   ((RefundedMoney == null && other.RefundedMoney == null) || (RefundedMoney?.Equals(other.RefundedMoney) == true)) &&
                   ((SwedishRoundingMoney == null && other.SwedishRoundingMoney == null) || (SwedishRoundingMoney?.Equals(other.SwedishRoundingMoney) == true)) &&
                   ((GrossSalesMoney == null && other.GrossSalesMoney == null) || (GrossSalesMoney?.Equals(other.GrossSalesMoney) == true)) &&
                   ((NetSalesMoney == null && other.NetSalesMoney == null) || (NetSalesMoney?.Equals(other.NetSalesMoney) == true)) &&
                   ((InclusiveTax == null && other.InclusiveTax == null) || (InclusiveTax?.Equals(other.InclusiveTax) == true)) &&
                   ((AdditiveTax == null && other.AdditiveTax == null) || (AdditiveTax?.Equals(other.AdditiveTax) == true)) &&
                   ((Tender == null && other.Tender == null) || (Tender?.Equals(other.Tender) == true)) &&
                   ((Refunds == null && other.Refunds == null) || (Refunds?.Equals(other.Refunds) == true)) &&
                   ((Itemizations == null && other.Itemizations == null) || (Itemizations?.Equals(other.Itemizations) == true)) &&
                   ((SurchargeMoney == null && other.SurchargeMoney == null) || (SurchargeMoney?.Equals(other.SurchargeMoney) == true)) &&
                   ((Surcharges == null && other.Surcharges == null) || (Surcharges?.Equals(other.Surcharges) == true)) &&
                   ((IsPartial == null && other.IsPartial == null) || (IsPartial?.Equals(other.IsPartial) == true)));
        }
예제 #18
0
        public JudoPayApi(Func <Type, ILog> logger, IClient client)
        {
            Payments      = new Payments(logger(typeof(Payments)), client, true);
            Refunds       = new Refunds(logger(typeof(Refunds)), client);
            PreAuths      = new PreAuths(logger(typeof(PreAuths)), client, true);
            Transactions  = new Transactions(logger(typeof(Transactions)), client);
            Collections   = new Collections(logger(typeof(Collections)), client);
            ThreeDs       = new ThreeDs(logger(typeof(ThreeDs)), client);
            RegisterCards = new RegisterCards(logger(typeof(RegisterCards)), client, true);
            SaveCards     = new SaveCard(logger(typeof(SaveCard)), client);
            Voids         = new Voids(logger(typeof(Voids)), client);

            WebPayments = new WebPayments
            {
                Payments     = new Clients.WebPayments.Payments(logger(typeof(Clients.WebPayments.Payments)), client),
                PreAuths     = new Clients.WebPayments.PreAuths(logger(typeof(Clients.WebPayments.PreAuths)), client),
                Transactions = new Clients.WebPayments.Transactions(logger(typeof(Clients.WebPayments.Transactions)), client)
            };

            Consumers  = new Consumers(logger(typeof(Consumers)), client);
            Connection = client.Connection;
        }
예제 #19
0
        // Returns: Amount to refund via PaymentProvider
        public decimal ApplyRefund(Refund refund)
        {
            var refundedAmountAgainstPaidInstallments =
                Installments
                .Where(i => i.IsPaid)
                .Sum(i => i.Amount);

            Refunds.Add(refund);

            var refundBalance = refund.Amount;

            foreach (var installment in Installments)
            {
                if (refundBalance >= installment.Amount)
                {
                    MakePayment(installment.Amount, installment.Id);
                }

                refundBalance = refundBalance - installment.Amount;
            }

            return(refundedAmountAgainstPaidInstallments);
        }
예제 #20
0
        public static void MerchantTwo()
        {
            Connection   connection        = new Connection();
            Sendmail     sendmail          = new Sendmail();
            Transactions excelTransactions = new Transactions();
            Refunds      excelRefunds      = new Refunds();

            string excel    = "Merchant Two.xlsx";
            var    workBook = new XLWorkbook();

            MailMessage message = new MailMessage();

            message.To.Add(new MailAddress($"*****@*****.**"));
            message.To.Add(new MailAddress($"*****@*****.**"));

            try
            {
                SqlDataReader sqlTransactions = connection.SqlConnection("EXEC dbo.stp_Report @merchantId='C6915847-6627-4CA0-AA02-7A0C4BA274D3', @relatorio='Transactions';");
                excelTransactions.ExcelTransactions(sqlTransactions, workBook);
                connection.ConnectionClose();

                SqlDataReader sqlRefunds = connection.SqlConnection("EXEC dbo.stp_Report @merchantId='C6915847-6627-4CA0-AA02-7A0C4BA274D3', @relatorio='Refunds';");
                excelRefunds.ExcelRefunds(sqlRefunds, workBook);
                connection.ConnectionClose();

                workBook.SaveAs(excel);
                Attachment attachment = new Attachment(excel, "application/vnd.ms-excel");

                sendmail.Email(attachment, message, "Relatório MerchantTwo", "Olá,\n\nSegue em anexo relatório.\n\nAtenciosamente,");
            }
            catch (Exception e)
            {
                Guid guid = Guid.NewGuid();
                SaveLog.Logs(guid, "MerchantTwo", e);
                sendmail.Email(message, "Falha ao enviar relatório", $"Atenção!\n\nOcorreu uma falha ao enviar o relatório da loja MerchantTwo, para detalhes utilize o CurrentId: {guid} para consultar os logs.");
            }
        }
예제 #21
0
        // Returns: Amount to refund via PaymentProvider
        public decimal ApplyRefund(Refund refund)
        {
            var refundedAmount = Installments.Where(i => i.IsPaid).Sum(j => j.Amount);

            if (Refunds == null)
            {
                Refunds = new List <Refund>();
            }
            Refunds.Add(refund);

            var refundBalance = refund.Amount;

            foreach (var installment in Installments)
            {
                if (refundBalance >= installment.Amount)
                {
                    MakePayment(installment.Amount, installment.Id);
                }

                refundBalance = refundBalance - installment.Amount;
            }

            return(refundedAmount);
        }
예제 #22
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Transaction other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((Tenders == null && other.Tenders == null) || (Tenders?.Equals(other.Tenders) == true)) &&
                   ((Refunds == null && other.Refunds == null) || (Refunds?.Equals(other.Refunds) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((Product == null && other.Product == null) || (Product?.Equals(other.Product) == true)) &&
                   ((ClientId == null && other.ClientId == null) || (ClientId?.Equals(other.ClientId) == true)) &&
                   ((ShippingAddress == null && other.ShippingAddress == null) || (ShippingAddress?.Equals(other.ShippingAddress) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)));
        }
예제 #23
0
 public decimal MaximumRefundAvailable()
 => Refunds.Sum(r => r.Amount);
예제 #24
0
        //[Authorize]
        public async Task <APIResult> ManagerRefund([FromBody] ToAmountArgsModel args)
        {
            string exmsg = string.Empty;

            try
            {
                var shoporder = db.Set <ShopOrder>().FirstOrDefault(r => r.Id == args.id);
                //if (shoporder == null) throw new Exception("未找到此订单");
                //CheckShopActor(shoporder.ShopId, ShopActorType.超级管理员);//检测用户权限
                var shopMemberConsume = db.GetSingle <ShopMemberConsume>(shoporder.ShopMemberConsumeId ?? 0);
                if (shopMemberConsume != null)
                {
                    var shopMemberRufund = db.Query <ShopMemberRufund>()
                                           .Where(m => !m.IsDel && m.ShopOrderId == shoporder.Id)
                                           .FirstOrDefault();
                    if (shopMemberRufund != null)
                    {
                        throw new Exception("该订单已退款");
                    }
                    ShopMemberServer shopMemberServer = new ShopMemberServer(db, shoporder.ShopId, shoporder.MemberId);
                    shopMemberServer.RefundToBalance(shoporder);
                    shoporder.Status = ShopOrderStatus.已退款;
                    db.SaveChanges();
                    var orderType = await ShopIntegralRechargeServer.GetOrderSourceType(db, args.id, false, _logger); //积分回滚

                    await ShopIntegralRechargeServer.IntegralReturn(db, args.id, orderType, _logger);

                    return(Success("退款成功"));
                }
                else
                {
                    var shoppayinfo = db.Set <ShopPayInfo>().FirstOrDefault(r => r.ShopId == shoporder.ShopId && r.IsEnable == true);
                    if (shoppayinfo == null)
                    {
                        throw new Exception("未找到商户退款配置");
                    }
                    var membertradeforrechange = financeDb.Set <MemberTradeForRechange>().Where(r => r.OrderId == shoporder.Id && r.OrderType == OrderType.普通订单 && r.Status == MemberTradeForRechangeStatus.成功);

                    if (membertradeforrechange != null && membertradeforrechange.Count() > 0) //代表有支付成功的数据
                    {
                        Refunds refunds      = new Refunds(proxyFactory);
                        var     refundresult = refunds.RefundAction(new RefundArgsModel()
                        {
                            ShopFlag = shoppayinfo.ShopFlag, TradeNo = membertradeforrechange.First().TradeNo, OrderType = OrderType.普通订单, OrderId = shoporder.Id
                        });
                        if (refundresult.Status == MemberTradeForRefundStatus.成功)
                        {
                            shoporder.Status = ShopOrderStatus.已退款;
                            DecreaseCommodity(shoporder);
                            db.SaveChanges();
                            return(Success());
                        }
                        else if (refundresult.Status == MemberTradeForRefundStatus.退款中)
                        {
                            shoporder.Status = ShopOrderStatus.退款中;
                            db.SaveChanges();
                        }
                        else
                        {
                            shoporder.Status = ShopOrderStatus.退款中;
                            db.SaveChanges();
                        }
                        var orderType = await ShopIntegralRechargeServer.GetOrderSourceType(db, args.id, false, _logger); //积分回滚

                        await ShopIntegralRechargeServer.IntegralReturn(db, args.id, orderType, _logger);

                        return(Success("您的退款申请已经提交,银行处理退款中"));
                    }
                    else
                    {
                        throw new Exception($"找不到订单{shoporder.OrderNumber}支付成功的记录");
                    }
                }
            }
            catch (Exception ex)
            {
                exmsg = ex.Message;
                throw new Exception(ex.Message);
            }
        }
예제 #25
0
        public override int GetHashCode()
        {
            int hashCode = 401631729;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (ReferenceId != null)
            {
                hashCode += ReferenceId.GetHashCode();
            }

            if (Source != null)
            {
                hashCode += Source.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (LineItems != null)
            {
                hashCode += LineItems.GetHashCode();
            }

            if (Taxes != null)
            {
                hashCode += Taxes.GetHashCode();
            }

            if (Discounts != null)
            {
                hashCode += Discounts.GetHashCode();
            }

            if (ServiceCharges != null)
            {
                hashCode += ServiceCharges.GetHashCode();
            }

            if (Fulfillments != null)
            {
                hashCode += Fulfillments.GetHashCode();
            }

            if (Returns != null)
            {
                hashCode += Returns.GetHashCode();
            }

            if (ReturnAmounts != null)
            {
                hashCode += ReturnAmounts.GetHashCode();
            }

            if (NetAmounts != null)
            {
                hashCode += NetAmounts.GetHashCode();
            }

            if (RoundingAdjustment != null)
            {
                hashCode += RoundingAdjustment.GetHashCode();
            }

            if (Tenders != null)
            {
                hashCode += Tenders.GetHashCode();
            }

            if (Refunds != null)
            {
                hashCode += Refunds.GetHashCode();
            }

            if (Metadata != null)
            {
                hashCode += Metadata.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            if (ClosedAt != null)
            {
                hashCode += ClosedAt.GetHashCode();
            }

            if (State != null)
            {
                hashCode += State.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (TotalMoney != null)
            {
                hashCode += TotalMoney.GetHashCode();
            }

            if (TotalTaxMoney != null)
            {
                hashCode += TotalTaxMoney.GetHashCode();
            }

            if (TotalDiscountMoney != null)
            {
                hashCode += TotalDiscountMoney.GetHashCode();
            }

            if (TotalTipMoney != null)
            {
                hashCode += TotalTipMoney.GetHashCode();
            }

            if (TotalServiceChargeMoney != null)
            {
                hashCode += TotalServiceChargeMoney.GetHashCode();
            }

            if (PricingOptions != null)
            {
                hashCode += PricingOptions.GetHashCode();
            }

            if (Rewards != null)
            {
                hashCode += Rewards.GetHashCode();
            }

            return(hashCode);
        }
예제 #26
0
        /// <summary>
        /// Put function to update the cancel status of booking
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="PackageBookingId"></param>
        /// <param name="PackageId"></param>
        public void CancelBooking(string Id, int PackageBookingId, int PackageId)
        {
            PackageBooking packageBooking = new PackageBooking();
            var            associatedData = db.PackageBookings.Where(x => x.PackageBookingID == PackageBookingId).FirstOrDefault();

            packageBooking.Id = Id;
            packageBooking.PackageBookingID = PackageBookingId;
            packageBooking.PackageID        = PackageId;
            packageBooking.BookingStatus    = "Cancelled";
            packageBooking.StartDate        = associatedData.StartDate;
            packageBooking.EndDate          = associatedData.EndDate;
            packageBooking.PaymentMethod    = associatedData.PaymentMethod;
            packageBooking.IsCustomized     = associatedData.IsCustomized;
            packageBooking.TotalCost        = associatedData.TotalCost;
            packageBooking.NumPeople        = associatedData.NumPeople;
            //db.Entry(packageBooking).State = EntityState.Modified;
            db.Entry(associatedData).CurrentValues.SetValues(packageBooking);
            db.SaveChanges();

            Package package = new Package();

            if (packageBooking.IsCustomized)
            {
                package = (from custom in db.UserCustomizations
                           join pack in db.Packages on custom.PackageID equals pack.PackageID
                           where custom.CustomPackageID == PackageId
                           select pack).AsEnumerable().ToList()[0];
            }
            else
            {
                package = db.Packages.Where(x => x.PackageID == PackageId).FirstOrDefault();
            }
            //var packageassociatedData = db.Packages.Where(x => x.PackageID == PackageId).FirstOrDefault();
            //package.PackageID = PackageId;
            package.NumberAvailable = package.NumberAvailable++;

            /*package.PackageTypeID = packageassociatedData.PackageTypeID;
             * package.PackageName = packageassociatedData.PackageName;
             * package.Days = packageassociatedData.Days;
             * package.ProfitPercentage = packageassociatedData.ProfitPercentage;
             * package.Price = packageassociatedData.Price;
             * package.Summary = packageassociatedData.Summary;
             * package.MinPeople = packageassociatedData.MinPeople;
             * package.MaxPeople= packageassociatedData.MaxPeople;
             * package.Image = packageassociatedData.Image;*/

            db.Entry(package).CurrentValues.SetValues(package);
            db.SaveChanges();



            if (associatedData.PaymentMethod != "PayLater")
            {
                Refunds refunds = new Refunds();
                refunds.UserId           = Id;
                refunds.RefundDate       = DateTime.Now;
                refunds.PackageBookingID = PackageBookingId;
                int     datediff = (int)(associatedData.StartDate - DateTime.Now).TotalDays;
                var     value    = db.RefundsRules.OrderByDescending(RefundsRules => RefundsRules.Days).Where(x => x.Days == datediff).FirstOrDefault();
                decimal val;
                if (value == null)
                {
                    refunds.RefundRuleId = 12;
                    refunds.RefundAmount = associatedData.TotalCost;
                }
                else
                {
                    val = value.RefundPercentage;
                    refunds.RefundRuleId = value.RefundRuleId;
                    decimal refundAmount = associatedData.TotalCost * (val / 100);
                    refunds.RefundAmount = associatedData.TotalCost - refundAmount;
                }


                //refunds.RefundAmount = associatedData.TotalCost * (val / 100);
                db.Refunds.Add(refunds);
                db.SaveChanges();
            }
        }
예제 #27
0
        public override int GetHashCode()
        {
            int hashCode = -215174345;

            if (Context != null)
            {
                hashCode += Context.GetHashCode();
            }

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (MerchantId != null)
            {
                hashCode += MerchantId.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (CreatorId != null)
            {
                hashCode += CreatorId.GetHashCode();
            }

            if (Device != null)
            {
                hashCode += Device.GetHashCode();
            }

            if (PaymentUrl != null)
            {
                hashCode += PaymentUrl.GetHashCode();
            }

            if (ReceiptUrl != null)
            {
                hashCode += ReceiptUrl.GetHashCode();
            }

            if (InclusiveTaxMoney != null)
            {
                hashCode += InclusiveTaxMoney.GetHashCode();
            }

            if (AdditiveTaxMoney != null)
            {
                hashCode += AdditiveTaxMoney.GetHashCode();
            }

            if (TaxMoney != null)
            {
                hashCode += TaxMoney.GetHashCode();
            }

            if (TipMoney != null)
            {
                hashCode += TipMoney.GetHashCode();
            }

            if (DiscountMoney != null)
            {
                hashCode += DiscountMoney.GetHashCode();
            }

            if (TotalCollectedMoney != null)
            {
                hashCode += TotalCollectedMoney.GetHashCode();
            }

            if (ProcessingFeeMoney != null)
            {
                hashCode += ProcessingFeeMoney.GetHashCode();
            }

            if (NetTotalMoney != null)
            {
                hashCode += NetTotalMoney.GetHashCode();
            }

            if (RefundedMoney != null)
            {
                hashCode += RefundedMoney.GetHashCode();
            }

            if (SwedishRoundingMoney != null)
            {
                hashCode += SwedishRoundingMoney.GetHashCode();
            }

            if (GrossSalesMoney != null)
            {
                hashCode += GrossSalesMoney.GetHashCode();
            }

            if (NetSalesMoney != null)
            {
                hashCode += NetSalesMoney.GetHashCode();
            }

            if (InclusiveTax != null)
            {
                hashCode += InclusiveTax.GetHashCode();
            }

            if (AdditiveTax != null)
            {
                hashCode += AdditiveTax.GetHashCode();
            }

            if (Tender != null)
            {
                hashCode += Tender.GetHashCode();
            }

            if (Refunds != null)
            {
                hashCode += Refunds.GetHashCode();
            }

            if (Itemizations != null)
            {
                hashCode += Itemizations.GetHashCode();
            }

            if (SurchargeMoney != null)
            {
                hashCode += SurchargeMoney.GetHashCode();
            }

            if (Surcharges != null)
            {
                hashCode += Surcharges.GetHashCode();
            }

            if (IsPartial != null)
            {
                hashCode += IsPartial.GetHashCode();
            }

            return(hashCode);
        }
예제 #28
0
        public override int GetHashCode()
        {
            unchecked {
                int hash = 17;
                if (Status != default(ChargeStatus))
                {
                    hash = hash * 23 + Status.GetHashCode();
                }
                if (Amount != default(long))
                {
                    hash = hash * 23 + Amount.GetHashCode();
                }
                if (Currency != default(string))
                {
                    hash = hash * 23 + Currency.GetHashCode();
                }
                if (Description != default(string))
                {
                    hash = hash * 23 + Description.GetHashCode();
                }
                if (Metadata != default(IDictionary <string, object>))
                {
                    hash = hash * 23 + Metadata.GetHashCode();
                }
                if (Capture != default(bool))
                {
                    hash = hash * 23 + Capture.GetHashCode();
                }
                if (Authorized != default(bool))
                {
                    hash = hash * 23 + Authorized.GetHashCode();
                }
                if (Reversed != default(bool))
                {
                    hash = hash * 23 + Reversed.GetHashCode();
                }
                if (Paid != default(bool))
                {
                    hash = hash * 23 + Paid.GetHashCode();
                }
                if (Transaction != default(string))
                {
                    hash = hash * 23 + Transaction.GetHashCode();
                }
                if (SourceOfFund != default(SourceOfFunds))
                {
                    hash = hash * 23 + SourceOfFund.GetHashCode();
                }
                if (Card != default(Card))
                {
                    hash = hash * 23 + Card.GetHashCode();
                }
                if (Refunded != default(long))
                {
                    hash = hash * 23 + Refunded.GetHashCode();
                }
                if (Refunds != default(ScopedList <Refund>))
                {
                    hash = hash * 23 + Refunds.GetHashCode();
                }
                if (FailureCode != default(string))
                {
                    hash = hash * 23 + FailureCode.GetHashCode();
                }
                if (FailureMessage != default(string))
                {
                    hash = hash * 23 + FailureMessage.GetHashCode();
                }
                if (Customer != default(string))
                {
                    hash = hash * 23 + Customer.GetHashCode();
                }
                if (IP != default(string))
                {
                    hash = hash * 23 + IP.GetHashCode();
                }
                if (Dispute != default(Dispute))
                {
                    hash = hash * 23 + Dispute.GetHashCode();
                }
                if (ReturnURI != default(string))
                {
                    hash = hash * 23 + ReturnURI.GetHashCode();
                }
                if (AuthorizeURI != default(string))
                {
                    hash = hash * 23 + AuthorizeURI.GetHashCode();
                }
                if (Offsite != default(OffsiteTypes))
                {
                    hash = hash * 23 + Offsite.GetHashCode();
                }
                if (InstallmentTerms != default(int))
                {
                    hash = hash * 23 + InstallmentTerms.GetHashCode();
                }

                return(hash);
            }
        }