fixed error
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-09-21 17:51:10 +05:00
parent f42ad01828
commit 23d208769c
2 changed files with 64 additions and 6 deletions

View File

@@ -73,11 +73,33 @@ func (c *HTTPClient) Register(ctx context.Context, req RegisterRequest) (Registe
}
type statusResponse struct {
OrderStatus int `json:"orderStatus"`
ActionCode string `json:"actionCode"`
ActionCodeDescription string `json:"actionCodeDescription"`
ErrorCode string `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
OrderStatus int `json:"orderStatus"`
ActionCode flexibleString `json:"actionCode"`
ActionCodeDescription string `json:"actionCodeDescription"`
ErrorCode string `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
}
// flexibleString unmarshals a JSON string or a JSON number into a Go
// string. GBÜS is documented to send actionCode as a string, but some
// deployments send it as a bare number, so decoding must accept either.
type flexibleString string
func (s *flexibleString) UnmarshalJSON(data []byte) error {
if string(data) == "null" {
*s = ""
return nil
}
if len(data) > 0 && data[0] == '"' {
var str string
if err := json.Unmarshal(data, &str); err != nil {
return err
}
*s = flexibleString(str)
return nil
}
*s = flexibleString(data)
return nil
}
func (c *HTTPClient) CheckStatus(ctx context.Context, req StatusRequest) (StatusResult, error) {
@@ -101,7 +123,7 @@ func (c *HTTPClient) CheckStatus(ctx context.Context, req StatusRequest) (Status
return StatusResult{
Paid: parsed.OrderStatus == 2,
OrderStatus: parsed.OrderStatus,
ActionCode: parsed.ActionCode,
ActionCode: string(parsed.ActionCode),
ActionCodeDescription: parsed.ActionCodeDescription,
ErrorCode: parsed.ErrorCode,
ErrorMessage: parsed.ErrorMessage,