feat(payment): route FlatRender plan purchases through the broker
- identity: when FlatPay (broker) is configured, InitiateZarinPalAsync routes through pay.flatrender.ir instead of calling ZarinPal directly; new HandleBrokerCallbackAsync confirms the payment via the broker inquiry API (authoritative, not trusting the redirect) and activates the plan. New public endpoint GET /v1/payments/callback/broker (already public at the gateway via /callback/*). Env-gated — empty FlatPay__ApiKey keeps the legacy direct-ZarinPal path. - broker: deliver webhooks inline on enqueue (best-effort) in addition to the retry loop, so clients credit near-instantly (db.GetWebhook + goroutine kick). - compose + ENV_FILE: FlatPay__* for identity (FLATPAY_FLATRENDER_*). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -89,6 +89,13 @@ services:
|
||||
ZarinPal__MerchantId: "${ZARINPAL_MERCHANT_ID:-}"
|
||||
ZarinPal__CallbackUrl: "${ZARINPAL_CALLBACK_URL:-http://localhost:8080/v1/payments/callback/zarinpal}"
|
||||
ZarinPal__Sandbox: "${ZARINPAL_SANDBOX:-true}"
|
||||
# FlatRender Pay broker — when ApiKey+Secret are set, plan purchases route
|
||||
# through pay.flatrender.ir (the single ZarinPal-verified domain) instead of a
|
||||
# direct ZarinPal call. ReturnBase = this identity service's public base.
|
||||
FlatPay__BaseUrl: "${FLATPAY_BASE_URL:-https://pay.flatrender.ir}"
|
||||
FlatPay__ApiKey: "${FLATPAY_FLATRENDER_API_KEY:-}"
|
||||
FlatPay__Secret: "${FLATPAY_FLATRENDER_SECRET:-}"
|
||||
FlatPay__ReturnBase: "${FLATPAY_RETURN_BASE:-https://api.flatrender.ir}"
|
||||
Stripe__SecretKey: "${STRIPE_SECRET_KEY:-}"
|
||||
Stripe__WebhookSecret: "${STRIPE_WEBHOOK_SECRET:-}"
|
||||
SnapPay__ClientId: "${SNAPPAY_CLIENT_ID:-}"
|
||||
|
||||
Reference in New Issue
Block a user