public WXSoldRefundDetailToDb(RefundDetail rd) : base(sqlMetaDatas) { SetSqlInt32(0, rd.returnId); SetSqlString(1, rd.orderId); SetSqlString(2, rd.userName); SetSqlDateTime(3, rd.applyForTime ?? SqlTypes.SqlDateTime.Null); SetSqlString(4, rd.adminRemark); SetSqlString(5, rd.userRemark); SetSqlString(6, rd.handleStatus); SetSqlString(7, rd.orderStatus); SetSqlInt32(8, rd.quantity); SetSqlString(9, rd.skuId); SetSqlString(10, rd.productName); SetSqlString(11, rd.returnReason); SetSqlString(12, rd.userCredentials); SetSqlString(13, rd.adminShipAddress); SetSqlDecimal(14, rd.refundAmount); SetSqlDateTime(15, rd.agreedOrRefusedTime ?? SqlTypes.SqlDateTime.Null); SetSqlDateTime(16, rd.finishTime ?? SqlTypes.SqlDateTime.Null); SetSqlString(17, rd.shipOrderNumber); SetSqlDateTime(18, rd.userSendGoodsTime ?? SqlTypes.SqlDateTime.Null); SetSqlDateTime(19, rd.handleTime ?? SqlTypes.SqlDateTime.Null); SetSqlString(20, rd.expressCompanyName); SetSqlString(21, rd.expressCompanyAbb); SetSqlString(22, rd.adminShipTo); SetSqlString(22, rd.outerSkuId); }
protected override void RunSample() { // ### Api Context // Pass in a `APIContext` object to authenticate // the call and to send a unique request id // (that ensures idempotency). The SDK generates // a request id if you do not pass one explicitly. // See [Configuration.cs](/Source/Configuration.html) to know more about APIContext. var apiContext = Configuration.GetAPIContext(); // ### Create an invoice // For demonstration purposes, we will create a new invoice for this sample. var invoice = new Invoice() { // #### Merchant Information // Information about the merchant who is sending the invoice. merchant_info = new MerchantInfo() { email = "*****@*****.**", first_name = "Dennis", last_name = "Doctor", business_name = "Medical Professionals, LLC", phone = new Phone() { country_code = "001", national_number = "4083741550" }, address = new InvoiceAddress() { line1 = "1234 Main St.", city = "Portland", state = "OR", postal_code = "97217", country_code = "US" } }, // #### Billing Information // Email address of invoice recipient and optional billing information. // > Note: PayPal currently only allows one recipient. billing_info = new List <BillingInfo>() { new BillingInfo() { // **(Required)** Email address of the invoice recipient. email = "*****@*****.**" } }, // #### Invoice Items // List of items to be included in the invoice. // > Note: 100 max per invoice. items = new List <InvoiceItem>() { new InvoiceItem() { name = "Sutures", quantity = 100, unit_price = new Currency() { currency = "USD", value = "5" } } }, // #### Invoice Note // Note to the payer. Maximum length is 4000 characters. note = "Medical Invoice 16 Jul, 2013 PST", // #### Payment Term // **(Optional)** Specifies the payment deadline for the invoice. // > Note: Either `term_type` or `due_date` can be sent, **but not both.** payment_term = new PaymentTerm() { term_type = "NET_30" }, // #### Shipping Information // Shipping information for entities to whom items are being shipped. shipping_info = new ShippingInfo() { first_name = "Sally", last_name = "Patient", business_name = "Not applicable", address = new InvoiceAddress() { line1 = "1234 Broad St.", city = "Portland", state = "OR", postal_code = "97216", country_code = "US" } } }; // ^ Ignore workflow code segment #region Track Workflow this.flow.AddNewRequest("Create the invoice", invoice); #endregion // Create the invoice var createdInvoice = invoice.Create(apiContext); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordResponse(createdInvoice); this.flow.AddNewRequest("Send the invoice", createdInvoice); #endregion // Send the created invoice createdInvoice.Send(apiContext); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordActionSuccess("Invoice sent successfully."); #endregion // Use the `PaymentDetail` object to specify the details of the payment. var paymentDetail = new PaymentDetail { method = "CASH", date = "2014-07-06 03:30:00 PST", note = "Cash received." }; // ^ Ignore workflow code segment #region Track Workflow this.flow.AddNewRequest("Mark the invoice as paid", paymentDetail); #endregion // Mark the invoice as paid. createdInvoice.RecordPayment(apiContext, paymentDetail); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordActionSuccess("Invoice successfully updated."); #endregion // Use the `PaymentDetail` object to specify the details of the payment. var refundDetail = new RefundDetail { date = "2014-07-06 03:30:00 PST", note = "Refund provided by cash." }; // ^ Ignore workflow code segment #region Track Workflow this.flow.AddNewRequest("Mark the invoice as refunded", refundDetail); #endregion createdInvoice.RecordRefund(apiContext, refundDetail); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordActionSuccess("Invoice successfully updated."); #endregion // ^ Ignore workflow code segment #region Track Workflow this.flow.AddNewRequest("Fetch details about the invoice", refundDetail); #endregion // The external payment will now be attached to the details of your invoice var invoiceDetails = Invoice.Get(apiContext, createdInvoice.id); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordResponse(invoiceDetails); this.flow.RecordActionSuccess("Invoice details fetched."); #endregion // ^ Ignore workflow code segment #region Track Workflow this.flow.AddNewRequest("Delete the external refund"); #endregion // Delete external refund Invoice.DeleteExternalRefund(apiContext, invoiceDetails.id, invoiceDetails.refunds[0].transaction_id); // ^ Ignore workflow code segment #region Track Workflow this.flow.RecordActionSuccess("External Refund deleted successfully"); #endregion }
protected void Refund_Click(object sender, EventArgs e) { string userName = User.Identity.Name; decimal subtotal = 0; decimal tax = 0; decimal total = 0; List <RefundDetail> newDetail = new List <RefundDetail>(); RefundDetail newRow = null; CheckBox selection = null; int error = 0; for (int rowIndex = 0; rowIndex < RefundInvoiceGridView.Rows.Count; rowIndex++) { selection = RefundInvoiceGridView.Rows[rowIndex].FindControl("RefundCheckBox") as CheckBox; if (!selection.Checked) { MessageUserControl.ShowInfo("please select refund product and enter a refund reason"); } else { if (string.IsNullOrEmpty((RefundInvoiceGridView.Rows[rowIndex].FindControl("ReasonTextBox") as TextBox).Text)) { MessageUserControl.ShowInfo("Please enter a refund reason."); error = 1; } else { newRow = new RefundDetail(); newRow.Product = (RefundInvoiceGridView.Rows[rowIndex].FindControl("ProductLabel") as Label).Text; newRow.Qty = int.Parse((RefundInvoiceGridView.Rows[rowIndex].FindControl("QtyLabel") as Label).Text); newRow.Price = decimal.Parse((RefundInvoiceGridView.Rows[rowIndex].FindControl("PriceLabel") as Label).Text); newRow.Amount = decimal.Parse((RefundInvoiceGridView.Rows[rowIndex].FindControl("AmountLabel") as Label).Text); newRow.RestockCharge = decimal.Parse((RefundInvoiceGridView.Rows[rowIndex].FindControl("RestockChargeLabel") as Label).Text); newRow.Reason = (RefundInvoiceGridView.Rows[rowIndex].FindControl("ReasonTextBox") as TextBox).Text; newDetail.Add(newRow); subtotal = subtotal + newRow.Amount - newRow.RestockCharge; tax = subtotal * (decimal)0.05; total = subtotal + tax; } } } int refunded = 0; if (error == 0) { foreach (var exists in newDetail) { int prodID = Get_ProductID(exists.Product); int originvoiceID = int.Parse(InvocieNumber.Text); refunded = CheckForRefunded(originvoiceID, prodID); if (refunded == 1) { } else { MessageUserControl.TryRun(() => { SubtotalTextBox.Text = string.Format("${0:#,#.00}", subtotal.ToString()); GSTTextBox.Text = string.Format("${0:#,#.00}", tax.ToString()); TotalTextBox.Text = string.Format("${0:C}", total.ToString()); List <InvoiceDetailInfo> alldetaill = new List <InvoiceDetailInfo>(); List <StoreRefundInfo> refundlist = new List <StoreRefundInfo>(); foreach (var item in newDetail) { alldetaill.Add(new InvoiceDetailInfo { ProductID = Get_ProductID(item.Product), Quantity = item.Qty, }); } foreach (var items in newDetail) { refundlist.Add(new StoreRefundInfo { OriginalInvoiceID = int.Parse(InvocieNumber.Text), ProductID = Get_ProductID(items.Product), Reason = items.Reason, } ); } List <InvoiceInfo> NewInvoice = new List <InvoiceInfo>(); NewInvoice.Add(new InvoiceInfo { EmployeeID = Get_EmpID(userName), InvoiceDate = DateTime.Now, SubTotal = (subtotal * -1), GST = (tax * -1), Total = (total * -1), }); RefundRequired request = new RefundRequired { RequiredInvoice = NewInvoice, ReuquiredDetail = alldetaill, RequiredStore = refundlist }; var controller = new StoreRefundController(); controller.CreateRefund(request); foreach (GridViewRow row in RefundInvoiceGridView.Rows) { var checkbox = row.FindControl("RefundCheckBox") as CheckBox; var reasonbox = row.FindControl("ReasonTextBox") as TextBox; checkbox.Enabled = false; reasonbox.Enabled = false; } }, "Refund successful", "Selected products have been refunded."); RefundOrder.Enabled = false; RefundInvoiceTextBox.Text = getinvocieid().ToString(); } } } else { MessageUserControl.ShowInfo("one of the product is not enter a reason "); } }
//array gelmesini denemem lazim. Specific item adi ile cagirmagla public IActionResult SubmitRefund(string postRefundHeaderString, string[] postRefundDetail) { if (postRefundHeaderString == null) { return(Json(new { success = false, message = "Refund is empty" })); } try { var claimIntetity = (ClaimsIdentity)User.Identity; var claim = claimIntetity.FindFirst(ClaimTypes.NameIdentifier); string[] refundHeaderArr = postRefundHeaderString.Split(new char[] { ',' }); double totalAmount = Convert.ToDouble(refundHeaderArr[1]); RefundHeader refundHeader = new RefundHeader() { OrderHeaderId = Convert.ToInt32(refundHeaderArr[0]), TotalAmount = totalAmount, Comment = refundHeaderArr[2], RefundDate = DateTime.Now }; _unitOfWork.RefundHeader.Add(refundHeader); CurrentMovement currentMovement = new CurrentMovement() { //AccountingBookId CurrentDate = DateTime.Now, Description = Utility.StaticValues.Accounting.Refund, IsInflow = false, MovementType = (string)CashDeskStaticValues.StaticValues().FirstOrDefault(u => u.Key == "Refund").Key, //bUnu yeni elave etdim test etmedim Sum = totalAmount, UserId = claim.Value, Cleared = false, }; _unitOfWork.CurrentMovement.Add(currentMovement); _unitOfWork.Save(); foreach (var item in postRefundDetail) { string[] detailArr = item.Split(new char[] { ',' }); int productId = Convert.ToInt32(detailArr[0]); int quantity = Convert.ToInt32(detailArr[2]); RefundDetail refundDetail = new RefundDetail() { RefundHeaderId = refundHeader.Id, ProductId = productId, Price = Convert.ToDouble(detailArr[1]), Count = quantity }; _unitOfWork.RefundDetail.Add(refundDetail); _unitOfWork.Product.AddStockQuantity(productId, quantity); } _unitOfWork.Save(); } catch (Exception ex) { return(Json(new { success = false, message = ex.Message })); } return(Json(new { success = true, message = "Refunded successfully" })); }
/// <summary> /// 获取单笔退货的详细信息 /// </summary> /// <param name=""></param> public static RefundDetail GetRefundDetail(string orderId) { RefundDetail refundDetail = null; LogHelper.SetPreFilePath = "RefundDetail"; RefundDetailRequest request = new RefundDetailRequest() { tid = orderId }; string param = string.Empty; Dictionary <string, string> keyValuePairs = SignHelper.GetDictionary <RefundDetailRequest>(request); keyValuePairs.Add("app_key", appKey); keyValuePairs.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); foreach (var kv in keyValuePairs) { param += kv.Key + "=" + kv.Value + "&"; } param = param.Substring(0, param.Length - 1); LogHelper.Info("param参数:" + param); string sign = SignHelper.SignTopRequest(keyValuePairs, "md5", appSecret); LogHelper.Info("sign签名:" + sign); param += "&sign=" + sign; string postUrl = url + WXAppConstants.refundretailUrl; var result = string.Empty;//请求结果 try { result = HttpHelper.HttpGet(postUrl, param); LogHelper.Info("请求结果:" + result); } catch (Exception ex) { LogHelper.Info("请求失败:" + ex.Message); } RefundDetailResponse response = null; if (!string.IsNullOrEmpty(result)) { try { response = JsonConvert.DeserializeObject <RefundDetailResponse>(result, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } catch (Exception ex) { LogHelper.Info("转换失败:" + ex.Message); } } if (response != null) { refundDetail = response.refund_get_response.refund; } return(refundDetail); }
/// <summary> /// 获取售后列表(根据申请时间) /// </summary> public static void GetSoldRefunds() { LogHelper.SetPreFilePath = "SoldRefund"; SoldRefundsRequest request = new SoldRefundsRequest(); int TotalCount = GetSoldRefundsCount(request); LogHelper.Info("总条数:" + TotalCount); int PageCount = TotalCount % PageSize == 0 ? TotalCount / PageSize : TotalCount / PageSize + 1; LogHelper.Info("总页数:" + PageCount); #region 过程 for (int i = 1; i <= PageCount; i++) { request.page_no = i; string param = string.Empty; Dictionary <string, string> keyValuePairs = SignHelper.GetDictionary <SoldRefundsRequest>(request); keyValuePairs.Add("app_key", appKey); keyValuePairs.Add("timestamp", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); foreach (var kv in keyValuePairs) { param += kv.Key + "=" + kv.Value + "&"; } param = param.Substring(0, param.Length - 1); LogHelper.Info("param参数:" + param); string sign = SignHelper.SignTopRequest(keyValuePairs, "md5", appSecret); LogHelper.Info("sign签名:" + sign); param += "&sign=" + sign; string postUrl = url + WXAppConstants.soldrefundsUrl; var result = string.Empty;//请求结果 try { result = HttpHelper.HttpGet(postUrl, param); LogHelper.Info("请求结果:" + result); } catch (Exception ex) { LogHelper.Info("请求失败:" + ex.Message); } SoldRefundsResponse response = null; if (!string.IsNullOrEmpty(result)) { try { response = JsonConvert.DeserializeObject <SoldRefundsResponse>(result, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); } catch (Exception ex) { LogHelper.Info("转换失败:" + ex.Message); } } if (response != null) { List <RefundDetail> rds = new List <RefundDetail>(); List <SoldRefund> soldRefunds = response.refunds_get_response.refunds; foreach (var item in soldRefunds) { RefundDetail rd = GetRefundDetail(item.returnId.ToString()); rd.userSendGoodsTime = item.userSendGoodsTime; rds.Add(rd); } try { var ms = service.AddSoldRefundDetail(rds); LogHelper.Info("返回信息" + ms); } catch (Exception ex) { } } } #endregion }
public static void ShowResults(string title, RefundDetail[] result, string accountNumber) { ShowHeader(title); Console.WriteLine("AccountNumber {0}", accountNumber); Console.WriteLine("Refunds Found {0}\n\n", result.Length); foreach (RefundDetail detail in result) { Console.WriteLine("Amount {0}", detail.Amount.ToString("#,##0.00")); Console.WriteLine("Date {0}", detail.RefundDate.ToShortDateString()); Console.WriteLine("Method {0}", ((SettlementDeliveryMethod)detail.DeliveryMethod).ToString()); Console.WriteLine("Status {0}", ((AgreementStatus)detail.Status).ToString()); Console.WriteLine("----------------------------------------------------------------"); } }