Bazaar: clear message when Bazaar is missing, old or not connected; reconnect before the next try
Android: buy() checks the Poolakey connection state and reconnects; BazaarNotFound / not supported / dynamic price not supported become error "unavailable" (not_installed | old_bazaar | not_connected) instead of a generic failure. assembleDebug green: com.tadrisino.math.app, versionCode 2, queries com.farsitel.bazaar. Not run on a phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -266,7 +266,14 @@ function CheckoutSheet({ plan, storePrices, onClose, onPaid }: { plan: Plan | nu
|
||||
const outcome = await payWithBazaar(plan);
|
||||
if (outcome) setDone(outcome);
|
||||
} catch (err) {
|
||||
setError(friendlyError(err, 'خرید از بازار تأیید نشد. اگه پولی کم شده، دوباره «پرداخت» رو بزن تا همون خرید ثبت بشه.'));
|
||||
if (err instanceof BazaarPurchaseError && err.kind === 'unavailable') {
|
||||
// کارِ کاربر است، نه خطای خرید: پولی جابهجا نشده.
|
||||
setError(err.message === 'old_bazaar'
|
||||
? 'کافهبازارِ گوشیت قدیمیه؛ از خودِ بازار بهروزش کن و دوباره بزن، یا با کارتِ بانکی پرداخت کن.'
|
||||
: 'کافهبازار روی گوشیت پیدا نشد یا وصل نشد. مطمئن شو نصبه و وارد حسابت شدی، بعد دوباره بزن؛ یا با کارتِ بانکی پرداخت کن.');
|
||||
} else {
|
||||
setError(friendlyError(err, 'خرید از بازار تأیید نشد. اگه پولی کم شده، دوباره «پرداخت» رو بزن تا همون خرید ثبت بشه.'));
|
||||
}
|
||||
}
|
||||
setBusy(false);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user