package payment

import (
	"testing"

	"kra/internal/biz"
)

func TestCallbackFieldsAcceptsCaseInsensitiveContentType(t *testing.T) {
	callback := &biz.PaymentCallback{
		Headers: map[string]string{"content-type": "Application/X-WWW-Form-Urlencoded"},
		Body:    []byte("out_trade_no=ORDER-1&sign=signature"),
	}
	fields := callbackFields(callback)
	if fields["out_trade_no"] != "ORDER-1" || fields["sign"] != "signature" {
		t.Fatalf("callback fields = %#v", fields)
	}
}
