AbnormalRefund.cshtml.cs 1010 B

12345678910111213141516171819202122232425262728293031
  1. using Essensoft.Paylinks.WeChatPay.Client;
  2. using Essensoft.Paylinks.WeChatPay.Payments.Model;
  3. using Essensoft.Paylinks.WeChatPay.Payments.Request;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.AspNetCore.Mvc.RazorPages;
  6. using Microsoft.Extensions.Options;
  7. namespace Essensoft.Paylinks.Sample.Web.Pages.WeChatPay.Payments;
  8. public class AbnormalRefundModel(IWeChatPayClient client, IOptions<PaylinksOptions> options) : PageModel
  9. {
  10. private readonly WeChatPayClientOptions _options = options.Value.WeChatPay;
  11. [BindProperty]
  12. public string RefundId { get; set; }
  13. [BindProperty]
  14. public WeChatPayApplyAbnormalRefundByRefundIdBodyModel Input { get; set; }
  15. public void OnGet()
  16. {
  17. }
  18. public async Task OnPostAsync()
  19. {
  20. var request = new WeChatPayApplyAbnormalRefundByRefundIdRequest { RefundId = RefundId };
  21. request.SetBodyModel(Input);
  22. var response = await client.ExecuteAsync(request, _options);
  23. ViewData["response"] = response.Body;
  24. }
  25. }