package tysk import ( "gitea.cdlsxd.cn/self-tools/tysk/tysk_constant" "gitea.cdlsxd.cn/self-tools/tysk/tysk_entity" "testing" "time" ) const UserName = "LSXDWL003_ZL" var g = NewTysk(UserName, WithEnvTest()) func Test_GetAccountBalance(t *testing.T) { req := tysk_entity.GetAccountBalanceReq{ AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"}, } res, err := g.GetAccountBalance(req) t.Log(res, err) } func Test_GetTodayTransHis(t *testing.T) { req := tysk_entity.TodayTransHisReq{ AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"}, TranType: tysk_constant.TranType("01"), StartRecord: 1, PageNumber: 10, } res, err := g.GetTodayTransHis(req) t.Log(res, err) } func Test_GetAccountInfo(t *testing.T) { req := tysk_entity.AccountInfoReq{ StartRecord: 1, PageNumber: 10, } res, err := g.GetAccountInfo(req) t.Log(res, err) } func Test_ReceiptApply(t *testing.T) { req := tysk_entity.ReceiptApplyReq{ ClientID: "test123123", AccountNo: "8110701012401269599", StartDate: "20250730", EndDate: "20250801", } res, err := g.ReceiptApply(req) t.Log(res, err) } func Test_ReceiptQuery(t *testing.T) { req := tysk_entity.ReceiptQueryReq{ ClientID: "test123123", StartRecord: 1, PageNumber: 10, } res, err := g.ReceiptQuery(req) t.Log(res, err) } func Test_ReceiptDownload(t *testing.T) { req := tysk_entity.ReceiptDownloadReq{ FileType: tysk_constant.FileTypePDF, RcptNums: []string{"8110701012401269599_20250730SG0D0000084253000001"}, } res, err := g.ReceiptDownload(req) t.Log(res, err) } func Test_TransHisQueryApply(t *testing.T) { req := tysk_entity.TransHisQueryApplyReq{ ClientID: "123456", AccountNo: "8110701013301269598", StartDate: "20250729", EndDate: "20250803", } res, err := g.TransHisQueryApply(req) t.Log(res, err) } func Test_TransHisQuery(t *testing.T) { req := tysk_entity.TransHisQueryReq{ ClientID: "123456", TranType: tysk_constant.TranTypeAll, StartRecord: 1, PageNumber: 10, } res, err := g.TransHisQuery(req) t.Log(res, err) } func Test_BalanceHisQueryApply(t *testing.T) { req := tysk_entity.BalanceHisQueryApplyReq{ ClientID: "123456", AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"}, StartDate: "20250728", EndDate: "20250803", } res, err := g.BalanceHisQueryApply(req) t.Log(res, err) } func Test_BalanceHisQuery(t *testing.T) { req := tysk_entity.BalanceHisQueryReq{ ClientID: "123456", StartRecord: 1, PageNumber: 10, } res, err := g.BalanceHisQuery(req) t.Log(res, err) } func Test_AccountsTransHisQuery(t *testing.T) { req := tysk_entity.AccountsTransHisQueryReq{ TranType: tysk_constant.TranTypeAll, StartDate: "20250728", EndDate: "20250803", StartRecord: 1, PageNumber: 10, AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"}, } res, err := g.AccountsTransHisQuery(req) t.Log(res, err) } func Test_SinglePay(t *testing.T) { // 模拟常量值 linkPayFlag := tysk_constant.CommonBoolFalse // 默认不联动支付 isCheck := tysk_constant.IsCheckRcvpartyDepbnkIdNot txnType := tysk_constant.TxnCntprTpCus // 客户类型 accType := tysk_constant.PyAccTpPub // 对公账户 isInterbnk := tysk_constant.CommonBoolFalse urgntFlag := tysk_constant.CommonBoolFalse pyTmlnsFlag := tysk_constant.CommonBoolTrue req := tysk_entity.SinglePayReq{ ExternalNum: "MOCK123456789", LinkPayFlag: &linkPayFlag, PypPartyAccnum: "8110701013301269598", RcvPyAccnum: "8110701012401269599", RcvPyAccnm: "成都蓝色兄弟网络科技有限公司ERP", IsCheckRcvpartyDepbnkId: &isCheck, RcvPartyDepbnkId: stringPtr("中信银行北京朝阳支行"), //RcvpartyBnkgId: stringPtr("10140"), TxnCntprTp: &txnType, PyAccTp: accType, Amt: 1000.50, CurrencyID: "CNY", IsInterbnk: &isInterbnk, UrgntAprvFlag: &urgntFlag, PyTmlnsFlag: &pyTmlnsFlag, RsrvtnTms: stringPtr(time.Now().Add(120 * time.Second).Format("2006-01-02 15:04")), Pscpt: "测试付款附言", Rmrk: stringPtr("测试备注"), Rmrk1: stringPtr("备用字段1"), Rmrk2: stringPtr("备用字段2"), } res, err := g.SinglePay(req) //{"dealMode":"1","externalNum":"MOCK123456789","failReason":"","status":"AAAAAAA","statusText":"交易成功"} t.Log(res, err) } func Test_SinglePayQuery(t *testing.T) { req := tysk_entity.SinglePayQueryReq{ ExternalNum: "MOCK123456789", } res, err := g.SinglePayQuery(req) t.Log(res, err) } func Test_BatchPay(t *testing.T) { linkPayFlag := tysk_constant.CommonBoolFalse urgntFlag := tysk_constant.CommonBoolFalse rsrvtnFlag := tysk_constant.CommonBoolTrue checkMode := tysk_constant.CheckModeBatch isInterbnk := tysk_constant.CommonBoolFalse isCheckDepBnk := tysk_constant.IsCheckRcvpartyDepbnkIdNot txnType := tysk_constant.TxnCntprTpCus // 客户类型 accType := tysk_constant.PyAccTpPub // 对公账户 rsvTime := time.Now().Add(2 * time.Minute).Format("2006-01-02 15:04") req := tysk_entity.BatchPayReq{ ExternalBatNum: "MOCK123456789BATCH", LinkPayFlag: &linkPayFlag, PyPartyAccNum: "8110701013301269598", CurrencyID: "CNY", TotNbr: "2", Amt: 1000.75, UrgntAprvFlag: &urgntFlag, RsrvtnFlag: &rsrvtnFlag, RsrvtnTms: stringPtr(rsvTime), CheckMode: &checkMode, List: []tysk_entity.BatchPayList{ { ExternalNum: "BATCH001", RcvPyAccNum: "8110701012401269599", RcvPyAccNm: "成都蓝色兄弟网络科技有限公司ERP", IsInterBnk: &isInterbnk, IsCheckRcvPartyDepBnkId: &isCheckDepBnk, RcvPartyDepBnkId: stringPtr("中信银行北京朝阳支行"), // RcvPartyBnkgId: stringPtr("105100000017"), TxnCntprTp: &txnType, PyAccTp: accType, DebitAmt: 500.75, Pscpt: "货款支付", Rmrk: stringPtr("月度结算"), }, { ExternalNum: "BATCH002", RcvPyAccNum: "8110701013801269600", RcvPyAccNm: "成都蓝色兄弟网络科技有限公司ERP", IsInterBnk: &isInterbnk, IsCheckRcvPartyDepBnkId: &isCheckDepBnk, RcvPartyDepBnkId: stringPtr("中信银行北京朝阳支行"), TxnCntprTp: &txnType, // 客户 PyAccTp: "00", // 对公 DebitAmt: 500, Pscpt: "服务费", }, }, } res, err := g.BatchPay(req) t.Log(res, err) } func Test_BatchPayQuery(t *testing.T) { req := tysk_entity.BatchPayQueryReq{ ExternalBatNum: "MOCK123456789BATCH", } res, err := g.BatchPayQuery(req) t.Log(res, err) } // stringPtr 辅助函数:生成字符串指针 func stringPtr(s string) *string { return &s }