fix(supplier): improve error messages and update test card data
- Change error returned on balance conversion failure to a clear message "卡号或密码错误" - Update test card number and password to new invalid values for jvnkaQuery test - Modify Heepay client URL from monorepo hostname to localhost address for local testing purposes
This commit is contained in:
@@ -68,7 +68,7 @@ func (c *HeePayClient) QueryCard(ctx context.Context, input *QueryCardInput) (*Q
|
||||
otelresty.TraceClient(webClient)
|
||||
|
||||
for i := range maxRetries {
|
||||
response, err := webClient.R().SetBody(input).Post("http://kami-spider-monorepo:8000/api/heepay/query")
|
||||
response, err := webClient.R().SetBody(input).Post("http://127.0.0.1:8000/api/heepay/query")
|
||||
if err != nil {
|
||||
otelTrace.Logger.WithContext(ctx).Error("请求失败", zap.Error(err))
|
||||
lastErr = err
|
||||
|
||||
@@ -376,7 +376,7 @@ func (c *cardTypeQuery) jvnkaQuery(ctx context.Context) (balance float64, err er
|
||||
}
|
||||
balance, err = convertor.ToFloat(output.Data.JPoints)
|
||||
if err != nil {
|
||||
return c.Balance, err
|
||||
return c.Balance, errors.New("卡号或密码错误")
|
||||
}
|
||||
if balance <= 0 {
|
||||
return c.Balance, fmt.Errorf("该卡余额不足")
|
||||
|
||||
@@ -119,8 +119,8 @@ func Test_cardTypeQuery_jisuCard(t *testing.T) {
|
||||
func Test_cardTypeQuery_jvnkaQuery(t *testing.T) {
|
||||
cardQuery := cardTypeQuery{
|
||||
Balance: 20,
|
||||
CardNo: "2510180420089111",
|
||||
CardPwd: "4540101891683449",
|
||||
CardNo: "45345",
|
||||
CardPwd: "345345345345",
|
||||
QueryType: "outletcard",
|
||||
}
|
||||
for range 3 {
|
||||
|
||||
Reference in New Issue
Block a user