public void Refund_Total_Success() { // Creates a payment PaymentCreateRequest request = BuildCreateRequest(true, "approved"); Payment createdPayment = client.Create(request); Thread.Sleep(7000); PaymentRefund refund = client.Refund(createdPayment.Id.GetValueOrDefault()); Assert.NotNull(refund); Assert.NotNull(refund.Id); Assert.Equal(createdPayment.Id, refund.PaymentId); }
public async Task RefundAsync_Total_Success() { // Creates a payment PaymentCreateRequest request = await BuildCreateRequestAsync(true, "approved"); Payment createdPayment = await client.CreateAsync(request); await Task.Delay(7000); PaymentRefund refund = await client.RefundAsync(createdPayment.Id.GetValueOrDefault()); Assert.NotNull(refund); Assert.NotNull(refund.Id); Assert.Equal(createdPayment.Id, refund.PaymentId); }
public void ListRefunds_Total_Success() { // Creates a payment PaymentCreateRequest request = BuildCreateRequest(true, "approved"); Payment createdPayment = client.Create(request); Thread.Sleep(7000); // Creates a refund PaymentRefund createdRefund = client.Refund(createdPayment.Id.GetValueOrDefault()); Thread.Sleep(3000); // List the refund ResourcesList <PaymentRefund> refunds = client.ListRefunds( createdPayment.Id.GetValueOrDefault()); Assert.NotNull(refunds); Assert.Equal(createdRefund.Id, refunds.First().Id); }
public async Task ListRefundsAsync_Total_Success() { // Creates a payment PaymentCreateRequest request = await BuildCreateRequestAsync(true, "approved"); Payment createdPayment = await client.CreateAsync(request); await Task.Delay(7000); // Creates a refund PaymentRefund createdRefund = await client.RefundAsync(createdPayment.Id.GetValueOrDefault()); await Task.Delay(3000); // List the refund ResourcesList <PaymentRefund> refunds = await client.ListRefundsAsync( createdPayment.Id.GetValueOrDefault()); Assert.NotNull(refunds); Assert.Equal(createdRefund.Id, refunds.First().Id); }
/// <summary> /// Update an existing refund. /// </summary> /// <param name="customerPaymentId">The id of the customer payment.</param> /// <param name="refundId">The id of the refund to update</param> /// <param name="item">The data to update the refund with.</param> /// <returns>A response with the resource after it's run through the Zoho server.</returns> public async Task <PaymentRefund> UpdateRefundAsync(string customerPaymentId, string refundId, PaymentRefund item) { var response = await PutDataAsync <PaymentRefund, ZohoBooksResponse <PaymentRefund> > (string.Format("{0}/refunds/{1}", customerPaymentId, refundId), item, OrganizationIdFilter); return(response.Resource); }
public ActionResult SavePaymentRefundRecord(PaymentRefund _paymentRF) { try { string[] extension = null; string path = GlobalConst.ConstantChar.Blank; string DownloadPath = GlobalConst.ConstantChar.Blank; string filename = GlobalConst.ConstantChar.Blank; if (_paymentRF.CheckUploadName1 != null) { filename = _paymentRF.CheckUploadName1.FileName; filename = filename.Substring(filename.LastIndexOf(GlobalConst.ConstantChar.SingleQouteDoubleSlash) + 1); extension = filename.Split(GlobalConst.ConstantChar.SingleQouteDot); } if (_paymentRF.PaymentRefundID == 0) { if (extension != null) { _paymentRF.CheckUploadName = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF; } _paymentRF.PaymentRefundID = _paymentRefund.AddPaymentRefundRecord(Mapper.Map <LMGEDI.Core.Data.Model.PaymentRefund>(_paymentRF)); _paymentRF.flag = true; if (_paymentRF.PaymentRefundID == -1) { _paymentRF.IsPaymentGreater = true; } if (extension != null && _paymentRF.PaymentRefundID != 0 && _paymentRF.PaymentRefundID != -1) { bool s = _storageServices.CreatePaymentRefundCheckFolder(_paymentRF.FileID, _paymentRF.InvoiceId, _paymentRF.PaymentRefundID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath])); path = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]), _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString()); DownloadPath = Path.Combine(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath], _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString()); _paymentRF.CheckUploadName1.SaveAs(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName); _paymentRF.CheckDownloadPath = DownloadPath + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName; } } else { string filename1 = GlobalConst.ConstantChar.Blank; if (extension != null) { filename1 = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF; //DateTime.Now.ToString(GlobalConst.ConstantChar.ddMMyyyyss) + GlobalConst.ConstantChar.Dot + extension[1]; } path = Path.Combine(Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath]), _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString()); DownloadPath = Path.Combine(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath], _paymentRF.FileID.ToString(), _paymentRF.InvoiceId.ToString(), _paymentRF.PaymentRefundID.ToString()); if (extension != null) { bool s = _storageServices.CreatePaymentRefundCheckFolder(_paymentRF.FileID, _paymentRF.InvoiceId, _paymentRF.PaymentRefundID, Server.MapPath(ConfigurationManager.AppSettings[GlobalConst.ConstantChar.StoragePath])); bool result = System.IO.File.Exists(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName); if (result) { System.IO.File.Delete(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName); } _paymentRF.CheckUploadName = filename1; } if (_paymentRF.CheckUploadName1 == null) { if (System.IO.File.Exists(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName)) { string uploadedfilename = Guid.NewGuid().ToString() + GlobalConst.Extension.PDF; System.IO.File.Move(path + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName, path + GlobalConst.ConstantChar.DoubleSlash + uploadedfilename); _paymentRF.CheckUploadName = uploadedfilename; } } int PaymentRefundID = _paymentRefund.UpdatePaymentRefundRecord(Mapper.Map <LMGEDI.Core.Data.Model.PaymentRefund>(_paymentRF)); if (PaymentRefundID == -1) { _paymentRF.IsPaymentGreater = true; } if ((PaymentRefundID != -1 && PaymentRefundID != 0) && _paymentRF.CheckUploadName1 != null) { _paymentRF.CheckUploadName1.SaveAs(path + GlobalConst.ConstantChar.DoubleSlash + filename1); } _paymentRF.flag = false; _paymentRF.CheckDownloadPath = DownloadPath + GlobalConst.ConstantChar.DoubleSlash + _paymentRF.CheckUploadName; } _paymentRF.CheckUploadName1 = null; return(Json(_paymentRF, GlobalConst.ContentTypes.TextHtml)); } catch (Exception ex) { _arCommonService.CreateErrorLog(ex.Message, ex.StackTrace); return(View()); } }