class MockPspAdapter:
    code="mock"
    async def initiate_payment(self, request):
        return {"redirect_url": f"https://mock.psp/pay/{request['id']}", "token": f"mock-{request['id']}"}
    async def verify_signature(self, payload):
        return payload.get("signature") in ("mock-valid", "valid", None)
    async def verify_payment(self, payload):
        paid=payload.get("normalized_status", payload.get("status","paid"))=="paid"
        return {"verified": paid, "status": "paid" if paid else "failed", "provider_transaction_id": payload.get("provider_transaction_id")}
class ZarinpalAdapter(MockPspAdapter): code="zarinpal"
class IdpayAdapter(MockPspAdapter): code="idpay"
ADAPTERS={"mock":MockPspAdapter(),"zarinpal":ZarinpalAdapter(),"idpay":IdpayAdapter()}
