feat(tenpayv3): 升级公共组件

This commit is contained in:
Fu Diwei
2022-01-21 13:10:56 +08:00
parent 3656eb176f
commit b442a3d618
48 changed files with 304 additions and 569 deletions

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.UnitTests
{
public class TestCase_ApiExecuteExecuteRefundTests
{
[Fact(DisplayName = "测试用例:调用 API [POST] /refund/domestic/refunds")]
public async Task TestExecuteCreateRefundDomesticRefund()
{
var request = new Models.CreateRefundDomesticRefundRequest()
{
OutTradeNumber = "FAKE_OUTTRADENO",
OutRefundNumber = "TEST_ORN_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
Amount = new Models.CreateRefundDomesticRefundRequest.Types.Amount()
{
Total = 1,
Refund = 1
},
Reason = "FAKE_REASON"
};
var response = await TestClients.Instance.ExecuteCreateRefundDomesticRefundAsync(request);
Assert.True(response.IsSuccessful());
Assert.NotNull(response.OutRefundNumber);
Assert.NotNull(response.OutTradeNumber);
Assert.NotNull(response.Channel);
Assert.NotNull(response.Status);
Assert.True(response.Amount.Total > 0);
Assert.True(response.Amount.Refund > 0);
Assert.True(response.Amount.PayerTotal > 0);
Assert.True(response.Amount.PayerRefund > 0);
}
[Fact(DisplayName = "测试用例:调用 API [GET] /refund/domestic/refunds/{out_refund_no}")]
public async Task TestExecuteGetRefundDomesticRefundByOutRefundNumber()
{
var request = new Models.GetRefundDomesticRefundByOutRefundNumberRequest()
{
OutRefundNumber = "FAKE_OUTREFUNDNO"
};
var response = await TestClients.Instance.ExecuteGetRefundDomesticRefundByOutRefundNumberAsync(request);
Assert.True(response.IsSuccessful());
Assert.NotNull(response.RefundId);
Assert.NotNull(response.OutRefundNumber);
Assert.NotNull(response.TransactionId);
Assert.NotNull(response.OutTradeNumber);
Assert.NotNull(response.Channel);
Assert.NotNull(response.Status);
Assert.NotNull(response.UserReceivedAccount);
Assert.NotNull(response.FundsAccount);
Assert.True(response.Amount.Total > 0);
Assert.True(response.Amount.Refund > 0);
Assert.True(response.Amount.PayerTotal > 0);
Assert.True(response.Amount.PayerRefund > 0);
}
}
}