コード例 #1
0
ファイル: Program.cs プロジェクト: Smitsel/mollie-api-csharp
        static void Main(string[] args)
        {
            MollieClient mollieClient = new MollieClient(ConfigurationManager.AppSettings["mollie_api_key"]);

            Console.WriteLine("Loading iDeal issuers ...");
            Issuers issuers = mollieClient.ListIssuers();

            foreach (Issuer issuer in issuers.data)
            {
                Console.WriteLine(issuer.name);
            }

            Console.WriteLine("Starting payment without method ...");

            Payment payment = new Payment
            {
                amount      = 99.99M,
                description = "Test payment",
                redirectUrl = "http://www.foxip.net/completed/?orderId=1245",
            };

            PaymentStatus status = mollieClient.CreatePayment(payment);

            Console.WriteLine("The status is: " + status.status);
            Console.WriteLine("Please follow this link to start the payment:");
            Console.WriteLine(status.links.paymentUrl);

            Console.WriteLine("Press [enter] to continue ...");
            Console.ReadLine();

            Console.WriteLine("Getting status ...");
            status = mollieClient.GetPayment(status.id);
            Console.WriteLine("The status is now: " + status.status);

            //Refunds only for iDEAL, Bancontact/Mister Cash, SOFORT Banking, creditcard and banktransfer
            Console.WriteLine("Refunding ...");
            try
            {
                RefundStatus refundStatus = mollieClient.CreateRefund(status.id);
                Console.WriteLine("The status is now: " + refundStatus.payment.status);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
            }

            Console.WriteLine("Starting payment with a specific method ...");
            status = mollieClient.CreatePayment(new Payment
            {
                amount      = 1.99M,
                method      = Method.mistercash,
                description = "Test payment",
                redirectUrl = "http://www.foxip.net/completed/?orderId=12345"
            });
            Console.WriteLine("The status is: " + status.status);
            Console.WriteLine("Please follow this link to start the payment:");
            Console.WriteLine(status.links.paymentUrl);
            Console.WriteLine("Press [enter] to continue ...");
            Console.ReadLine();
        }
コード例 #2
0
ファイル: OrderController.cs プロジェクト: haixie/test
        public async Task <IActionResult> ReturnOrder(OrderViewModel viewModel, RefundStatus refundStatus, RefundReason refundReason)
        {
            return(await ModifyOrderView("ReturnDone", viewModel, async order =>
            {
                #region Fraud Protection Service
                var refund = new Refund
                {
                    RefundId = Guid.NewGuid().ToString(),
                    Amount = order.Total,
                    Currency = order.RiskPurchase?.Currency,
                    BankEventTimestamp = DateTimeOffset.Now,
                    PurchaseId = order.RiskPurchase.PurchaseId,
                    Reason = refundReason.ToString(),
                    Status = refundStatus.ToString(),
                    UserId = order.RiskPurchase.User.UserId,
                };

                var correlationId = _fraudProtectionService.NewCorrelationId;
                var response = await _fraudProtectionService.PostRefund(refund, correlationId);

                var fraudProtectionIO = new FraudProtectionIOModel(correlationId, refund, response, "Refund");
                TempData.Put(FraudProtectionIOModel.TempDataKey, fraudProtectionIO);
                #endregion

                order.ReturnOrChargebackReason = refundReason.ToString();
                order.Status = refundStatus == RefundStatus.Approved ? OrderStatus.ReturnCompleted : OrderStatus.ReturnRejected;
                order.RiskRefund = refund;
                order.RiskRefundResponse = response;
            }));
        }
コード例 #3
0
ファイル: RefundApply.cs プロジェクト: spiltservice/cloudshop
        private string GetOperText(RefundStatus status)
        {
            string result = "处理";

            if (status == RefundStatus.Refused || status == RefundStatus.Refunded)
            {
                result = "详情";
            }
            return(result);
        }
コード例 #4
0
ファイル: RefundApply.cs プロジェクト: spiltservice/cloudshop
        private string GetStatusText(RefundStatus Status, string exceptionInfo)
        {
            string text = "";

            if (!string.IsNullOrEmpty(exceptionInfo) && Status == RefundStatus.Applied)
            {
                text = "异常";
            }
            return(EnumDescription.GetEnumDescription((Enum)(object)Status, 0));
        }
コード例 #5
0
        /// <summary>
        /// 更新销售退款单状态
        /// </summary>
        /// <param name="sysNo">销售退款单系统编号</param>
        /// <param name="userSysNo">引起状态改变的操作人系统编号,如果不是审核动作可以填null</param>
        /// <param name="status">销售退款单的目标状态</param>
        /// <param name="auditTime">审核时间,如果不是审核动作可以填null</param>
        public bool UpdateStatus(int sysNo, int?userSysNo, RefundStatus status, DateTime?auditTime)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateSOIncomeRefundStatus");

            command.SetParameterValue("@SysNo", sysNo);
            command.SetParameterValue("@AuditUserSysNo", userSysNo);
            command.SetParameterValue("@AuditTime", auditTime);
            command.SetParameterValue("@Status", status);

            return(command.ExecuteNonQuery() > 0);
        }
コード例 #6
0
        /// <summary>
        /// 退款结果
        /// </summary>
        /// <param name="localRefundNo">本地退款单号</param>
        /// <param name="refundStatus">退款状态</param>
        /// <param name="realRefundAmount">实际退款金额</param>
        /// <param name="successTime">成功退款时间</param>
        /// <param name="failReason">退款失败的原因</param>
        /// <param name="originData">http原始数据</param>
        /// <returns></returns>
        public async Task DoRefundResult(string refundNo, string localRefundNo, RefundStatus refundStatus,
                                         int realRefundAmount,
                                         long?successTime, string failReason, string originData)
        {
            if (refundStatus == RefundStatus.RefundProcessing)
            {
                return;
            }

            var refund = await DbContext.Set <RefundOrders>().Include(r => r.PrepayOrder)
                         .FirstOrDefaultAsync(r => r.LocalRefundNo == localRefundNo);

            if (refund == null)
            {
                throw new Exception($"退款订单不存在,localRefundNo: {localRefundNo}");
            }

            if (refund.RefundStatus != RefundStatus.RefundProcessing)
            {
                throw new Exception($"退款异常,状态错误,localRefundNo: {localRefundNo},数据库状态: {refund.RefundStatus}");
            }

            refund.RefundStatus     = refundStatus;
            refund.SuccessTime      = successTime;
            refund.RealRefundAmount = realRefundAmount;
            refund.FailReason       = failReason;
            refund.OriginalData     = originData;
            refund.RefundNo         = refundNo;

            using var locker = Locker.Lock(Lockers.RefundOrderCreate.Format(refund.Id), 3);
            using var tran   = DbContext.Database.BeginTransaction();
            try
            {
                await DbContext.SaveChangesAsync();

                await EventPublisher.PublishAsync(new RefundOrderResultEvent
                {
                    FailReason       = failReason,
                    RealRefundAmount = realRefundAmount,
                    SourceType       = refund.PrepayOrder.SourceType,
                    SourceSn         = refund.PrepayOrder.SourceSn,
                    Status           = refundStatus,
                    SuccessTime      = successTime
                });

                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
        }
コード例 #7
0
        private void listRefundOrder_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            HtmlAnchor   htmlAnchor   = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
            RefundStatus refundStatus = (RefundStatus)DataBinder.Eval(e.Item.DataItem, "HandleStatus");
            Label        label        = (Label)e.Item.FindControl("lblHandleStatus");

            if (label != null)
            {
                label.Text = EnumDescription.GetEnumDescription((Enum)(object)(RefundStatus)(int)DataBinder.Eval(e.Item.DataItem, "HandleStatus"), 0);
            }
        }
コード例 #8
0
ファイル: EmOrderManageCtrl.cs プロジェクト: jollitycn/JGNet
        public void WorkDeskCtrlSearch(EmRetailOrderState orderState, RefundStatus refund)
        {
            //skinComboBoxOrderState.SelectedValue = orderState;
            //skinComboBoxRefundState.SelectedValue = refund;
            //DateTimeUtil.DateTimePicker_All(dateTimePicker_Start, dateTimePicker_End);
            if (orderState == EmRetailOrderState.All && refund == RefundStatus.Refunding)
            {
                tabControl1.SelectTab(4);
            }
            else if (orderState == EmRetailOrderState.WaitDelivery && refund == RefundStatus.NotSelect)
            {
                tabControl1.SelectTab(2);
            }

            // tabControl1_SelectedIndexChanged(null, null);
            //  BaseButton_Search_Click(null, null);
        }
コード例 #9
0
        public async Task <RefundStatus> Refund(string transactionID, string orderID, string refundID, int totalAmount, int refundAmount, string currency)
        {
            throw new NotImplementedException();
            dynamic postData = new WxPayData(_configuration.APIKey);

            postData.appid           = _configuration.AppID;
            postData.mch_id          = _configuration.MechantID;
            postData.out_trade_no    = orderID;
            postData.transaction_id  = transactionID;
            postData.out_refund_no   = refundID;
            postData.total_fee       = totalAmount;
            postData.refund_fee      = refundAmount;
            postData.refund_fee_type = currency;
            postData.op_user_id      = _configuration.MechantID;
            postData.Sign();
            HttpContent postContent = new ByteArrayContent(postData.ToByteArray());
            var         response    = await _secureHttpClient.PostAsync("refund", postContent);

            if (!response.IsSuccessStatusCode)
            {
                throw new WxPayResponseInvalidException();
            }
            var resContent = await response.Content.ReadAsStringAsync();

            dynamic resData = WxPayData.FromXml(resContent, _configuration.APIKey);

            if (resData.VerifySignature())
            {
                if (resData.return_code != "SUCCESS")
                {
                    throw new WxPayBusinessException(resData.return_code, resData.return_msg);
                }
                else if (resData.result_code != "SUCCESS")
                {
                    throw new WxPayBusinessException(resData.err_code, resData.err_code_des);
                }
                else
                {
                    return(RefundStatus.FromWxPayData(resData));
                }
            }
            else
            {
                throw new WxPaySignatureInvalidException("PlaceOrder return error");
            }
        }
コード例 #10
0
        /// <summary>
        /// 修改退款申请状态 获取订单退款状态
        /// 退款申请状态:申请中=>已撤销 (申请中1,已处理0,已完成0,申请中的申请为自身 ===>订单状态更改为无退款)
        /// 退款申请状态:申请中=>已撤销 (申请中1,已处理0,已完成>0,申请中的申请为自身 ===>订单状态更改为已退款)
        /// 退款申请状态:申请中=>已处理 (对订单退款状态无影响 不需处理 放回原订单退款状态)
        /// 退款申请状态:申请中=>已完成 (申请中1,已处理0,已完成0,申请中的申请为自身 ===>订单状态更改为无退款)
        /// 退款申请状态:申请中=>已完成 (申请中1,已处理0,已完成>0,申请中的申请为自身 ===>订单状态更改为已退款)
        /// 退款申请状态:已处理=>已完成 (申请中0,已处理1,处理中的申请为自身 ===>订单状态更改为已退款)
        /// </summary>
        /// <param name="refund"></param>
        /// <param name="oldRefundStatus"></param>
        /// <returns></returns>
        private OrderRefundStatus GetOrderRefundStatus(OrderRefund refund, RefundStatus oldRefundStatus)
        {
            var order         = _currencyService.GetSingleById <Order>(refund.OrderId);
            var applyingList  = _currencyService.GetList <OrderRefund>(x => x.OrderId == refund.OrderId && x.RefundStatus == RefundStatus.Applying);
            var processedList = _currencyService.GetList <OrderRefund>(x => x.OrderId == refund.OrderId && x.RefundStatus == RefundStatus.Processed);
            var completedList = _currencyService.GetList <OrderRefund>(x => x.OrderId == refund.OrderId && x.RefundStatus == RefundStatus.Completed);

            //原退款状态 申请中
            if (oldRefundStatus == RefundStatus.Applying)
            {
                //申请数为1 已审核为0 且申请为自身
                if (applyingList.Count == 1 && processedList.Count == 0 && applyingList[0].Id == refund.Id)
                {
                    //状态更改为 已完成(审核不通过) 已撤销
                    if (refund.RefundStatus == RefundStatus.Revoked || (refund.RefundStatus == RefundStatus.Completed && refund.ReviewResult == ReviewResult.UnPassed))
                    {
                        if (completedList.Count == 0)
                        {
                            return(OrderRefundStatus.NoRefund);
                        }
                        else
                        {
                            return(OrderRefundStatus.Refunded);
                        }
                    }
                    //状态更改为 已完成(审核通过)
                    else if (refund.RefundStatus == RefundStatus.Completed && refund.ReviewResult == ReviewResult.Passed)
                    {
                        return(OrderRefundStatus.Refunded);
                    }
                }
            }
            else if (oldRefundStatus == RefundStatus.Processed)
            {
                if (applyingList.Count == 0 && processedList.Count == 1 && processedList[0].Id == refund.Id)
                {
                    if (refund.RefundStatus == RefundStatus.Completed)
                    {
                        return(OrderRefundStatus.Refunded);
                    }
                }
            }
            return(order.RefundStatus);
        }
コード例 #11
0
ファイル: EmOrderManageCtrl.cs プロジェクト: jollitycn/JGNet
        public void WorkDeskFilteCtrlSearch(EmRetailOrderState orderState, RefundStatus refund)
        {
            if (orderState == EmRetailOrderState.All && refund == RefundStatus.Refunding)
            {
                tabControl1.SelectTab(4);
            }
            else if (orderState == EmRetailOrderState.WaitDelivery && refund == RefundStatus.NotSelect)
            {
                tabControl1.SelectTab(2);
            }

            DateTimeUtil.DateTimePicker_All(dateTimePicker_Start, dateTimePicker_End);
            GetEmOrderPagePara pageParaOfWork = new GetEmOrderPagePara()
            {
                OrderID           = this.skinTextBoxOrderId.Text,
                StartDate         = new Date(this.dateTimePicker_Start.Value),
                EndDate           = new Date(this.dateTimePicker_End.Value),
                PageIndex         = 0,
                PageSize          = this.dataGridViewPagingSumCtrl.PageSize,
                MemberPhoneOrName = null,
                CostumeIDOrName   = null,
                OrderState        = EmRetailOrderState.All,
                RefundStatus      = RefundStatus.Refunding,
            };

            EmOrderPage          listPage  = GlobalCache.EMallServerProxy.GetEmOrderPage(pageParaOfWork);
            List <EmRetailOrder> orderList = listPage.ResultList.FindAll(t => t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.RefundApplication) || t.RefundStateName == EmRetailOrder.GetRefundState(RefundStateEnum.Refunding));

            dataGridViewPagingSumCtrl.OrderPara = pagePara;
            //this.dataGridViewPagingSumCtrl.Initialize(orderList);

            splitContainer1.Panel2Collapsed = true;
            this.dataGridViewPagingSumCtrl.BindingDataSource <EmRetailOrder>(orderList, null, orderList.Count);
            if (orderList != null && orderList.Count > 0)
            {
                dataGridView1_SelectionChanged(dataGridView1, null);
            }

            UpdateTabPageTitle(false);
        }
コード例 #12
0
        public void Update()
        {
            List <RefundItem> NotDeletedItems = RefundItems == null ? new List <RefundItem>() : RefundItems.Where(ri =>
                                                                                                                  ri.Status != RefundItemStatus.DELETED).ToList();

            //Status
            if (!NotDeletedItems.Any() ||
                NotDeletedItems.Any(ri => ri.Status == RefundItemStatus.UPDATED || ri.Status == RefundItemStatus.CREATED))
            {
                Status = RefundStatus.NON_EXISTENT;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.REJECTED_NO_APPEAL))
            {
                Status = RefundStatus.REJECTED;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.PAID || r.Status == RefundItemStatus.REJECTED_NO_APPEAL))
            {
                Status = RefundStatus.PAID;
            }
            else if (NotDeletedItems.All(r => r.Status == RefundItemStatus.ACCEPTED || r.Status == RefundItemStatus.REJECTED_NO_APPEAL || r.Status == RefundItemStatus.PAID))
            {
                Status = PaymentDate == SqlDateTime.MinValue.Value ? RefundStatus.ACCEPTED : RefundStatus.TO_BE_PAID;
            }
            else if (NotDeletedItems.Any(r => r.Status == RefundItemStatus.REJECTED))
            {
                Status = RefundStatus.WAITING_FOR_FREELANCER;
            }
            else
            {
                Status = RefundStatus.WAITING_FOR_MANAGER;
            }

            //Value
            Value = NotDeletedItems.Count > 0 ? NotDeletedItems.Sum(item => item.Value) : 0;

            //Approved Value
            AcceptedValue = RefundItems == null ? 0 : RefundItems.Sum(item => (item.Status == RefundItemStatus.ACCEPTED ||
                                                                               item.Status == RefundItemStatus.PAID) && item.Status != RefundItemStatus.DELETED ? item.Value : 0);
        }
コード例 #13
0
        private string GetStatusText(RefundStatus Status)
        {
            string text = "";

            return(EnumDescription.GetEnumDescription((Enum)(object)Status, 0));
        }
コード例 #14
0
        public ActionResult Detail(SupportDetail supportdetail)
        {
            decimal      dAmount       = Convert.ToDecimal(supportdetail.SupportRequest.RefundAmount);
            RefundStatus eRefundStatus = supportdetail.SupportRequest.RefundStatus;

            SupportRequest sr = _repository.Find(x => x.ID == supportdetail.SupportRequestID && x.SiteID == Site.ID)
                                .EagerLoad(c => c.AuditDetails, c => c.OrderDetail, c => c.User)
                                .FirstOrDefault();

            supportdetail.SupportRequest = sr;

            if (ModelState.IsValid)
            {
                if (eRefundStatus != RefundStatus.NOACTION && dAmount > sr.OrderDetail.Price)
                {
                    ViewBag.Message = WBSSLStore.Resources.GeneralMessage.Message.Admin_RefundUnsuccessful;
                    return(View(supportdetail));
                }

                User adminUser = user;
                sr.isOpen = Convert.ToBoolean(Request.Form["ddlStatus"]);
                sr.AuditDetails.DateModified   = DateTimeWithZone.Now;
                sr.AuditDetails.HttpHeaderDump = HttpUtility.UrlDecode(System.Web.HttpContext.Current.Request.Headers.ToString());
                sr.AuditDetails.IP             = System.Web.HttpContext.Current.Request.UserHostAddress;
                sr.AuditDetails.ByUserID       = adminUser.ID;

                supportdetail.AuditDetails                = new Audit();
                supportdetail.AuditDetails.ByUserID       = adminUser.ID;
                supportdetail.AuditDetails.DateCreated    = DateTimeWithZone.Now;
                supportdetail.AuditDetails.HttpHeaderDump = Request.Headers.ToString();
                supportdetail.AuditDetails.IP             = Request.UserHostAddress;

                supportdetail.Comments  = "<em><b>" + adminUser.FirstName + " " + adminUser.LastName + " ( " + DateTimeWithZone.Now + " )</b></em><br/>" + supportdetail.Comments;
                supportdetail.StaffNote = "<em><b>" + adminUser.FirstName + " " + adminUser.LastName + " ( " + DateTimeWithZone.Now + " )</b></em><br/>" + supportdetail.StaffNote;


                var _emailservice = DependencyResolver.Current.GetService <IEmailQueueService>();

                switch (eRefundStatus)
                {
                case RefundStatus.NOACTION:
                    supportdetail.SupportRequest.RefundStatusID = (int)RefundStatus.NOACTION;
                    _service.Add(supportdetail);
                    _unitOfWork.Commit();

                    //send mai to admin
                    supportdetail.SupportRequest.OrderDetail.InvoiceNumber = InvoicePrefix + supportdetail.SupportRequest.OrderDetail.OrderID;
                    _emailservice.PrepareEmailQueue(Site.ID, LangID, EmailType.ADMIN_REFUND_NOTIFICATION, SMTPID, supportdetail.SupportRequest.User.Email, supportdetail);
                    _unitOfWork.Commit();

                    break;

                case RefundStatus.CANCEL_ORDER_AND_REFUND:
                    supportdetail.SupportRequest.RefundStatusID = (int)RefundStatus.CANCEL_ORDER_AND_REFUND;
                    supportdetail.SupportRequest.RefundAmount   = dAmount;

                    UserTransaction usertransactionRefund = new UserTransaction();
                    usertransactionRefund.Comment = "Refund given against order and " + (string.IsNullOrEmpty(supportdetail.SupportRequest.OrderDetail.ExternalOrderID) ? "InvoiceID #" + InvoicePrefix + supportdetail.SupportRequest.OrderDetail.OrderID : "order number #" + supportdetail.SupportRequest.OrderDetail.ExternalOrderID);
                    usertransactionRefund.ReceipientInstrumentDetails = "Refund given against order and " + (string.IsNullOrEmpty(supportdetail.SupportRequest.OrderDetail.ExternalOrderID) ? "InvoiceID #" + InvoicePrefix + supportdetail.SupportRequest.OrderDetail.OrderID : "order number #" + supportdetail.SupportRequest.OrderDetail.ExternalOrderID);
                    usertransactionRefund.TransactionAmount           = 0;

                    InsertUpdateDataAndSendMail(usertransactionRefund, supportdetail, _emailservice);
                    break;

                case RefundStatus.CANCEL_ORDER_AND_STORE_CREDIT:
                    supportdetail.SupportRequest.RefundStatusID = (int)RefundStatus.CANCEL_ORDER_AND_STORE_CREDIT;
                    supportdetail.SupportRequest.RefundAmount   = dAmount;

                    UserTransaction usertransaction = new UserTransaction();
                    usertransaction.Comment = "Credit given against order and " + (string.IsNullOrEmpty(supportdetail.SupportRequest.OrderDetail.ExternalOrderID) ? "InvoiceID #" + InvoicePrefix + supportdetail.SupportRequest.OrderDetail.OrderID : "order number #" + supportdetail.SupportRequest.OrderDetail.ExternalOrderID);
                    usertransaction.ReceipientInstrumentDetails = "Credit given against order and " + (string.IsNullOrEmpty(supportdetail.SupportRequest.OrderDetail.ExternalOrderID) ? "InvoiceID #" + InvoicePrefix + supportdetail.SupportRequest.OrderDetail.OrderID : "order number #" + supportdetail.SupportRequest.OrderDetail.ExternalOrderID);
                    usertransaction.TransactionAmount           = dAmount;

                    InsertUpdateDataAndSendMail(usertransaction, supportdetail, _emailservice);
                    break;
                }

                List <SupportDetail> lstSupportDetail = _service.Find(sd => sd.SupportRequestID == supportdetail.SupportRequestID && sd.SupportRequest.SiteID == Site.ID).ToList();

                foreach (SupportDetail x in lstSupportDetail)
                {
                    ViewBag.Comment    += x.Comments + "<br />";
                    ViewBag.StaffNotes += x.StaffNote + "<br />";
                }

                ViewBag.Status  = supportdetail.SupportRequest.isOpen;
                ViewBag.Message = WBSSLStore.Resources.GeneralMessage.Message.OrderStatusSuccess;
            }
            return(View(supportdetail));
        }