2323from models_library .wallets import WalletID
2424from pydantic import EmailStr , HttpUrl , parse_obj_as
2525from servicelib .logging_utils import log_decorator
26+ from servicelib .rabbitmq import RPC_REQUEST_DEFAULT_TIMEOUT_S
2627
2728from ..rabbitmq import get_rabbitmq_rpc_client
2829
@@ -64,6 +65,7 @@ async def init_payment( # pylint: disable=too-many-arguments
6465 stripe_price_id = stripe_price_id ,
6566 stripe_tax_rate_id = stripe_tax_rate_id ,
6667 comment = comment ,
68+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
6769 )
6870 assert isinstance (result , WalletPaymentInitiated ) # nosec
6971 return result
@@ -85,6 +87,7 @@ async def cancel_payment(
8587 payment_id = payment_id ,
8688 user_id = user_id ,
8789 wallet_id = wallet_id ,
90+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
8891 )
8992
9093
@@ -106,6 +109,7 @@ async def get_payments_page(
106109 product_name = product_name ,
107110 limit = limit ,
108111 offset = offset ,
112+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
109113 )
110114 assert ( # nosec
111115 parse_obj_as (tuple [int , list [PaymentTransaction ]], result ) is not None
@@ -129,6 +133,7 @@ async def get_payment_invoice_url(
129133 user_id = user_id ,
130134 wallet_id = wallet_id ,
131135 payment_id = payment_id ,
136+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
132137 )
133138 return result
134139
@@ -153,6 +158,7 @@ async def init_creation_of_payment_method(
153158 user_id = user_id ,
154159 user_name = user_name ,
155160 user_email = user_email ,
161+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
156162 )
157163 assert isinstance (result , PaymentMethodInitiated ) # nosec
158164 return result
@@ -174,6 +180,7 @@ async def cancel_creation_of_payment_method(
174180 payment_method_id = payment_method_id ,
175181 user_id = user_id ,
176182 wallet_id = wallet_id ,
183+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
177184 )
178185 assert result is None # nosec
179186
@@ -192,6 +199,7 @@ async def list_payment_methods(
192199 parse_obj_as (RPCMethodName , "list_payment_methods" ),
193200 user_id = user_id ,
194201 wallet_id = wallet_id ,
202+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
195203 )
196204 assert isinstance (result , list ) # nosec
197205 return result
@@ -213,6 +221,7 @@ async def get_payment_method(
213221 payment_method_id = payment_method_id ,
214222 user_id = user_id ,
215223 wallet_id = wallet_id ,
224+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
216225 )
217226 assert isinstance (result , PaymentMethodGet ) # nosec
218227 return result
@@ -234,6 +243,7 @@ async def delete_payment_method(
234243 payment_method_id = payment_method_id ,
235244 user_id = user_id ,
236245 wallet_id = wallet_id ,
246+ timeout_s = 2 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
237247 )
238248 assert result is None # nosec
239249
@@ -274,6 +284,7 @@ async def pay_with_payment_method( # noqa: PLR0913 # pylint: disable=too-many-a
274284 stripe_price_id = stripe_price_id ,
275285 stripe_tax_rate_id = stripe_tax_rate_id ,
276286 comment = comment ,
287+ timeout_s = 3 * RPC_REQUEST_DEFAULT_TIMEOUT_S ,
277288 )
278289
279290 assert isinstance (result , PaymentTransaction ) # nosec
0 commit comments