feat: update prepay id

This commit is contained in:
yanghao05
2025-04-14 20:48:50 +08:00
parent e3cee91758
commit 69e3dd1070
5 changed files with 122 additions and 10 deletions

View File

@@ -0,0 +1,52 @@
package wepay
import (
"context"
"fmt"
"testing"
"time"
"quyun/app/service/testx"
. "github.com/smartystreets/goconvey/convey"
"github.com/stretchr/testify/suite"
"go.ipao.vip/atom/contracts"
"go.uber.org/dig"
)
type WePayInjectParams struct {
dig.In
Initials []contracts.Initial `group:"initials"`
Client *Client
}
type WePayTestSuite struct {
suite.Suite
WePayInjectParams
}
func Test_WePay(t *testing.T) {
providers := testx.Default().With(Provide)
testx.Serve(providers, t, func(params WePayInjectParams) {
suite.Run(t, &WePayTestSuite{WePayInjectParams: params})
})
}
func (s *WePayTestSuite) Test_PrePay() {
Convey("get prepay", s.T(), func() {
Convey("prepay", func() {
resp, err := s.Client.V3TransactionJsapi(context.Background(), func(bm *BodyMap) {
bm.
OutTradeNo(fmt.Sprintf("test_trade_no_%d", time.Now().Unix())).
Description("Test transaction").
Payer("o5Bzk644x3LOMJsKSZRlqWin74IU")
})
So(err, ShouldBeNil)
So(resp, ShouldNotBeNil)
s.T().Logf("prepay response: %+v", resp)
})
})
}