fix: 包年 CNY / 永久 USD 分币种结账
按档位分别拼 Waffo currency,避免永久商品用 CNY 报不可用。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
d4c5637168
commit
e8d98c993f
3 files changed
+60
-20
No files matched your search
@@ -6,12 +6,14 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildCheckoutURL_YearlyOnetime(t *testing.T) {
|
||||
func TestBuildCheckoutURL_YearlyOnetimeCNY(t *testing.T) {
|
||||
cfg := WaffoConfig{
|
||||
StoreSlug: "opsxshell-pwsi6m4n",
|
||||
ProductIDYearly: "PROD_1BIezCi932IbgCzRIV8hcJ",
|
||||
ProductIDPerpetual: "PROD_0pcnzzT4nalEkkcdyIUoD5",
|
||||
Currency: "CNY",
|
||||
CurrencyYearly: "CNY",
|
||||
CurrencyPerpetual: "USD",
|
||||
Environment: "test",
|
||||
SuccessURL: "opsxshell://pro/activated",
|
||||
}
|
||||
@@ -31,19 +33,18 @@ func TestBuildCheckoutURL_YearlyOnetime(t *testing.T) {
|
||||
t.Fatalf("type=%s want onetime", q.Get("type"))
|
||||
}
|
||||
if q.Get("currency") != "CNY" {
|
||||
t.Fatalf("currency=%s", q.Get("currency"))
|
||||
}
|
||||
if q.Get("test") != "true" {
|
||||
t.Fatalf("test=%s", q.Get("test"))
|
||||
t.Fatalf("currency=%s want CNY", q.Get("currency"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildCheckoutURL_PerpetualOnetime(t *testing.T) {
|
||||
func TestBuildCheckoutURL_PerpetualOnetimeUSD(t *testing.T) {
|
||||
cfg := WaffoConfig{
|
||||
StoreSlug: "opsxshell-pwsi6m4n",
|
||||
ProductIDYearly: "PROD_1BIezCi932IbgCzRIV8hcJ",
|
||||
ProductIDPerpetual: "PROD_0pcnzzT4nalEkkcdyIUoD5",
|
||||
Currency: "CNY",
|
||||
CurrencyYearly: "CNY",
|
||||
CurrencyPerpetual: "USD",
|
||||
Environment: "test",
|
||||
SuccessURL: "opsxshell://pro/activated",
|
||||
}
|
||||
@@ -58,7 +59,11 @@ func TestBuildCheckoutURL_PerpetualOnetime(t *testing.T) {
|
||||
if !strings.Contains(u.Path, "PROD_0pcnzzT4nalEkkcdyIUoD5") {
|
||||
t.Fatalf("perpetual product missing: %s", raw)
|
||||
}
|
||||
if u.Query().Get("type") != "onetime" {
|
||||
t.Fatalf("type=%s want onetime", u.Query().Get("type"))
|
||||
q := u.Query()
|
||||
if q.Get("type") != "onetime" {
|
||||
t.Fatalf("type=%s want onetime", q.Get("type"))
|
||||
}
|
||||
if q.Get("currency") != "USD" {
|
||||
t.Fatalf("currency=%s want USD", q.Get("currency"))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user