fix(cloud): preserve API auth during MPP payment

This commit is contained in:
bearsyankees 2026-08-27 01:01:32 -04:00
parent ca0eddc481
commit 41927358eb
2 changed files with 13 additions and 2 deletions

View file

@ -371,8 +371,17 @@ def _topup(
return http.EXIT_PAYMENT
url = f"{http.app_url()}/api/v1/billing/topup"
auth_header = f"Authorization: Bearer {http.api_token(token)}"
command = [npx, "--yes", "mppx", url, "-J", json.dumps(body), "-H", auth_header]
auth_header = f"X-Strix-Authorization: Bearer {http.api_token(token)}"
command = [
npx,
"--yes",
"mppx",
url,
"-J",
json.dumps(body),
"-H",
auth_header,
]
payment_method = getattr(args, "payment_method", None) or os.environ.get(
"MPPX_STRIPE_PAYMENT_METHOD"
)

View file

@ -320,6 +320,8 @@ def test_topup_passes_payment_method_to_wallet(monkeypatch: pytest.MonkeyPatch)
["billing", "topup", "--credits", "5", "--yes", "--payment-method", "pm_card_visa"]
)
assert code == 0
assert "X-Strix-Authorization: Bearer tok" in commands[0]
assert "Authorization: Bearer tok" not in commands[0]
assert "-M" in commands[0]
assert "paymentMethod=pm_card_visa" in commands[0]