def test_checkout_widget_render_with_prefill(razorpay_payment, gateway_params): widget = RazorPayCheckoutWidget(payment=razorpay_payment, **gateway_params) assert widget.render() == ( '<script data-amount="8000" data-buttontext="Pay now with Razorpay" ' 'data-currency="INR" data-description="Total payment" ' 'data-image="image.png" data-key="public" data-name="Saleor" ' 'data-prefill.email="*****@*****.**" ' 'data-prefill.name="Doe John" ' 'src="https://checkout.razorpay.com/v1/checkout.js"></script>')
def test_checkout_widget_render_with_prefill(razorpay_payment, gateway_params): payment_info = create_payment_information(razorpay_payment) widget = RazorPayCheckoutWidget( payment_information=payment_info, **gateway_params) assert widget.render() == ( '<script data-amount="8000" data-buttontext="Pay now with Razorpay" ' 'data-currency="INR" data-description="Total payment" ' 'data-image="image.png" data-key="public" data-name="Saleor" ' 'data-prefill.email="*****@*****.**" ' 'data-prefill.name="Doe John" ' 'src="https://checkout.razorpay.com/v1/checkout.js"></script>')
def test_checkout_widget_render_without_prefill(razorpay_payment, gateway_params): gateway_params['prefill'] = False widget = RazorPayCheckoutWidget(payment=razorpay_payment, attrs={'data-custom': '123'}, **gateway_params) assert widget.render() == ( '<script data-amount="8000" data-buttontext="Pay now with Razorpay" ' 'data-currency="INR" data-custom="123" ' 'data-description="Total payment" ' 'data-image="image.png" data-key="public" data-name="Saleor" ' 'src="https://checkout.razorpay.com/v1/checkout.js"></script>')
def test_checkout_widget_render_without_prefill(razorpay_payment, gateway_params): gateway_params['prefill'] = False payment_info = create_payment_information(razorpay_payment) widget = RazorPayCheckoutWidget( payment_information=payment_info, attrs={'data-custom': '123'}, **gateway_params) assert widget.render() == ( '<script data-amount="8000" data-buttontext="Pay now with Razorpay" ' 'data-currency="INR" data-custom="123" ' 'data-description="Total payment" ' 'data-image="image.png" data-key="public" data-name="Saleor" ' 'src="https://checkout.razorpay.com/v1/checkout.js"></script>')
def test_checkout_widget_render_without_prefill(razorpay_payment, gateway_config): gateway_config.connection_params["prefill"] = False payment_info = create_payment_information(razorpay_payment) widget = RazorPayCheckoutWidget( payment_information=payment_info, attrs={"data-custom": "123"}, **gateway_config.connection_params, ) assert widget.render() == ( '<script data-amount="9840" data-buttontext="Pay now with Razorpay" ' 'data-currency="INR" data-custom="123" ' 'data-description="Total payment" ' 'data-image="image.png" data-key="public" data-name="Saleor" ' 'src="https://checkout.razorpay.com/v1/checkout.js"></script>')