<script>
    var obj = {};

    $('#paySSL').on('click', function() {

        obj.cus_name = $('#customer_name').val();
        obj.cus_phone = $('#mobile').val();
        obj.cus_email = $('#email').val() == '' ? 'demo@example.com' : $('#email').val();
        obj.cus_addr1 = $('#address').val();
        obj.amount = $('#amount').val();
        obj.customer_id = $('#customer_id').val();

        if ($('#mobile').val() != '' && $('#amount').val() != '' && $('#amount').val() != '') {
            console.log(obj);
            $('#sslczPayBtn').prop('postdata', obj);
            $('#sslczPayBtn').click();

        } else {
            if($('#mobile').val() == ''){
                toastr.error('Mobile Number is required');
            }
            if($('#amount').val() == ''){
                toastr.error('Amount is required');
            }

        }


        // if(obj.amount>0 && obj.cus_name != null){



        // }

    });
</script>

@if (checkSettings('ssl-commerz-live') == 'enable')
    <script>


        (function(window, document) {
            var loader = function() {
                var script = document.createElement("script"),
                    tag = document.getElementsByTagName("script")[0];
                script.src = "https://seamless-epay.sslcommerz.com/embed.min.js?" + Math.random().toString(36)
                    .substring(7);
                tag.parentNode.insertBefore(script, tag);
            };

            window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload",
                loader);
        })(window, document);
    </script>
@else

    <script>

        (function(window, document) {
            var loader = function() {
                var script = document.createElement("script"),
                    tag = document.getElementsByTagName("script")[0];
                script.src = "https://sandbox.sslcommerz.com/embed.min.js?" + Math.random().toString(36).substring(
                    7);
                tag.parentNode.insertBefore(script, tag);
            };
            window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload",
                loader);
        })(window, document);
    </script>
@endif
