private void Apply() { Refund refund = new Refund(); BLLRefund bllRefund = new BLLRefund(CurrentMember,Request["orderid"]); bllRefund.ApplyRefund(); }
public async Task <Refund> CancelOrder(Order order) { var refund = new Refund { DateRefunded = DateTime.Now, RefundRate = RefundRate(order) }; order.Refund = refund; order.Status = (int)Consts.OrderStatus.Cancelled; await _context.SaveChangesAsync(); return(refund); }
public virtual async Task <PaymentResult> ProcessRefound(Refund refund) { var resource = $"{EmbededDirectory}.Refund.xml"; string embededResource = TemplateHelper.ReadEmbedResource(resource); string viewModel = OnCompilingTemplate(refund, embededResource); var form = GetPostForm(); form.Content = viewModel; HTTPClient httpClient = new HTTPClient(EndPointConfiguration.BaseUrl); return(await httpClient.Post(EndPointConfiguration.RefundEndPoint, form, Handler)); }
public void Refund() { PaymentSetting querySetting = new PaymentSetting(GatewayType.WeChatPayment); querySetting.Merchant.AppId = "wx000000000000000"; querySetting.Merchant.Partner = "000000000000000"; querySetting.Merchant.Key = "0000000000000000000000000000000000000000"; if (querySetting.CanRefund) { var refund = new Refund(); refund.OutRefundNo = "000000000000000"; querySetting.BuildRefund(refund); querySetting.BuildRefundQuery(refund); } }
public void WhenAttemptingASecondRefundShouldThrow() { var paymentPlan = new PaymentPlan(100, 4); var firstInstallment = paymentPlan.FirstInstallment(); paymentPlan.MakePayment(25, firstInstallment.Id); Refund refund = new Refund(Guid.NewGuid().ToString(), 100); paymentPlan.ApplyRefund(refund); Assert.Throws <Exception>(() => { paymentPlan.ApplyRefund(refund); }); }
public void RefundTransactionIdAndAmountAndDescrition() { var rand = new Random((int)DateTime.Now.Ticks); int randomValue = rand.Next(1000, 9999); Transaction transaction = _paymill.TransactionService.CreateWithTokenAsync(testToken, randomValue, "USD").Result; int refInt = randomValue / 2; Refund newRefund = _paymill.RefundService.RefundTransactionAsync(transaction.Id, refInt, "Go to bar").Result; Assert.IsTrue(newRefund.Status == Refund.RefundStatus.REFUNDED, "Create Refund succeed"); Assert.IsTrue(newRefund.Transaction.Status == Transaction.TransactionStatus.PARTIAL_REFUNDED, "Create Refund succeed"); Assert.IsTrue(newRefund.Transaction.Amount == (randomValue - refInt)); Assert.IsTrue(newRefund.Transaction.ResponseCode == 20000); Assert.IsTrue(newRefund.Description == "Go to bar"); _paymill.RefundService.RefundTransactionAsync(transaction.Id, (randomValue - refInt), "Go to bar").Wait(); }
private Refund Refund(string chargeId, string stripeAccountId) { var refundService = new RefundService(); var refundOptions = new RefundCreateOptions() { Charge = chargeId }; refundOptions.RefundApplicationFee = true; Refund refund = refundService.Create(refundOptions, new RequestOptions { StripeAccount = stripeAccountId }); return(refund); }
public override async Task OnRefundStartedAsync(Payment payment, Refund refund) { using var uow = _unitOfWorkManager.Begin(isTransactional: true); uow.OnCompleted(async() => { await _localEventBus.PublishAsync(new WeChatPayRefundEto { PaymentId = payment.Id, Refund = refund }); }); await uow.CompleteAsync(); }
public PaymentResult Refund(string log) { dynamic logData = Newtonsoft.Json.JsonConvert.DeserializeObject(log); var refund = new Refund(); PayPal.Api.Payment payment = PayPal.Api.Payment.Get(apiCtx, logData.id.ToString()); var response = payment.transactions.FirstOrDefault().related_resources.FirstOrDefault().sale.Refund(apiCtx, refund); return(new PaymentResult { Status = response.state == "completed", Message = response.state, Data = Newtonsoft.Json.JsonConvert.SerializeObject(response) }); }
/// <summary> /// Ajoute un remboursement pour l'utilisateur sur le partage renseigné /// </summary> /// <param name="userId">identifiant de l'utilisateur effectuant le remboursement</param> /// <param name="shareId">identifiant du partage concerné</param> /// <param name="refundCreation">données liés au remboursement</param> /// <returns></returns> public RefundItem AddRefund(int userId, int shareId, RefundCreation refundCreation) { var emmiterUserShare = GetUserShare(userId, shareId); var receiverUserShare = GetUserShare(refundCreation.Receiver, shareId); var refund = new Refund { Amount = refundCreation.Amount, Emitter = emmiterUserShare, Receiver = receiverUserShare, Date = DateTime.Now, }; dataService.Insert(refund); return(mapper.Map <RefundItem>(refund)); }
public RefundModel CustomerLastTransaction(RefundModel model) { var loan = _loanRepository.GetById(model.LoanId); if (loan == null) { return(null); } var refund = _refundRepository.GetAll() .OrderByDescending(x => x.DateCreated) .FirstOrDefault(x => x.CustomerId == model.CustomerId && x.LoanId == model.LoanId); if (refund == null) { var firstRefund = new Refund { Amount = 0, Balance = loan.Amount + loan.Interest, CustomerId = model.CustomerId, EmployeeId = model.EmployeeId, RefundId = _generator.GenerateGuid(), Reference = _generator.RandomNumber(1111111, 9999999), LoanId = model.LoanId, DateCreated = DateTime.UtcNow.ToLocalTime(), StatusCode = StatusCode.Confirmed }; _refundRepository.Insert(firstRefund); _refundRepository.Save(); //manual mapping got the job done var refundModel = new RefundModel() { StatusCode = firstRefund.StatusCode }; return(refundModel); } //manual mapping got the job done var newModel = new RefundModel() { StatusCode = refund.StatusCode }; return(newModel); }
private static AdaptiveElement AddRefundLine(Refund refund) { return(new AdaptiveColumnSet { Columns = new List <AdaptiveColumn> { new AdaptiveColumn { Items = new List <AdaptiveElement> { new AdaptiveTextBlock { Text = refund.Number.ToString(), Size = AdaptiveTextSize.Medium } } }, new AdaptiveColumn { Items = new List <AdaptiveElement> { new AdaptiveTextBlock { Text = refund.RequestDate.ToShortDateString(), Size = AdaptiveTextSize.Medium } } }, new AdaptiveColumn { Items = new List <AdaptiveElement> { new AdaptiveTextBlock { Text = refund.Amount.ToString("C2"), Size = AdaptiveTextSize.Medium } } }, new AdaptiveColumn { Items = new List <AdaptiveElement> { new AdaptiveTextBlock { Text = refund.PaymentDate.HasValue? refund.PaymentDate.Value.ToShortDateString() : "Pending", Size = AdaptiveTextSize.Medium } } } } }); }
private void PayForm_FormClosing(object sender, FormClosingEventArgs e) { if (!clFlag) { if (MessageBox.Show("是否确定退出支付界面?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.No) { e.Cancel = true; } else { ///退出付款之前,需要进行退款 ///1现金返还 ///2易宝支付返还 ///3微信支付返还 foreach (PayInfo obj in payList) { if (obj.PayMode == BranchPay.WxPay) { string amount = float.Parse(obj.PayAmount).ToString("0.00").Replace(".", ""); WxPayData result = Refund.Run(null, obj.orderId + "4", amount, amount); if ("SUCCESS".Equals(result.GetValue("result_code"))) { //MessageBox.Show("微信支付退款成功!"); } else { if (result.IsSet("err_code_des")) { MessageBox.Show(result.GetValue("err_code_des").ToString()); return; } else { MessageBox.Show("未知错误!"); return; } } } if (obj.PayMode == BranchPay.ZFBPay) { string amount = float.Parse(obj.PayAmount).ToString("0.00").Replace(".", ""); string id = obj.orderId; ZFBPayRefund(amount, id); } } } } }
public IActionResult DeleteTripForCustomer() { var customerid = User.Claims.FirstOrDefault(c => c.Type == Helpers.Constants.Strings.JwtClaimIdentifiers.CustomerId)?.Value; if (customerid == null) { return(BadRequest()); } var trip = _tripsRepo.GetTrip(Guid.Parse(customerid)); if (trip == null) { return(NotFound()); } if (trip.DriverId != null) { ModelState.AddModelError(nameof(Trip), "Driver already assigned"); return(BadRequest(ModelState)); } //TODO : refund var customer = _usersRepository.GetCustomerById(Guid.Parse(customerid)); if (customer == null) { return(NotFound()); } var res = Refund.Create((ulong)trip.ContractId, new DefaultControllerPattern(), new User { PrivateKey = customer.Identity.PrivateKey }, ModelState); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var result = _tripsRepo.RemoveTrip(Guid.Parse(customerid)); if (!result) { return(Conflict()); } return(NoContent()); }
/// <summary> /// Run the example code. /// </summary> public static void Main() { const string MerchantId = "0"; const string SharedSecret = "sharedSecret"; string orderId = "12345"; IConnector connector = ConnectorFactory.Create(MerchantId, SharedSecret, Client.EuTestBaseUrl); Client client = new Client(connector); IOrder order = client.NewOrder(orderId); List <OrderLine> lines = new List <OrderLine>(); lines.Add(new OrderLine() { Type = "physical", Reference = "123050", Name = "Tomatoes", Quantity = 5, QuantityUnit = "kg", UnitPrice = 600, TaxRate = 2500, TotalAmount = 3000, TotalTaxAmount = 600 }); Refund refund = new Refund() { RefundedAmount = 3000, Description = "Refunding half the tomatoes", OrderLines = lines }; try { order.Refund(refund); } catch (ApiException ex) { Console.WriteLine(ex.ErrorMessage.ErrorCode); Console.WriteLine(ex.ErrorMessage.ErrorMessages); Console.WriteLine(ex.ErrorMessage.CorrelationId); } catch (WebException ex) { Console.WriteLine(ex.Message); } }
public void zutuanTuikuan(string ordercode, string total_fee, string refund_fee) { try { string result = Refund.Run(ordercode, "", total_fee, refund_fee); Response.Write(result); } catch (WxPayException ex) { Response.Write(ex.ToString()); } catch (Exception ex) { Response.Write(ex.ToString()); } }
public void Handle_Refund_ReturnsOrderPaid() { V1Processing processing = new V1Processing(); Refund request = new Refund { OrderId = "1" }; OperationStatus answer = processing.Handle(new Packet <IPacketContent>(request) { Version = "v1" }).Content as OperationStatus; Assert.Equal(ResultCode.Ok, answer.ResultCode); }
public void RefundThrowOnMissingSecurityProtocol() { Configuration.SecretKey = "mysecretkey"; System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls; #if !__MonoCS__ System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls11; System.Net.ServicePointManager.SecurityProtocol &= ~SecurityProtocolType.Tls12; #endif Assert.Throws <ConfigurationException>(delegate { Refund.Create(PaymentID); }); Assert.Throws <ConfigurationException>(delegate { Refund.CreateRaw(PaymentID); }); Assert.Throws <ConfigurationException>(delegate { Refund.List(PaymentID); }); Assert.Throws <ConfigurationException>(delegate { Refund.ListRaw(PaymentID); }); Assert.Throws <ConfigurationException>(delegate { Refund.Retrieve(PaymentID, RefundID); }); Assert.Throws <ConfigurationException>(delegate { Refund.RetrieveRaw(PaymentID, RefundID); }); }
public void Refund_Serialize_PropertyNamesAsExpected() { // Arrange var refund = new Refund(); // Act var serializedObject = JsonConvert.SerializeObject(refund); // Assert Assert.AreEqual(@"{ ""type"": ""refund"", ""amount"": 0, ""currency"": null, ""description"": null }".RemoveWhiteSpace(), serializedObject.RemoveWhiteSpace()); }
public void TestCreate() { var refdata = DateTimeOffset.Now.Ticks.ToString(); var postData = new List <KeyValuePair <string, string> >(); postData.Add(new KeyValuePair <string, string>("transaction_id", "1")); postData.Add(new KeyValuePair <string, string>("amount", "1.00")); postData.Add(new KeyValuePair <string, string>("reason", refdata)); postData.Add(new KeyValuePair <string, string>("locale", "en")); var res = Refund.Create(postData); Trace.Write(res.ToJson()); Assert.IsTrue(res.Reason == refdata); }
public void Test_refund() { try { Refund r = new Refund(); r.Amount = 123; r.Currency = "EUR"; r.CurrentStatus = Refund.Status.REFUNDED; var v1 = r.ToXml(); Assert.IsTrue(true); } catch (System.Exception exp) { Assert.Fail(exp.Message); } }
public IActionResult OnPostOrderRefund(int id) { OrderHeader orderHeader = _unitOfWork.OrderHeader.GetFirstOrDefault(o => o.Id == id); var options = new RefundCreateOptions() { Amount = Convert.ToInt32(orderHeader.OrderTotal * 100), Reason = RefundReasons.RequestedByCustomer }; var service = new RefundService(); Refund refund = service.Create(options); orderHeader.Status = SD.StatusRefounded; _unitOfWork.Save(); return(RedirectToPage("OrderList")); }
public JsonResult RefundOrder([FromBody] Refund refund) { try { _log.Info("退款"); RefundBack refundBack; string message; var result = alipayHandle.Refund(refund, out refundBack, out message); return(BuildJsonResult <RefundBack>(refundBack, result, message)); } catch (Exception exc) { _log.Fatal(exc, $"退款:{exc.Message}"); return(BuildJsonResult <RefundBack>(null, false, exc.Message)); } }
public static void AddRefund(string id, string name, string batch, string dateofrefund, string customername, string customerphone, string reasonofrefund) { { Refund r = new Refund() { Id = Int32.Parse(id), Name = name, Batch = batch, Dateofrefund = dateofrefund, Customername = customername, Customerphone = Int32.Parse(customerphone), Reasonofrefund = reasonofrefund }; db.Refunds.AddRefund(r); } }
public ActionResult CreateNewRefund(RefundViewModel refundVM) { BussinesLayer bl = new BussinesLayer(new FinalDB()); string username = Session["Username"] as string; Refund refundModel = new Refund(); refundModel.TeacherUserName = username; refundModel.Date = DateTime.Now; refundModel.DepartmentID = Convert.ToInt32(refundVM.SelectedDepartment); refundModel.CourseID = Convert.ToInt32(refundVM.SelectedCourses); refundModel.LecturerName = refundVM.LecturerName; refundModel.IsGrouped = refundVM.IsGrouped; int refundID = bl.AddRefund(refundModel); return(RedirectToAction("CreateNewSession", new { refundID = refundID })); }
public ResultDTO Refund(Refund refund) { ResultDTO result = new ResultDTO(); result.success = true; var user = db.Users.FirstOrDefault(u => u.Id == this.UserId); if (user != null) { var balance = db.Balances.FirstOrDefault(b => b.Id == (user.ActiveBalanceId ?? 0)); if (balance.TypeId != 2) { result.success = false; result.message = "不是实盘账户,无法出金"; return(result); } if (balance != null && balance.Amount >= refund.Amount) { balance.Amount -= refund.Amount; } else { result.success = false; result.message = "账户余额不足,无法出金"; return(result); } } db.Refunds.Add(new YJY_COMMON.Model.Entity.Refund() { Amount = refund.Amount, CreatedAt = DateTimes.UtcToChinaTime(DateTime.UtcNow), UserId = this.UserId, }); string adminPhone = db.Miscs.FirstOrDefault(m => m.Key == "refundAdmin").Value; string sendResult = YunPianSMS.SendSms("【盈交易】有一笔新的申请,请在后台查看", adminPhone); db.SaveChanges(); result.success = true; return(result); }
public Refund CreateRefund() { List <Links> links = new List <Links>(); links.Add(CreateLinks()); Refund refund = new Refund(); refund.capture_id = "101"; refund.id = "102"; refund.parent_payment = "103"; refund.sale_id = "104"; refund.state = "Approved"; refund.amount = GetAmount(); refund.create_time = "2013-01-17T18:12:02.347Z"; refund.links = links; return(refund); }
public IActionResult OnPostOrderRefund(int orderId) { OrderHeader orderHeader = _unitOfWork.OrderHeader.GetFirstOrDefualt(s => s.Id == orderId); //refund amoount var options = new RefundCreateOptions { Amount = Convert.ToInt32(orderHeader.OrderTotal * 100), Reason = RefundReasons.RequestedByCustomer, Charge = orderHeader.TransactionId, }; var service = new RefundService(); Refund refund = service.Create(options); orderHeader.Status = SD.StatusRefunded; _unitOfWork.Save(); return(RedirectToPage("ManagerOrder")); }
public void TestOnepayRefundTransaction() { var amount = 27500; var occ = "1807983490979289"; var externalUniqueNumber = "f506a955-800c-4185-8818-4ef9fca97aae"; var authorizationCode = "623245"; RefundCreateResponse response = Refund.Create(amount, occ, externalUniqueNumber, authorizationCode); Assert.IsNotNull(response); Assert.AreEqual("1807983490979289", response.Occ); Assert.AreEqual("f506a955-800c-4185-8818-4ef9fca97aae", response.ExternalUniqueNumber); Assert.AreEqual("623245", response.ReverseCode); Assert.AreEqual(1532104252, response.IssuedAt); Assert.AreEqual("52NpZBolTEs+ckNOXwGRexDetY9MOaX1QbFYkjPymf4=", response.Signature); }
public ResultDTO UploadQRCode(Refund refund) { db.UserQRCodes.Add(new UserQRCode() { UserID = this.UserId, QRCode = refund.QRCode, CreatedAt = DateTimes.UtcToChinaTime(DateTime.UtcNow) }); db.SaveChanges(); ResultDTO result = new ResultDTO(); result.success = true; return(result); }
protected void rptOrderList_ItemCommand(object source, RepeaterCommandEventArgs e) { //退款 if (e.CommandName.Equals("tuikuan")) { //arr[0]=Postage邮费,arr[1]=groupPrice团购价,arr[2]=orderCode订单编号,arr[3]=订单id,arr[4]=Consignee OpenId,arr[5]=name商品名称,arr[6]=Phone,arr[7]=退款数 string[] arr = e.CommandArgument.ToString().Trim(',').Split(','); float total_fee = float.Parse(arr[0].ToString()) + float.Parse(arr[1].ToString()) * 100;//总钱数 Jnwf.Utils.Log.Logger.Log4Net.Error(string.Format("TorderList.aspx;订单编号:{0} 总金额:{1}", arr[2].ToString(), total_fee.ToString())); Weifenxiao.BLL.T_OrdersBLL.GetInstance().OrdersTuiKuanPro(Convert.ToInt32(arr[3])); Refund.Run("", arr[2], total_fee.ToString(), total_fee.ToString()); // Jnwf.Utils.Log.Logger.Log4Net.Error("http://m.disneybg.com/data/tuikuan.ashx?openid=" + arr[4] + "&ordercode=" + arr[2] + "&productname=" + arr[5] + "&phone=" + arr[6] + "&tuikuan=" + arr[7]); Jnwf.Utils.Helper.HttpHelper.LoadPageContent("http://m.disneybg.com/data/tuikuan.ashx?openid=" + arr[4] + "&ordercode=" + arr[2] + "&productname=" + arr[5] + "&phone=" + arr[6] + "&tuikuan=" + arr[7]); Response.Write("<script>alert('退款成功!')</script>"); BindData(); } }
public static void Main(string[] args) { string host = "esqa.moneris.com"; string store_id = "store5"; string api_token = "yesguy"; string order_id = "Test_eFraudkdsskdkdk"; string amount = "5.00"; string txn_number = "153150-4-0"; string crypt = "7"; string dynamic_descriptor = "123456"; Refund r = new Refund(order_id, amount, txn_number, crypt); r.SetDynamicDescriptor(dynamic_descriptor); HttpsPostRequest mpgReq = new HttpsPostRequest(host, store_id, api_token, r); try { Receipt receipt = mpgReq.GetReceipt(); Console.WriteLine("CardType = " + receipt.GetCardType()); Console.WriteLine("TransAmount = " + receipt.GetTransAmount()); Console.WriteLine("TxnNumber = " + receipt.GetTxnNumber()); Console.WriteLine("ReceiptId = " + receipt.GetReceiptId()); Console.WriteLine("TransType = " + receipt.GetTransType()); Console.WriteLine("ReferenceNum = " + receipt.GetReferenceNum()); Console.WriteLine("ResponseCode = " + receipt.GetResponseCode()); Console.WriteLine("ISO = " + receipt.GetISO()); Console.WriteLine("BankTotals = " + receipt.GetBankTotals()); Console.WriteLine("Message = " + receipt.GetMessage()); Console.WriteLine("AuthCode = " + receipt.GetAuthCode()); Console.WriteLine("Complete = " + receipt.GetComplete()); Console.WriteLine("TransDate = " + receipt.GetTransDate()); Console.WriteLine("TransTime = " + receipt.GetTransTime()); Console.WriteLine("Ticket = " + receipt.GetTicket()); Console.WriteLine("TimedOut = " + receipt.GetTimedOut()); } catch (Exception e) { Console.WriteLine(e); } }
public virtual int Update(Refund dataSet) { return this.Adapter.Update(dataSet, "RefundStampDetails"); }
public void MakeRefund(SubscribeResponseHolder sub, Invoice inv) { Refund refund = new Refund(); refund.AccountId = sub.SubRes.AccountId; refund.Amount = inv.Amount; refund.AmountSpecified = true; refund.Type = "Electronic"; refund.PaymentId = sub.SubRes.PaymentId; List<ResponseHolder> createRes = zs.Create(new List<zObject> { refund }, false); }
/// <summary> /// Decrease credit balance for an account by an amount by creating an external refund /// </summary> /// <param name="paymentId"></param> /// <param name="amount"></param> /// <param name="methodType"></param> /// <param name="refundDate"></param> /// <returns></returns> public ResponseHolder DecreaseCreditBalance(String accountId, Decimal amount) { //refund payment Refund refund = new Refund(); refund.AccountId = accountId; refund.AmountSpecified = true; refund.Amount = amount; refund.SourceType = "CreditBalance"; refund.Type = "External"; refund.MethodType = "Other"; List<ResponseHolder> createRefRes = zs.Create(new List<zObject> { refund }, false); return createRefRes[0]; }
public virtual int Update(Refund.RefundActsApplicableDataTable dataTable) { return this.Adapter.Update(dataTable); }
public Refund Refund( int amount, string description, Dictionary<string, string> meta, string debit_uri) { Dictionary<string, object> payload = new Dictionary<string, object>(); payload.Add("amount", amount); if (description != null) payload.Add("description", description); if (meta != null) payload.Add("meta", meta); if (debit_uri != null) payload.Add("debit_uri", debit_uri); var response = this.client.post(uri + "/refunds", payload); Refund refund = new Refund(this.Settings, response); return refund; }
public virtual int Update(Refund dataSet) { return this.Adapter.Update(dataSet, "RefundActsApplicable"); }
public virtual int Update(Refund dataSet) { return this.Adapter.Update(dataSet, "RefundApprovalGrid"); }
public virtual int Update(Refund.RefundOrderDataTable dataTable) { return this.Adapter.Update(dataTable); }
public virtual int Update(Refund dataSet) { return this.Adapter.Update(dataSet, "RefundOrder"); }
public virtual int Update(Refund.RefundApprovalGridDataTable dataTable) { return this.Adapter.Update(dataTable); }
public virtual int Update(Refund.RefundStampDetailsDataTable dataTable) { return this.Adapter.Update(dataTable); }
/// <summary> /// Refund an external payment /// </summary> /// <param name="paymentId"></param> /// <param name="amount"></param> /// <param name="methodType"></param> /// <param name="refundDate"></param> /// <returns></returns> public ResponseHolder RefundExternalPayment(String paymentId, Decimal amount, String methodType, DateTime refundDate) { //refund payment Refund refund = new Refund(); refund.PaymentId = paymentId; refund.AmountSpecified = true; refund.Amount = amount; refund.SourceType = "Payment"; refund.Type = "External"; refund.MethodType = methodType; refund.RefundDateSpecified = true; refund.RefundDate = refundDate; List<ResponseHolder> createRefRes = zs.Create(new List<zObject> { refund }, false); return createRefRes[0]; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); Refund ds = new Refund(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "RefundApprovalGridDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Refund ds = new Refund(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
/// <summary> /// Refund an electronic payment /// </summary> /// <param name="paymentId"></param> /// <param name="amount"></param> /// <returns></returns> public ResponseHolder RefundElectronicPayment(String paymentId, Decimal amount) { //refund payment Refund refund = new Refund(); refund.PaymentId = paymentId; refund.AmountSpecified = true; refund.Amount = amount; refund.SourceType = "Payment"; refund.Type = "Electronic"; List<ResponseHolder> createRefRes = zs.Create(new List<zObject> { refund }, false); return createRefRes[0]; }