package card_apple_order

import (
	"fmt"
	"kami/internal/consts"
	_ "kami/internal/logic/card_apple_account"
	"kami/internal/model"
	"testing"

	_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
	"github.com/gogf/gf/v2/os/gctx"
	"github.com/gogf/gf/v2/os/glog"
)

func Test_sRechargeHistory_UpdateActualAmountAndHistory(t *testing.T) {
	service := New()
	ctx := gctx.New()
	err := service.UpdateActualAmountAndHistory(ctx, &model.AppleAccountUpdateAmountAndHistoryRecord{
		OrderInfo: &model.AppleAccountUpdateAmountRecord{
			OrderNo: "2407290307057434",
			Amount:  100,
			Status:  consts.AppleRechargeOrderSuccess,
			Remark:  "金额异议订单二次回调",
		},
		HistoryOperation: consts.AppleRechargeOperationHandleActualAmountSuccess,
		HistoryRemark:    "手动修改订单成功",
	}, nil)
	glog.Error(ctx, err)
}

func Test_sRechargeHistory_UpdateActualAmountAndHistoryAndWallet(t *testing.T) {
	service := New()
	ctx := gctx.New()
	_ = service.UpdateActualAmountAndHistoryAndWallet(ctx, &model.AppleAccountUpdateAmountAndHistoryRecord{
		OrderInfo: &model.AppleAccountUpdateAmountRecord{
			OrderNo: "2407290307057434",
			Amount:  100,
			Status:  consts.AppleRechargeOrderSuccess,
			Remark:  fmt.Sprintf("修正金额：%.2f", 100.0),
		},
		HistoryOperation: consts.AppleRechargeOperationHandleActualAmountSuccess,
		HistoryRemark:    fmt.Sprintf("修正金额：%.2f", 100.0),
		WalletRemark:     fmt.Sprintf("修正金额：%.2f", 100.0),
	})
}
