test(payment): add unit tests for payment audit fixes + allow empty supported_types
Tests (1033 new lines, 100% coverage on modified functions): - amount.go: YuanToFen/FenToYuan with precision edge cases - wxpay: mapWxState, wxSV, formatPEM, NewWxpay validation - alipay: isTradeNotExist, NewAlipay validation - webhook: writeSuccessResponse (wxpay JSON, stripe empty, others text) - config: validateProviderRequest, isSensitiveConfigField, joinTypes - fulfillment: resolveRedeemAction idempotency logic Business logic changes: - Allow empty supported_types on provider instances - Block removing payment types when instance has pending orders - Extract resolveRedeemAction as testable pure function
This commit is contained in:
@@ -156,7 +156,6 @@ func TestNewWxpay(t *testing.T) {
|
||||
"apiV3Key": "12345678901234567890123456789012", // exactly 32 bytes
|
||||
"publicKey": "fake-public-key",
|
||||
"publicKeyId": "key-id-001",
|
||||
"certSerial": "SERIAL001",
|
||||
}
|
||||
|
||||
// helper to clone and override config fields
|
||||
|
||||
Reference in New Issue
Block a user