FundFlowBill.cshtml.cs 1018 B

1234567891011121314151617181920212223242526272829
  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 GetFundFlowBillModel(IWeChatPayClient client, IOptions<PaylinksOptions> options) : PageModel
  9. {
  10. private readonly WeChatPayClientOptions _options = options.Value.WeChatPay;
  11. [BindProperty]
  12. public WeChatPayFundFlowBillQueryModel Input { get; set; }
  13. public void OnGet()
  14. {
  15. Input = new WeChatPayFundFlowBillQueryModel { BillDate = DateTimeOffset.Now.AddDays(-1).ToString("yyyy-MM-dd") };
  16. }
  17. public async Task OnPostAsync()
  18. {
  19. var request = new WeChatPayFundFlowBillRequest();
  20. request.SetQueryModel(Input);
  21. var response = await client.ExecuteAsync(request, _options);
  22. ViewData["response"] = response.Body;
  23. }
  24. }