feat: align ids to int64
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"quyun/v2/pkg/consts"
|
||||
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/stretchr/testify/suite"
|
||||
"go.ipao.vip/atom/contracts"
|
||||
"go.uber.org/dig"
|
||||
@@ -83,13 +82,13 @@ func (s *OrderTestSuite) Test_PurchaseFlow() {
|
||||
|
||||
Convey("should create and pay order successfully", func() {
|
||||
// Step 1: Create Order
|
||||
form := &order_dto.OrderCreateForm{ContentID: cast.ToString(content.ID)}
|
||||
form := &order_dto.OrderCreateForm{ContentID: content.ID}
|
||||
createRes, err := Order.Create(ctx, buyer.ID, form)
|
||||
So(err, ShouldBeNil)
|
||||
So(createRes.OrderID, ShouldNotBeEmpty)
|
||||
|
||||
// Verify created status
|
||||
oid := cast.ToInt64(createRes.OrderID)
|
||||
oid := createRes.OrderID
|
||||
o, _ := models.OrderQuery.WithContext(ctx).Where(models.OrderQuery.ID.Eq(oid)).First()
|
||||
So(o.Status, ShouldEqual, consts.OrderStatusCreated)
|
||||
So(o.AmountPaid, ShouldEqual, 1000)
|
||||
@@ -130,7 +129,7 @@ func (s *OrderTestSuite) Test_PurchaseFlow() {
|
||||
Where(models.UserQuery.ID.Eq(buyer.ID)).
|
||||
Update(models.UserQuery.Balance, 500)
|
||||
|
||||
form := &order_dto.OrderCreateForm{ContentID: cast.ToString(content.ID)}
|
||||
form := &order_dto.OrderCreateForm{ContentID: content.ID}
|
||||
createRes, err := Order.Create(ctx, buyer.ID, form)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
@@ -201,7 +200,7 @@ func (s *OrderTestSuite) Test_OrderDetails() {
|
||||
createRes, _ := Order.Create(
|
||||
ctx,
|
||||
buyer.ID,
|
||||
&order_dto.OrderCreateForm{ContentID: cast.ToString(content.ID)},
|
||||
&order_dto.OrderCreateForm{ContentID: content.ID},
|
||||
)
|
||||
Order.Pay(ctx, buyer.ID, createRes.OrderID, &order_dto.OrderPayForm{Method: "balance"})
|
||||
|
||||
@@ -254,7 +253,7 @@ func (s *OrderTestSuite) Test_PlatformCommission() {
|
||||
|
||||
Convey("should deduct 10% fee", func() {
|
||||
payForm := &order_dto.OrderPayForm{Method: "balance"}
|
||||
_, err := Order.Pay(ctx, buyer.ID, cast.ToString(o.ID), payForm)
|
||||
_, err := Order.Pay(ctx, buyer.ID, o.ID, payForm)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
// Verify Creator Balance (1000 - 10% = 900)
|
||||
@@ -303,7 +302,7 @@ func (s *OrderTestSuite) Test_ExternalPayment() {
|
||||
models.OrderItemQuery.WithContext(ctx).Create(&models.OrderItem{OrderID: o.ID, ContentID: 999})
|
||||
|
||||
Convey("should process external payment callback", func() {
|
||||
err := Order.ProcessExternalPayment(ctx, cast.ToString(o.ID), "ext_tx_id_123")
|
||||
err := Order.ProcessExternalPayment(ctx, o.ID, "ext_tx_id_123")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
// Verify Status
|
||||
|
||||
Reference in New Issue
Block a user