https://intlbondmarine.epaypolicy.com/

Last Checked: Apr 25, 2024, 12:35 EDT

IP Address: 104.18.11.32
ASN #: AS Unknown
Location: Unknown, Unknown, Unknown
URL Reputation:
  • Unknown This URL is not identified as malicious in the PhishTank Database.
  • Unknown PhishCheck thinks this URL is likely not a phish.
  • Unknown OpenPhish: URL not in feed.

Other submissions on 104.18.11.32:

Other submissions on epaypolicy.com:

  • https://bbjax.epaypolicy.com/

Previous checks:

  • Apr 26, 2024, 00:05 EDT

                               Domain Name: epaypolicy.com
Registry Domain ID: 1877050671_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.godaddy.com
Registrar URL: https://www.godaddy.com
Updated Date: 2023-09-23T11:33:54Z
Creation Date: 2014-09-22T21:41:24Z
Registrar Registration Expiration Date: 2024-09-22T21:41:24Z
Registrar: GoDaddy.com, LLC
Registrar IANA ID: 146
Registrar Abuse Contact Email: abuse@godaddy.com
Registrar Abuse Contact Phone: +1.4806242505
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
Domain Status: clientRenewProhibited https://icann.org/epp#clientRenewProhibited
Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
Registry Registrant ID: Not Available From Registry
Registrant Name: Registration Private
Registrant Organization: Domains By Proxy, LLC
Registrant Street: DomainsByProxy.com
Registrant Street: 2155 E Warner Rd
Registrant City: Tempe
Registrant State/Province: Arizona
Registrant Postal Code: 85284
Registrant Country: US
Registrant Phone: +1.4806242599
Registrant Phone Ext:
Registrant Fax: 
Registrant Fax Ext:
Registrant Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=epaypolicy.com
Registry Admin ID: Not Available From Registry
Admin Name: Registration Private
Admin Organization: Domains By Proxy, LLC
Admin Street: DomainsByProxy.com
Admin Street: 2155 E Warner Rd
Admin City: Tempe
Admin State/Province: Arizona
Admin Postal Code: 85284
Admin Country: US
Admin Phone: +1.4806242599
Admin Phone Ext:
Admin Fax: 
Admin Fax Ext:
Admin Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=epaypolicy.com
Registry Tech ID: Not Available From Registry
Tech Name: Registration Private
Tech Organization: Domains By Proxy, LLC
Tech Street: DomainsByProxy.com
Tech Street: 2155 E Warner Rd
Tech City: Tempe
Tech State/Province: Arizona
Tech Postal Code: 85284
Tech Country: US
Tech Phone: +1.4806242599
Tech Phone Ext:
Tech Fax: 
Tech Fax Ext:
Tech Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=epaypolicy.com
Name Server: RODNEY.NS.CLOUDFLARE.COM
Name Server: SIMA.NS.CLOUDFLARE.COM
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2024-04-25T16:35:17Z <<<
For more information on Whois status codes, please visit https://icann.org/epp

TERMS OF USE: The data contained in this registrar's Whois database, while believed by the
registrar to be reliable, is provided "as is" with no guarantee or warranties regarding its
accuracy. This information is provided for the sole purpose of assisting you in obtaining
information about domain name registration records. Any use of this data for any other purpose
is expressly forbidden without the prior written permission of this registrar. By submitting
an inquiry, you agree to these terms and limitations of warranty. In particular, you agree not
to use this data to allow, enable, or otherwise support the dissemination or collection of this
data, in part or in its entirety, for any purpose, such as transmission by e-mail, telephone,
postal mail, facsimile or other means of mass unsolicited, commercial advertising or solicitations
of any kind, including spam. You further agree not to use this data to enable high volume, automated
or robotic electronic processes designed to collect or compile this data for any purpose, including
mining this data for your own personal or commercial purposes. Failure to comply with these terms
may result in termination of access to the Whois database. These terms may be subject to modification
at any time without notice.


                             
  • GET
    0 Timed out waiting for a response.

    https://intlbondmarine.epaypolicy.com/favicon.ico

<html><head><meta http-equiv="origin-trial" content="Az520Inasey3TAyqLyojQa8MnmCALSEU29yQFW8dePZ7xQTvSt73pHazLFTK5f7SyLUJSo2uKLesEtEa9aUYcgMAAACPeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZS5jb206NDQzIiwiZmVhdHVyZSI6IkRpc2FibGVUaGlyZFBhcnR5U3RvcmFnZVBhcnRpdGlvbmluZyIsImV4cGlyeSI6MTcyNTQwNzk5OSwiaXNTdWJkb21haW4iOnRydWUsImlzVGhpcmRQYXJ0eSI6dHJ1ZX0=">
<title>International Bond &amp; Marine Brokerage LTD</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/css/bootstrap-datepicker.min.css" integrity="sha384-tjXFs19utvO5kQjuOnxU5SV8L6RjLx49IiF3vVtFx/Rl0L7hB2DuW/t5V1I3HjHq" crossorigin="anonymous" referrerpolicy="no-referrer">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css" integrity="sha384-fJH2gz4kcHl6LNRYI7TauVxjt5r/u+NfM+XpXDSSyHTCS7PMUXXW0Qo677Xr+bok" crossorigin="anonymous" referrerpolicy="no-referrer">
<script type="text/javascript" async="" src="https://www.gstatic.com/recaptcha/releases/V6_85qpc2Xf2sbe3xTnRte7m/recaptcha__en.js" crossorigin="anonymous" integrity="sha384-0lJkOVHDy3ItYlCbUoEzThjP3hLhLYfEFPAkVOCxnJpb5K9Fllso+S8TRBILcfPo"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.3.2/jquery-migrate.min.js" integrity="sha384-K4DXq6cnbcH6WemsoQDwSmAF+6spEE5W/rGMfBulBdu61Dxlr33bmPKzUCSJmE4c" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js" integrity="sha384-leGYpHE9Tc4N9OwRd98xg6YFpB9shlc/RkilpFi0ljr3QD4tFoFptZvgnnzzwG4Q" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha384-pPttEvTHTuUJ9L2kCoMnNqCRcaMPMVMsWVO+RLaaaYDmfSP5//dP6eKRusbPcqhZ" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-placeholder/2.3.1/jquery.placeholder.min.js" integrity="sha384-Wm06BQNAf5f7PCD5lGnOu7aCq5R0GyVzAyaD9MCL1F2cXwnhv0r82xcBk7127dyE" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.1/knockout-latest.min.js" integrity="sha384-PA7LgTHoYGwvEy2evWvC3sNOQlmK/vfk//sStiSk3QK3fUDO8oN3VKvHgSPyVKqx" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.4.1/knockout.mapping.min.js" integrity="sha384-5iaafnDCmIZLLNfCHYJwy/FQZf6AXVLgSx8wPvUvkOOOFk7ODxEXwdfxgHW3dv4a" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" integrity="sha384-PtTRqvDhycIBU6x1wwIqnbDo8adeWIWP3AHmnrvccafo35E7oIvW7HPXn2YimvWu" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.7/jquery.iframe-transport.js" integrity="sha384-KaIVpbxdDf/z0pnZKLWbvRJi1LjOz/iEtIkMUHrcU3INkVoI9q1A7qiJ2U/O5pk1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blueimp-file-upload/9.5.7/jquery.fileupload.min.js" integrity="sha384-bvyDIPIJ8KCj4ujHT8iXQCBrPp/vokYDjeAPXR8VpR58GelVdL4pCR+MEamZDnAm" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/jquery.validate.min.js" integrity="sha384-cs1D9mYtA60FIcsT1T7+pERF8l9Ynz6WMFXyrBFkf2ewKQnOOprsRwo4sC+Kacmi" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.min.js" integrity="sha384-w48xMCwgWQu0zb3PvQI/rK5lfN6G+lSWu+qI4ukKZg3I5Xx3/VWA8IiaQ8O7tZur" crossorigin="anonymous"></script>
<script src="https://www.google.com/recaptcha/api.js" async="" defer=""></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.6/numeral.min.js" integrity="sha384-3hgmRzlUcHmQydKeUIr2tGXvJZs5gK6VZ+LVpzUkHtkRo2A8fuCMdfN3vw2h9DPJ" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="/Home/Styles">
<script type="text/javascript">
        $(document).ready(function () {
            $('input, textarea').placeholder();
        });
    </script>
<script type="text/javascript" src="/Scripts/script.js"></script>
</head>
<body>
<header>
<div class="main-wrapper container hidden-sm hidden-xs">
<div class="user-actions-top-bar navbar-right">
<ul class="nav navbar-nav">
<li><a href="/SignIn">Sign In</a></li>
<li><a href="/SignUp">Sign Up</a></li>
</ul>
</div>
</div>
<div class="logo-top-bar">
<a id="logo-link" href="/">
<img src="https://res.cloudinary.com/epay3/image/upload/c_fit,h_175,w_350/logo_002_gdwmas.png" id="header-logo"> </a>
</div>
<div class="main-wrapper container visible-sm visible-xs">
<div class="user-actions-top-bar mobile navbar-right">
<ul class="nav navbar-nav">
<li><a href="/SignIn">Sign In</a></li>
<li><a href="/SignUp">Sign Up</a></li>
</ul>
</div>
</div>
<div id="error-area" class="col-md-12 alerts" style="display:none">
<div class="alert alert-warning fade in red-alert">
<button type="button" class="close" data-hide="alerts" onclick="hideErrorMessage();"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<strong><span id="error-message"></span></strong>
</div>
</div>
<div id="confirmation-area" class="col-md-12 alerts" style="display:none">
<div class="alert alert-warning fade in green-alert">
<button type="button" class="close" data-hide="alerts" onclick="hideConfirmationMessage();"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<strong><span id="confirmation-message"></span></strong>
</div>
</div>
</header>
<div class="main-wrapper container">
<div id="warning-area" class="col-md-12 alerts" data-bind="visible: duplicateWarningActive" style="display:none">
<div class="alert alert-warning fade in">
<button type="button" class="close" data-hide="alerts" data-bind="click: hideDuplicateWarning"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<strong>
<span id="warning-message">
A <a data-bind="attr: {href: duplicateTransactionReceiptUrl}" target="_blank" href="">duplicate transaction</a> was recently submitted.
To submit this payment anyways, please re-enter the payment information. If there are questions or concerns, please reach out to your insurance provider.
</span>
</strong>
</div>
</div>
<div class="page-title text-center">
<h1>Make a Payment</h1>
<p>Please enter your payment information below</p>
</div>
<form action="/" enctype="multipart/form-data" id="payment-form" method="post" sessionid="" novalidate="novalidate"><input data-val="true" data-val-required="The MakeFieldsReadonly field is required." id="MakeFieldsReadonly" name="MakeFieldsReadonly" type="hidden" value="False"> <div class="row">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label for="payer">Payer</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<span class="field-validation-valid" data-valmsg-for="Payer" data-valmsg-replace="true"></span>
<input class="form-control" data-bind="value: payer" data-val="true" data-val-maxlength="The Payer has a maximum length of 150 characters." data-val-maxlength-max="150" data-val-required="The Payer field is required." id="Payer" name="Payer" placeholder="Payer" required="" type="text" value="">
</div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group email">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label for="email">Email Address</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<span class="field-validation-valid" data-valmsg-for="EmailAddress" data-valmsg-replace="true"></span>
<input class="form-control" data-bind="value: emailAddress" data-val="true" data-val-email="The Email Address is not properly formatted" data-val-maxlength="The field Email Address must be a string or array type with a maximum length of '150'." data-val-maxlength-max="150" data-val-required="The Email Address field is required." id="EmailAddress" name="EmailAddress" placeholder="Email Address" required="" type="text" value="">
</div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>Invoice # (s)</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<span class="field-validation-error transaction-attribute-regex-error-msg" style="display:none" data-valmsg-for="TransactionAttribute4209" data-valmsg-replace="true"></span>
<span class="field-validation-error" style="display:none" data-valmsg-for="TransactionAttribute4209" data-valmsg-replace="true">The Invoice # (s) field is required.</span>
<input name="TransactionAttribute4209" class="form-control full " data-bind="textInput: TransactionAttribute4209" data-toggle="popover" data-trigger="manual focus" id="TransactionAttribute4209" onblur="validateCustomAttribute(event)" pattern="(.*?)" placeholder="If paying multiple, you may use the attachments option below" required="" type="text" value=""> </div>
</div>
</div>
</div>
<div class="row" style="display: none;" data-bind="visible: model.invoices().some(i => i.FinanceDownPayment() > 0)">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>Premium Finance Agreement</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<span id="show-pfa-text" class="pfa-supporting-text" data-bind="visible: !isAgreementValid(), style: {color: showInvalidAgreementMessage() ? 'red' : '' }"><i class="fas fa-exclamation-circle pfa-invalid-exclamation"></i> Please go through the <b>Premium Finance Agreement</b> before going ahead.</span>
<div>
<button type="button" class="btn btn-primary pfa-btn pfa-btn-not-consented" id="show-pfa" data-bind="click: showAgreement, class: pfaBtnStatus">
<span>View Premium Finance Agreement &amp; Sign</span>
<span data-bind="visible: agreementButtonCheckDisplay()" id="pfa-check-display" style="display: none;">
<i class="fas fa-check-circle pfa-valid-check"></i>
</span>
</button>
<span data-bind="visible: premiumFinanceAgreementLoading()" id="loading-pfa" style="display: none;">
<i class="fas fa-spinner fa-spin"></i> <label class="pfa-supporting-text">Loading Premium Finance Agreement...</label>
</span>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 left pfa-supporting-text text-danger" data-bind="visible: premiumFinanceAgreementErrored()" style="display: none;">
<span>Something has gone wrong when trying to retrieve your premium finance agreement. Please click the button to retry or pay your financed invoice in full.</span>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="termsAndConditionsModalDialog" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
<div class="modal-dialog max-size-modal">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" ,="" aria-hidden="true">×</button>
<h4 class="model-title">Terms &amp; Conditions</h4>
</div>
<div class="modal-body">
<span class="" data-bind="text: autoPayTermsAndConditions()"></span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<div class="row" style="display: none;" data-bind="visible: showAgreementFinancialBreakdown()">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>Financial Breakdown</label>
<div class="breakdown-payment-financing-logo">
<div>
<img data-bind="attr:{src: premiumFinanceCompanyLogoUri, alt: premiumFinanceAgreementCompanyName}" id="pfc-logo" src="" alt="" width="85%" height="85%">
</div>
Financial Plan Provided by <span data-bind="text: premiumFinanceAgreementCompanyName"></span>
</div>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<div class="breakdown-wrapper">
<table>
<thead class="breakdown-header">
<tr>
<th class="breakdown-th">Down Payment Amount</th>
<th class="breakdown-th">Installment Amount</th>
<th class="breakdown-th">Number of Payments</th>
<th class="breakdown-th">Next Installment Due Date</th>
</tr>
</thead>
<tbody>
<tr>
<td class="breakdown-td" data-cell="down payment amount"><span data-bind="text: formatAmount(totalDownPaymentAmount(), 'USD')">$0.00</span></td>
<td class="breakdown-td" data-cell="installment amount">
<div>
<div>
<span class="breakdown-installment-fee" data-bind="text: formatAmount(installmentAmount(), 'USD')">$0.00</span>
</div>
<span class="breakdown-installment-autopay-fee" data-bind="visible: premiumFinanceAgreementAutoPay()" style="display: none;">+ additional fee</span>
</div>
</td>
<td class="breakdown-td" data-cell="number of payments"><span data-bind="text: financeNumberOfPayments() + ' (' + financePaymentFrequency() + ')'">0 ()</span></td>
<td class="breakdown-td" data-cell="next installment due date"><span data-bind="text: nextInstallmentDueDate()"></span></td>
</tr>
</tbody>
</table>
</div>
<div class="breakdown-payment-message" data-bind="visible: premiumFinanceAgreementAutoPay()" style="display: none;">
<span data-bind="text: '*Estimated additional autopay fee for ACH of ' + formatAmount(autoPayAchFee(), 'USD') + ' or Credit Card of ' + formatAmount(autoPayCreditCardFee(), 'USD') + ' assessed by ePayPolicy.'">*Estimated additional autopay fee for ACH of $0.00 or Credit Card of $0.00 assessed by ePayPolicy.</span>
</div>
<div class="breakdown-payment-message checkbox" data-bind="visible: allowFinanceAutoPay()">
<input type="checkbox" name="EnableFinancingAutoPay" id="EnableFinancingAutoPay" data-bind="checked: premiumFinanceAgreementAutoPay, value: premiumFinanceAgreementAutoPay" value="false">
<label for="EnableFinancingAutoPay"><span id="pfcName" data-bind="text: autoPayDisclaimerText()"></span></label>
</div>
<div class="terms-and-conditions" data-bind="visible: showAutoPayTermsAndConditionsLink()" style="display: none;"><a href="#" data-bind="click: showTermsAndConditionsModal">Terms &amp; Conditions</a></div>
</div>
</div>
</div>
</div>
<div class="payment-amount row">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label for="amount">Amount</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<span class="field-validation-valid" data-valmsg-for="Amount" data-valmsg-replace="true"></span>
<input class="form-control" data-bind="numeric, value: amount" data-val="true" data-val-number="The field Amount must be a number." data-val-range="The Amount must be greater than 0." data-val-range-max="10000000" data-val-range-min="0.01" data-val-required="The Amount field is required." id="Amount" name="Amount" placeholder="Amount (e.g. 123.45)" required="" type="text" value=""> </div>
</div>
</div>
</div>

<div class="row payment-type">
<div class="col-sm-12">
<div class="form-group clearfix">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label for="payment-type">Payment Type</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right clearfix">

<div class="large-device">
<label for="paymentType" class="payment-ui-card clearfix">
<input type="radio" class="form-control payment-radio" name="paymentType" data-bind="click: function() {setPaymentType('Ach'); return true;}, value: 'Ach', checked: paymentMethod" value="Ach">
<div class="payment-ui-card-wrapper">
<div class="ui-card-header ">
<img src="/images/echeck-icon.png" class="img-responsive" alt="credit-card-icon">
<h3 class="text-center">ACH</h3>
</div>
<div class="ui-card-details">
<div class="ui-card-row">
<span class="row-label">Amount</span>
<span class="info" data-bind="text: formatAmount(amount(), 'USD')">$0.00</span>
</div>
<div class="ui-card-row fees">
<span class="row-label">Fee</span>
<span class="info" data-bind="text: amount() > 0 ? formatAmount(payerAchFee(), 'USD') : 'Enter Amount'">Enter Amount</span>
</div>
<div class="ui-card-row totals">
<span class="row-label" data-bind="text: enableScheduledPayments() ? 'Each Payment' : 'Total'">Total</span>
<span class="info" data-bind="text: formatAmount(amount() > 0 ? achTotal() : 0, 'USD')">$0.00</span>
</div>
</div>
<div class="radio-button">
<span></span>
</div>
</div>
</label>
<label for="paymentType" class="payment-ui-card clearfix">
<input type="radio" class="form-control payment-radio" name="paymentType" data-bind="click: function() {setPaymentType('CreditCard'); return true;}, value: 'CreditCard', checked: paymentMethod" value="CreditCard">
<div class="payment-ui-card-wrapper">
<div class="ui-card-header ">
<img src="/images/credit-card-icon.png" class="img-responsive" alt="credit-card-icon">
<h3 class="text-center">Credit Card</h3>
</div>
<div class="ui-card-details">
<div class="ui-card-row">
<span class="row-label">Amount</span>
<span class="info" data-bind="text: formatAmount(amount(), 'USD')">$0.00</span>
</div>
<div class="ui-card-row fees">
<span class="row-label">
Fee
</span>
<span class="info" data-bind="text: amount() > 0 ? formatAmount(payerCreditCardFee(), 'USD') : 'Enter Amount'">Enter Amount</span>
</div>
<div class="ui-card-row totals">
<span class="row-label" data-bind="text: enableScheduledPayments() ? 'Each Payment' : 'Total'">Total</span>
<span class="info" data-bind="text: formatAmount(amount() > 0 ? creditCardTotal() : 0, 'USD')">$0.00</span>
</div>
</div>
<div class="radio-button">
<span></span>
</div>
</div>
</label>
</div>

<div class="small-device">
<div class="options-row clearfix">
<label for="mobilePaymentType" class="payment-ui-card clearfix">
<input type="radio" class="form-control payment-radio" name="mobilePaymentType" data-bind="click: function() {setPaymentType('Ach'); return true;}, value: 'Ach', checked: paymentMethod" value="Ach">
<div class="radio-button">
<span></span>
</div>
<div class="ui-card-header">
<img src="/images/echeck-icon.png" class="img-responsive" alt="ach-icon">
<h3 class="text-center">ACH</h3>
</div>
</label>
<label for="mobilePaymentType" class="payment-ui-card clearfix">
<input type="radio" class="form-control payment-radio" name="mobilePaymentType" data-bind="click: function() {setPaymentType('CreditCard'); return true;}, value: 'CreditCard', checked: paymentMethod" value="CreditCard">
<div class="radio-button">
<span></span>
</div>
<div class="ui-card-header">
<img src="/images/credit-card-icon.png" class="img-responsive" alt="credit-card-icon">
<h3 class="text-center">Credit Card</h3>
</div>
</label>
</div>
<div class="payment-ui-card-wrapper left-tab" data-bind="visible: paymentMethod() == 'CreditCard'" style="display: none;">
<div class="ui-card-details">
<div class="ui-card-row">
<span class="row-label">Amount</span>
<span class="info" data-bind="text: formatAmount(amount(), 'USD')">$0.00</span>
</div>
<div class="ui-card-row fees">
<span class="row-label">Fee</span>
<span class="info" data-bind="text: amount() > 0 ? formatAmount(payerCreditCardFee(), 'USD') : 'Enter Amount'">Enter Amount</span>
</div>
<div class="ui-card-row totals">
<span class="row-label" data-bind="text: enableScheduledPayments() ? 'Each Payment' : 'Total'">Total</span>
<span class="info" data-bind="text: formatAmount(amount() > 0 ? creditCardTotal() : 0, 'USD')">$0.00</span>
</div>
</div>
</div>
<div class="payment-ui-card-wrapper right-tab" data-bind="visible: paymentMethod() == 'Ach'">
<div class="ui-card-details">
<div class="ui-card-row">
<span class="row-label">Amount</span>
<span class="info" data-bind="text: formatAmount(amount(), 'USD')">$0.00</span>
</div>
<div class="ui-card-row fees">
<span class="row-label">
Fee
</span>
<span class="info" data-bind="text: amount() > 0 ? formatAmount(payerAchFee(), 'USD') : 'Enter Amount'">Enter Amount</span>
</div>
<div class="ui-card-row totals">
<span class="row-label" data-bind="text: enableScheduledPayments() ? 'Each Payment' : 'Total'">Total</span>
<span class="info" data-bind="text: formatAmount(amount() > 0 ? achTotal() : 0, 'USD')">$0.00</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<div class="payment-info row">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label for="payment-info">Payment Information</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right" data-bind="visible: paymentMethod() == 'CreditCard'" style="display: none;">
<div class="form-group">
<div data-bind="visible: tokenPublicId() == 'newCreditCard' || creditCardTokenCount() == 0 || true" style="">
<div class="row">
<div class="col-lg-12">
<span class="field-validation-valid" data-valmsg-for="CardAccountHolder" data-valmsg-replace="true"></span>
<input autocomplete="off" class="form-control" data-val="true" data-val-maxlength="The Name on Card has a maximum length of 40 characters." data-val-maxlength-max="40" id="CardAccountHolder" name="CardAccountHolder" placeholder="Name on Card" type="text" value="">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<span class="field-validation-valid" data-valmsg-for="CardNumber" data-valmsg-replace="true"></span>
<span class="ccInput">
<input autocomplete="off" class="form-control" data-bind="textInput: cardNumber" data-val="true" data-val-maxlength="The Card Number has a maximum length of 16 characters." data-val-maxlength-max="16" id="CardNumber" maxlength="16" name="CardNumber" placeholder="Credit Card Number" type="text" value="">
<!-- ko if: cardType() == 'DISCOVER' || cardType() == undefined --><i class="fab fa-2x fa-cc-discover"></i><!-- /ko -->
<!-- ko if: cardType() == 'AMEX' || cardType() == undefined --><i class="fab fa-2x fa-cc-amex"></i><!-- /ko -->
<!-- ko if: cardType() == 'MASTERCARD' || cardType() == undefined --><i class="fab fa-2x fa-cc-mastercard"></i><!-- /ko -->
<!-- ko if: cardType() == 'VISA' || cardType() == undefined --><i class="fab fa-2x fa-cc-visa"></i><!-- /ko -->
</span>
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<input autocomplete="off" class="form-control" data-val="true" data-val-number="The field Month must be a number." id="Month" name="Month" placeholder="Month (MM)" type="text" value="">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<input autocomplete="off" class="form-control" data-val="true" data-val-number="The field Year must be a number." id="Year" name="Year" placeholder="Year (YYYY)" type="text" value="">
</div>
</div>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6">
<input autocomplete="off" class="form-control" data-val="true" data-val-maxlength="The CVC has a maximum length of 4 characters." data-val-maxlength-max="4" data-val-regex="The CVC can only contain numbers." data-val-regex-pattern="^\d{3,4}$" id="CVC" name="CVC" placeholder="CVC" type="text" value="">
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<input autocomplete="off" class="form-control" id="PostalCode" maxlength="6" name="PostalCode" placeholder="Postal Code" type="text" value="">
</div>
</div>
<div class="row" data-bind="if: paymentMethod() != 'Ach'"></div>
</div>
</div>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right" data-bind="visible: paymentMethod() == 'Ach'">
<div>
<div class="tab-pane" id="2a">
<div class="form-group">
<div data-bind="visible: tokenPublicId() == 'newAch' || achTokenCount() == 0 || true" style="">
<div class="row">
<div class="col-lg-12">
<span class="field-validation-valid" data-valmsg-for="BankAccountHolder" data-valmsg-replace="true"></span>
<input autocomplete="off" class="form-control" data-val="true" data-val-maxlength="The Account Holder has a maximum length of 40 characters." data-val-maxlength-max="40" id="BankAccountHolder" name="BankAccountHolder" placeholder="Bank Account Holder" type="text" value="" required="required">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<span class="field-validation-valid" data-valmsg-for="RoutingNumber" data-valmsg-replace="true"></span>
<input autocomplete="off" class="form-control" data-original-title="Routing Number" data-toggle="popover" data-trigger="manual focus" data-val="true" data-val-maxlength="The Routing Number has a maximum length of 9 characters." data-val-maxlength-max="9" id="RoutingNumber" name="RoutingNumber" placeholder="Routing Number" type="text" value="" required="required">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<span class="field-validation-valid" data-valmsg-for="AccountNumber" data-valmsg-replace="true"></span>
<input autocomplete="off" class="form-control" data-original-title="Account Number" data-toggle="popover" data-trigger="manual focus" data-val="true" data-val-maxlength="The Account Number has a maximum length of 17 characters." data-val-maxlength-max="17" data-val-minlength="The Account Number has a minimum length of 3 characters." data-val-minlength-min="3" data-val-regex="The account number can contain only digits." data-val-regex-pattern="\d+" id="AccountNumber" name="AccountNumber" placeholder="Account Number" type="text" value="" required="required">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<input autocomplete="off" class="form-control" data-original-title="Confirm Account Number" data-toggle="popover" data-trigger="manual focus" data-val="true" id="ConfirmAccountNumber" name="ConfirmAccountNumber" placeholder="Confirm Account Number" type="text" value="" required="required">
</div>
</div>
<div class="row" data-bind="if: paymentMethod() == 'Ach'">
<div class="col-md-12">
<div class="checkbox" data-bind="click: ShowSignInPopup">
<input autocomplete="off" class="form-control" id="SavePaymentOption" name="SavePaymentOption" type="checkbox" value="true"><input name="SavePaymentOption" type="hidden" value="false">
<label for="SavePaymentOption">Save my bank account for future use</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" id="attachments">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>Attachments</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<table role="presentation" class="table" cellpadding="10">
<tbody class="files" data-bind="foreach: attachments"></tbody>
</table>
<div class="fileupload-buttonbar">
<div class="left">
<div class="btn add-btn fileinput-button">
<i class="fas fa-plus-circle" aria-hidden="true"></i>
<label id="files-label" for="files">Add files...</label>
<input id="files" type="file" name="files[]" data-url="/Attachments/Upload" accept=".pdf,.csv,.png,.jpg,.jpeg,.doc,.docx,.zip,.xlsx" multiple="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row notes clearfix">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>Notes</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<fieldset>
<span class="field-validation-valid" data-valmsg-for="Comments" data-valmsg-replace="true"></span>
<textarea class="notes-textarea" cols="20" id="Comments" name="Comments" placeholder="This box is for your reference only.

Any information entered here will be displayed on your receipt but will not be viewed or responded to by IB&amp;M." rows="5"></textarea>
</fieldset>
</div>
</div>
</div>
</div>
<!--ko if:model.shouldAutopayEnable-->
<div class="row autopay" style="display:none" data-bind="visible: autoPaySubscriptionId() == null &amp;&amp; hasAccount()">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left">
<label>AutoPay</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<label class="switch">
<input class="form-control" data-val="true" data-val-required="The EnableAutoPay field is required." id="autopay-enable" name="EnableAutoPay" tabindex="-1" type="checkbox" value="true"><input name="EnableAutoPay" type="hidden" value="false">
<span class="slider round"> </span>
</label>
<label for="autopay-enable">
Enable AutoPay for future invoices.
<span class="learn-more"><a href="#" data-bind="click: openAutopayModal">Learn more</a></span>
</label>
</div>
</div>
</div>
</div>
<!--/ko-->
<div class="row payment-confirmation">
<div class="col-sm-12">
<div class="form-group">
<div class="col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left"></div>
<div class="col-lg-9 col-md-9 col-sm-9 right">
<div class="checkbox" data-bind="visible: isAgreementValid()" style="display: none;">
<input type="checkbox" name="FinanceConnectDisclaimerAccepted" id="FinanceConnectDisclaimerAccepted" data-bind="checked: financeConnectDisclaimerAccepted">
<label for="FinanceConnectDisclaimerAccepted">By checking this box, I am agreeing to ePayPolicy's Finance Connect <a href="https://epaypolicy.com/terms-FC/" target="_blank">Provider Notice</a>.</label>
</div>
<p class="agreement">
<label id="standard-disclaimer" class="" for="confirm-disclaimer">
<label id="confirm-disclaimer-label" for="confirm-disclaimer">
By clicking "Send", I authorize International Bond &amp; Marine Brokerage LTD to debit my account.
<span data-bind="visible: payerFee() > 0" style="">
I understand that
<span data-bind="visible: enableScheduledPayments() == false">this payment</span>
<span data-bind="visible: enableScheduledPayments" style="display: none;">each of the <span data-bind="text: numberOfPayments(), visible: numberOfPayments() > 0" style="display: none;"></span> payments</span>
includes a <span data-bind="text: formatAmount(payerFee(), 'USD')">$4.00</span> fee assessed by <a href="http://epaypolicy.com" target="_blank">ePayPolicy</a>.
</span>
</label>
</label>
</p>
<p>
</p><div class="g-recaptcha" data-sitekey="6LeDxZwpAAAAAM8huWYzvoKay-WM4B-1JzvM9s_A"><div style="width: 304px; height: 78px;"><div><iframe title="reCAPTCHA" role="presentation" name="a-8nndiobva8tv" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox allow-storage-access-by-user-activation" src="https://www.google.com/recaptcha/api2/anchor?ar=1&amp;k=6LeDxZwpAAAAAM8huWYzvoKay-WM4B-1JzvM9s_A&amp;co=aHR0cHM6Ly9pbnRsYm9uZG1hcmluZS5lcGF5cG9saWN5LmNvbTo0NDM.&amp;hl=en&amp;v=V6_85qpc2Xf2sbe3xTnRte7m&amp;size=normal&amp;cb=1i72k63pmy8u" width="304" height="78" frameborder="0"></iframe></div><textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea></div><iframe style="display: none;"></iframe></div>
<input type="hidden" class="hiddenRecaptcha required" name="hiddenRecaptcha" id="hiddenRecaptcha">
<br>
<p></p>
<input type="submit" name="submitButton" class="btn btn-success" value="Send" id="Submit" data-bind="css: { 'inactive' : !confirmDisclaimer() }, click: submitForm">
<input type="hidden" id="PaymentMethod" name="PaymentMethod" data-bind="value: paymentMethod" value="Ach">
<input type="hidden" id="EnableScheduledPayments" name="EnableScheduledPayments" data-bind="value: enableScheduledPayments" value="false">
<input type="hidden" id="ScheduledPaymentsEndOption" name="ScheduledPaymentsEndOption" data-bind="value: scheduledPaymentsEndOption" value="Never">
<input type="hidden" id="TokenPublicId" name="TokenPublicId" data-bind="value: submitTokenPublicId">
<input type="hidden" id="DuplicateTransactionReceiptUrl" name="DuplicateTransactionReceiptUrl" data-bind="value: duplicateTransactionReceiptUrl">
<input type="hidden" name="QuoteNumber" data-bind="value: premiumFinanceAgreementQuoteNumber">
<input type="hidden" name="PremiumFinanceAgreementCompanyName" data-bind="value: premiumFinanceAgreementCompanyName">
<input type="hidden" name="PremiumFinanceAgreementConsent" data-bind="value: premiumFinanceAgreementConsent" value="false">
<input type="hidden" name="PremiumFinanceAgreementName" data-bind="value: premiumFinanceAgreementName">
<input type="hidden" name="PremiumFinanceAgreementPhone" data-bind="value: premiumFinanceAgreementPhone">
<input type="hidden" name="PremiumFinanceAgreementEmail" data-bind="value: premiumFinanceAgreementEmail">
<input id="PreAuthorizationCode" name="PreAuthorizationCode" type="hidden" value="">
<input data-val="true" data-val-date="The field PreAuthorizationDate must be a date." id="PreAuthorizationDate" name="PreAuthorizationDate" type="hidden" value="">
<input data-val="true" data-val-number="The field ClientNotificationId must be a number." id="ClientNotificationId" name="ClientNotificationId" type="hidden" value="">
<input name="__RequestVerificationToken" type="hidden" value="IIXPT5W5yH9lEW9NzzAOT-XBbx1XwZ1nv5P9QTA2QziizlrpePGlrYp15STxRCkgexNj6hhoy3wZqofjXzkw6lh9yEA1">
<input type="hidden" name="attachments" id="attachments" data-bind="value: fileModels" value="[]">
</div>
</div>
</div>
</div>
<div id="bankAccountNumberPopup" style="display: none">
<div><img src="/images/account-number.png"></div>
</div>
<div id="bankRoutingNumberPopup" style="display: none">
<div><img src="/images/routing-number.png"></div>
</div>
</form>
<div class="modal fade" id="pfaModalDialog" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
<div class="modal-dialog max-size-modal">
<div class="modal-content pfa-modal-content">
<div class="modal-header" style="padding: 5px 15px 5px 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Premium Finance Agreement</h4>
</div>
<div class="modal-body pfa-modal-body">
<div id="pdfContainer" data-pdf-viewer-url="/Scripts/pdf-viewer/viewer.html">
</div>
<form id="pfa-form" action="#" novalidate="novalidate">
<div>
<div class="row" style="padding-top: 5px; padding-bottom: 5px;">
<div class="col-sm-12">
<input type="checkbox" id="premiumFinanceAgreementConsent" name="premiumFinanceAgreementConsent" style="vertical-align: top;" data-bind="checked: modalPremiumFinanceAgreementConsent, value: modalPremiumFinanceAgreementConsent" required="" value="false">
<label for="premiumFinanceAgreementConsent" style="display: inline; font-weight: 100; vertical-align: -2px;">By checking this box, I assert that I have reviewed and agree to all the terms set forth in the premium finance agreement.</label>
</div>
<div class="col-sm-12">
<div class="col-lg-9 col-md-9 col-sm-9 left" style="padding-bottom: 1px;">
<span style="font-weight: bold;">Digitally sign the Premium Finance Agreement</span>
</div>
</div>
<div class="col-sm-12" style="line-height: 1;">
<div class="form-group">
<div class="col-lg-1 col-md-1 col-sm-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left" style="padding-bottom: 1px;">
<label for="premiumFinanceAgreementName">Name</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right" style="margin-bottom: 5px;">
<input type="text" class="form-control" name="premiumFinanceAgreementName" id="premiumFinanceAgreementName" data-bind="value: modalPremiumFinanceAgreementName" required="">
</div>
</div>
</div>
<div class="col-sm-12" style="line-height: 1;">
<div class="form-group">
<div class="col-lg-1 col-md-1 col-sm-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left" style="padding-bottom: 1px;">
<label for="premiumFinanceAgreementPhone">Phone Number</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right" style="margin-bottom: 5px;">
<input type="tel" class="form-control" name="premiumFinanceAgreementPhone" id="premiumFinanceAgreementPhone" inputmode="tel" placeholder="555-555-5555" data-bind="value: modalPremiumFinanceAgreementPhone" required="">
</div>
</div>
</div>
<div class="col-sm-12" style="line-height: 1;">
<div class="form-group">
<div class="col-lg-1 col-md-1 col-sm-1 col-lg-2 col-md-2 col-sm-2 col-xs-12 left" style="padding-bottom: 1px;">
<label for="premiumFinanceAgreementEmail">Email Address</label>
</div>
<div class="col-lg-9 col-md-9 col-sm-9 right" style="margin-bottom: 5px;">
<input type="email" class="form-control" name="premiumFinanceAgreementEmail" id="premiumFinanceAgreementEmail" inputmode="email" data-bind="value: modalPremiumFinanceAgreementEmail" required="">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer" style="padding: 5px 15px 5px 15px; display: inline-block">
<div style="float: left">
<button id="downloadPfa" type="button" class="btn btn-default" data-bind="click: onDownloadPfa">Download Agreement</button>
</div>
<div style="float: right">
<button type="button" class="btn btn-default" data-dismiss="modal" data-bind="click: invalidateAgreement">Cancel</button>
<button type="submit" class="btn btn-default" form="pfa-form">Agree</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="confirmationDialog" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="confirmationTitle"></h4>
</div>
<div class="modal-body">
<span id="confirmationBody">
</span>
</div>
<div class="modal-footer">
<button type="button" class="btn " data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" data-dismiss="modal" id="confirmationConfirm">Confirm</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalMessageDialog" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="modalMessageTitle"></h4>
</div>
<div class="modal-body">
<span id="modalMessageBody">
</span>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.2/additional-methods.min.js" integrity="sha384-OsPPRz583XrQr9YYGB4Npvku6Ktw3QqQPNbpV3t+2zf3dkWgX/TUFl3QHUr0HXxy" crossorigin="anonymous"></script>
<script type="text/javascript">
        var model = null;

        this.model = model;

        if (!String.prototype.includes) {
            String.prototype.includes = function () {
                'use strict';
                return String.prototype.indexOf.apply(this, arguments) !== -1;
            };
        }

        ko.bindingHandlers.numeric = {
            init: function (element, valueAccessor) {
                $(element).on("keydown", function (event) {
                    // Allow: backspace, delete, tab, escape, and enter
                    if (event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 ||
                        // Allow: Ctrl+A, Control+C, Control+V
                        (event.keyCode == 65 && event.ctrlKey === true) ||
                        (event.keyCode == 67 && event.ctrlKey === true) ||
                        //(event.keyCode == 86 && event.ctrlKey === true) ||
                        // Allow: . ,
                        (event.keyCode == 190 || event.keyCode == 110) ||
                        // Allow: home, end, left, right
                        (event.keyCode >= 35 && event.keyCode <= 39)) {
                        // let it happen, don't do anything
                        return;
                    }
                    else {
                        // Ensure that it is a number and stop the keypress
                        if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105)) {
                            event.preventDefault();
                        }
                    }
                });
            }
        };

        $(document).ready(function () {
            // Update the colSpan on the finance message
            // based on the media query
            var mq = window.matchMedia("(max-width: 570px)")
            setFinanceMessageColSpan(mq)
            mq.addListener(setFinanceMessageColSpan)

            function setFinanceMessageColSpan(mq) {
                if (mq.matches) {
                    $(".finance-message-td").each(function () {
                        $(this).attr('colSpan', '3')
                    })
                } else {
                    $(".finance-message-td").each(function () {
                        $(this).attr('colSpan', '4')
                    })
                }
            }

            function PaymentModel() {
                var self = this;
                this.payer = ko.observable(null);
                this.emailAddress = ko.observable(null);
                this.paymentMethod = ko.observable('Ach');
                this.amount = ko.observable().extend({ numeric: 2 });
                this.cardNumber = ko.observable("");
                this.payerFee = ko.observable(0.00);
                this.total = ko.observable('$0.00');
                this.payerCreditCardRate = ko.observable(3.50);
                this.payerCreditCardFee = ko.observable(0).extend({ numeric: 2 });
                this.payerAchFee = ko.observable(0).extend({ numeric: 2 });
                this.duplicateTransactionReceiptUrl = ko.observable('');
                duplicateWarningActive = ko.computed(function () {
                    if (self.duplicateTransactionReceiptUrl() == "")
                        return false;
                    else {
                        return true;
                    }
                });
                
                this.achRate = ko.observable(0.00).extend({ numeric: 2 });
                this.minimumAchFee = ko.observable(4.00).extend({ numeric: 2 });
                this.maximumAchFee = ko.observable(4.00).extend({ numeric: 2 });
                this.flatAchPayerFeeModifier = ko.observable(0.00).extend({ numeric: 2 });
                
                this.percentageAchPayerFeeModifier = ko.observable(0.00).extend({ numeric: 2 });
                this.attachments = ko.observableArray(null);
                this.fileModels = ko.observable('');
                this.sessionId = ko.observable('');
                this.hideCreditCardOption = ko.observable(false);
                this.invoiceSearchFailed = ko.observable(false);
                this.creditCardTotal = ko.observable(0.00).extend({ numeric: 2 });
                this.achTotal = ko.observable(0.00).extend({ numeric: 2 });
                this.enableScheduledPayments = ko.observable(false);
                this.scheduledPaymentsEndOption = ko.observable('Never');
                this.numberOfPayments = ko.observable();
                this.startDate = ko.observable('');
                this.endDate = ko.observable('');
                this.intervalCount = ko.observable(1);
                this.intervalId = ko.observable(0);
                this.tokenPublicId = ko.observable('');
                this.submitTokenPublicId = ko.computed(function () {
                    var tokenPublicId = self.tokenPublicId();
                    if (tokenPublicId == 'newCreditCard' || tokenPublicId == 'newAch') {
                        return "";
                    }
                    return tokenPublicId;
                });
                this.currentCreditCardToken = ko.observable('');
                this.creditCardTokenCount = ko.observable(0)
                this.currentAchToken = ko.observable('');
                this.achTokenCount = ko.observable(0)
                this.intervalDescription = ko.computed(function() {
                    return $("#IntervalId option[value=" + self.intervalId() + "]").text();
                });
                this.TransactionAttribute4209 = ko.observable(null).extend({ throttle: 750 });
                this.invoicesPayerName = ko.observable();
                this.status = ko.observable(-1);
                this.fullInvoiceList = ko.observableArray();
                this.invoiceSearchText = ko.observable();
                this.invoices = ko.computed(function () {
                    if (!self.invoiceSearchText()) {
                        return self.fullInvoiceList();
                    } else {
                        let searchText = self.invoiceSearchText().toLowerCase();
                        return ko.utils.arrayFilter(self.fullInvoiceList(), function (invoice) {
                            let matchFound = invoice.Id.toLowerCase().indexOf(searchText) > -1
                                || (invoice.Name && invoice.Name.toLowerCase().indexOf(searchText) > -1)
                                || (invoice.Amount && invoice.Amount.toString().indexOf(searchText) > -1)
                                || (invoice.Amount && formatAmount(invoice.Amount, 'USD').toLowerCase().indexOf(searchText) > -1)
                                || invoice.PaidAmount() != 0;

                            if (matchFound) return true;

                            for (var i = 0; i < invoice.AttributeValues.length; i++) {
                                matchFound = invoice.AttributeValues[i].Value.toLowerCase().indexOf(searchText) > -1;
                                if (matchFound) return true;
                            }

                            return false;
                        }).sort(function (l, r) { return l.PaidAmount() > 0 ? 1 : -1 });
                    }
                });
                this.invoiceAttributeMetadata = ko.observableArray();
                this.invoiceItemAttributeMetadata = ko.observableArray();
                this.paidInvoiceAmounts = { };
                this.paidInvoiceComments = {};
                this.paidInvoiceCommentReasons = {};
                this.financedInvoices = {};
                this.initialInvoices = ko.observable(true);
                this.invoiceSearches = ko.observable(0);
                this.autoPaySubscriptionId = ko.observable(null);
                this.anyFinancingEligible = ko.observable(false);
                this.allowFinanceAutoPay = ko.observable(true);
                this.premiumFinanceAgreementCompanyName = ko.observable('');
                this.premiumFinanceCompanyLogoUri = ko.observable('');
                this.premiumFinanceAgreementQuoteNumber = ko.observable('');
                this.premiumFinanceAgreementConsent = ko.observable(false);
                this.premiumFinanceAgreementName = ko.observable('');
                this.premiumFinanceAgreementPhone = ko.observable('');
                this.premiumFinanceAgreementEmail = ko.observable('');
                this.modalPremiumFinanceAgreementConsent = ko.observable(false);
                this.modalPremiumFinanceAgreementName = ko.observable('');
                this.modalPremiumFinanceAgreementPhone = ko.observable('');
                this.modalPremiumFinanceAgreementEmail = ko.observable('');
                this.premiumFinanceAgreementPdfData = ko.observable('');
                this.premiumFinanceAgreementAutoPay = ko.observable(false);
                this.premiumFinanceAgreementLoading = ko.observable(false);
                this.agreementButtonCheckDisplay = ko.observable(false);
                this.premiumFinanceAgreementErrored = ko.observable(false);
                this.showAgreementFinancialBreakdown = ko.observable(false);
                this.totalDownPaymentAmount = ko.observable(0.00);
                this.installmentAmount = ko.observable(0.00);
                this.financeNumberOfPayments = ko.observable(0);
                this.financePaymentFrequency = ko.observable('');
                this.nextInstallmentDueDate = ko.observable('');
                this.autoPayAchFee = ko.observable(0.00);
                this.autoPayCreditCardFee = ko.observable(0.00);
                this.submitAttempted = ko.observable(false);
                this.enableAutopay = ko.observable(true);
                this.autoPayCancelable = ko.observable(false);
                this.confirmDisclaimer = ko.observable(true);
                this.autoPayDisclaimerText = ko.observable('');
                this.autoPayTermsAndConditions = ko.observable('');
                this.showAutoPayTermsAndConditionsLink = (this.autoPayTermsAndConditions);
                this.financeConnectDisclaimerAccepted = ko.observable(false);
                this.invoiceSearchResponseStatusCode = ko.observable(0);
                this.financingAccountId = ko.observable(null);
                this.hasAccount = ko.pureComputed(function () {
                    return self.status() == 0;
                });
                this.isFilteringAllInvoices = ko.computed(function () {
                    return self.invoiceSearches() == 0
                        && self.fullInvoiceList().length > 0
                        && (self.invoiceSearchText() && self.invoiceSearchText().length > 0)
                        && self.invoices().length == 0
                        && !AreAnyAttributeValuesEmptyOrInvalid();
                });
                this.cardType = ko.pureComputed(function () {
                    var cardType = getCreditCardType(self.cardNumber());
                    return self.cardNumber().length >= 13 && cardType == undefined ? 'ERROR' : cardType;
                });
                this.pfaBtnStatus = ko.pureComputed(function() {
                    const baseClasses = "btn btn-primary pfa-btn";
                    if(self.premiumFinanceAgreementErrored())
                        return `${baseClasses} btn-danger`;
                    if(self.isAgreementValid())
                        return `${baseClasses} pfa-btn-consented`;

                    return `${baseClasses} pfa-btn-not-consented`;
                });



                this.amount.subscribe(function (value) {
                    UpdatePayerFee();
                });

                this.paymentMethod.subscribe(function (value) {
                    UpdatePayerFee();
                    SetRequiredPaymentFields(model);
                    $("#Amount").valid();
                });

                this.attachments().forEach(function (attachment) {
                    attachment.IsDeleting = ko.observable(false);
                    attachment.CanBeDeleted = ko.observable(true);
                    attachment.Progress = ko.observable(100);
                });

                this.remove = function (attachment) {
                    attachment.IsDeleting(true);
                    attachment.CanBeDeleted(false);

                    $.post("/Attachments/Remove" + "?id=" + attachment.Id, function (data) {
                        model.attachments.remove(attachment);
                    });
                };

                this.fileModels(ko.toJSON(this.attachments));

                this.attachments.subscribe(function () {
                    model.fileModels(ko.toJSON(model.attachments));
                })

				this.addAllClicked = ko.computed(function () {
					var result = false;
					for (var i = 0; i < self.invoices().length; i++) {
                        if (parseInt(self.invoices()[i].PaidAmount()) != 0 ||
                            parseInt(self.invoices()[i].FinanceDownPayment()) != 0) {
                            result = true;
                        }
                    }
                    return result;
                });

                this.addAllText = ko.computed(function () {
                    if (self.addAllClicked())
                        return "- Clear All";
                    else if (self.anyFinancingEligible())
                        return "+ Pay All";
                    else
                        return "+ Add All";
                });

                this.addAll = function () {
                    if (self.addAllClicked()) {
                        for (var i = 0; i < model.invoices().length; i++) {
                            model.invoices()[i].PaidAmount(0);
                            model.invoices()[i].FinanceDownPayment(0);
                            model.invoices()[i].isInvoiceFinanced(false);
                        }

                        if (model.isAgreementValid()) {
                            model.invalidateAgreement();
                        }
                    }
                    else {
                        for (var i = 0; i < model.invoices().length; i++) {
                            if (model.invoices()[i].Amount != null) {
                                model.invoices()[i].PaidAmount(model.invoices()[i].Amount);
                            }
                        }
                    }
                }

                this.refreshPaidAmount = function (invoice) {
                    invoice.PaidAmount(invoice.Amount != null ? invoice.Amount : 1);

                    $("[name='" + invoice.FieldId + "-paidAmount']").focus();
                }

                this.refreshFinanceDownPayment = function (invoice) {
                    if (invoice.DownPaymentAmount() != null) {
                        invoice.FinanceDownPayment(invoice.DownPaymentAmount());
                        invoice.isInvoiceFinanced(true);
                        model.invalidateAgreement();
                        model.premiumFinanceAgreementErrored(false);
                    }
                }

                this.toggleInvoiceDetailVisibility = function(invoice) {
                    invoice.ShowDetails(!invoice.ShowDetails());
                }

                this.clickInvoice = function(invoice) {
                    if (!invoice.AllowPartialPayment) {
                        invoice.PaidAmount(0);
                    }
                }

                this.clickRemoveInvoice = function (invoice) {
                        invoice.PaidAmount(0);
                }

                this.clickRemoveFinanced = function (invoice) {
                    invoice.FinanceDownPayment(0);
                    invoice.isInvoiceFinanced(false);
                    model.invalidateAgreement();
                    model.premiumFinanceAgreementErrored(false);
                }

                this.financeButtonEnableOrDisable = ko.computed(function () {
                    var alreadySelectedFinanceEligibilityHash = '';
                    if (self.invoices().length > 0)
                    {
                        var selectedFinancedInvoices = self.invoices().filter(x => x.FinanceDownPayment() > 0 && x.isInvoiceFinanced());
                        if (selectedFinancedInvoices.length > 0)
                        {
                            alreadySelectedFinanceEligibilityHash = selectedFinancedInvoices[0].FinanceEligibilityHash();
                        }
                    }

                    for (var i = 0; i < self.invoices().length; i++) {
                        var text = '';
                        var disableFinanceButton = false;
                        var invoice = self.invoices()[i];
                        if (invoice.IsFinancingEligible && alreadySelectedFinanceEligibilityHash != '' && invoice.FinanceEligibilityHash() != '' && alreadySelectedFinanceEligibilityHash != invoice.FinanceEligibilityHash()) {
                            invoice.isEnableFinanceButton(false);
                            disableFinanceButton = true;
                        }
                        else if (invoice.PaidAmount() != 0) {
                            invoice.isEnableFinanceButton(false);
                        }
                        else {
                            invoice.isEnableFinanceButton(true);
                        }
                        
                        if (!invoice.isEnableFinanceButton() && !invoice.isInvoiceFinanced() && invoice.IsFinancingEligible && disableFinanceButton) {
                            text = "Not eligible to finance with selected invoice. Please create another payment to finance this invoice.";
                        }
                        else if (!self.isAgreementValid() || !invoice.isInvoiceFinanced()) {
                            text = "Finance for an estimated " + formatAmount(invoice.DownPaymentAmount(), 'USD') + " down";
                            if ((!invoice.premiumFinanceAgreementConsentedAtleastOnce() || !invoice.isInvoiceFinanced()) && !invoice.premiumFinanceAgreementConsentedAtleastOnce()) {
                                text += " and " + invoice.NumberOfInstallments + " payments of " + formatAmount(invoice.InstallmentAmount, 'USD') +"/mo.";
                            }
                        }
                        else if (self.isAgreementValid() && invoice.isInvoiceFinanced() && invoice.premiumFinanceAgreementConsentedAtleastOnce()) {
                            text = "Finalize for " + formatAmount(invoice.FinanceDownPayment(), 'USD') +" down today";
                        }
                        invoice.financeQuoteText(text);
                    }
                });

                this.setPaymentType = function (paymentType) {
                    if (paymentType === 'CreditCard') {
                        this.changeToCreditCard();
                    }
                    else if (paymentType === 'Ach') {
                        this.changeToAch();
                    }

                    return true;
                }

                this.changeToCreditCard = function () {
                    if (model.paymentMethod() != 'CreditCard') {
                        model.tokenPublicId(model.currentCreditCardToken());
                    }
                    return true;
                }

                this.changeToAch = function () {
                    if (model.paymentMethod() != 'Ach') {
                        model.tokenPublicId(model.currentAchToken());
                    }
                    return true;
                }

                this.openAutopayModal = function () {
                    showModalMessage("AutoPay Information", "The AutoPay feature will automatically pay invoices on their due date using the payment information you enter below. <br /><br />You will receive an email notification 2 days before the automatic payment so you can review and cancel the payment as needed.");
                }

                this.showAgreement = function () {
                    model.modalPremiumFinanceAgreementConsent(model.premiumFinanceAgreementConsent());
                    model.modalPremiumFinanceAgreementName(model.premiumFinanceAgreementName());
                    model.modalPremiumFinanceAgreementPhone(model.premiumFinanceAgreementPhone());
                    model.modalPremiumFinanceAgreementEmail(model.premiumFinanceAgreementEmail());

                    $("label[for='premiumFinanceAgreementConsent']").removeClass("checkbox-label-validation-error");
                    $("#premiumFinanceAgreementName").removeClass("validation-error");
                    $("#premiumFinanceAgreementPhone").removeClass("validation-error");
                    $("#premiumFinanceAgreementEmail").removeClass("validation-error");

                    if(model.premiumFinanceAgreementConsent()) {
                        // Don't request a new PFA if user has already consented to existing PFA
                        $('#pfaModalDialog').modal('show');
                        return;
                    }

                    model.premiumFinanceAgreementLoading(true);

                    var attributeValues = [
                        { Key: "payer", Value: model.payer() },
                        { Key: "emailAddress", Value: model.emailAddress() },
                    ];

                    attributeValues.push({ Key: "invoiceNumber", Value: model.TransactionAttribute4209() });

                    var invoicesAgreementSearchModel = {
                        invoiceAttributes: attributeValues,
                        financingAccountId: model.financingAccountId()
                    }

                    invoicesAgreementSearchModel.invoiceAgreementSearchModels =
                        model.invoices()
                            .filter(x => x.FinanceDownPayment() > 0)
                            .map(invoice => {
                                return { Id: invoice.Id, DownPaymentAmount: invoice.FinanceDownPayment(), FinanceEligibilityHash: invoice.FinanceEligibilityHash() };
                        });

                    $.post('/Finance/RequestPremiumFinanceAgreement', invoicesAgreementSearchModel, function (data) {
                        var selectedFinanceInvoice = model.invoices().filter(x => x.FinanceDownPayment() > 0 && x.isInvoiceFinanced());
                        var hasInvoiceSelectionChanged = selectedFinanceInvoice.length == data.premiumFinanceAgreement.FinancedInvoices.length;
                        if (hasInvoiceSelectionChanged) {
                            for (var i = 0; i < selectedFinanceInvoice.length; i++) {
                                var filteredInvoice = data.premiumFinanceAgreement.FinancedInvoices.find(inv => inv.Id == selectedFinanceInvoice[i].Id);
                                if (!filteredInvoice) {
                                    hasInvoiceSelectionChanged = false;
                                    break;
                                }
                            }
                        }

                        if (hasInvoiceSelectionChanged) {
                            model.premiumFinanceAgreementCompanyName(data.premiumFinanceAgreement.PremiumFinanceCompanyName);
                            model.premiumFinanceCompanyLogoUri(data.premiumFinanceAgreement.PremiumFinanceCompanyLogoUri);
                            model.premiumFinanceAgreementQuoteNumber(data.premiumFinanceAgreement.QuoteNumber);
                            model.premiumFinanceAgreementPdfData(data.base64EncodedPdf);
                            model.totalDownPaymentAmount(data.premiumFinanceAgreement.FinanceDetails.DownPaymentAmount);
                            model.installmentAmount(data.premiumFinanceAgreement.FinanceDetails.InstallmentAmount);
                            model.financeNumberOfPayments(data.premiumFinanceAgreement.FinanceDetails.NumberOfPayments);
                            model.financePaymentFrequency(data.premiumFinanceAgreement.FinanceDetails.PaymentFrequency);
                            model.nextInstallmentDueDate(data.premiumFinanceAgreement.FinanceDetails.NextInstallmentDueDateString);
                            model.autoPayAchFee(data.premiumFinanceAgreement.FinanceDetails.AutoPayAchFee);
                            model.autoPayCreditCardFee(data.premiumFinanceAgreement.FinanceDetails.AutoPayCreditCardFee);
                            model.allowFinanceAutoPay(data.premiumFinanceAgreement.AllowFinanceAutoPay);
                            model.premiumFinanceAgreementAutoPay(data.premiumFinanceAgreement.AllowFinanceAutoPay);
                            model.premiumFinanceAgreementErrored(false);
                            model.autoPayDisclaimerText(data.premiumFinanceAgreement.AutoPayDisclaimer);
                            model.autoPayTermsAndConditions(data.premiumFinanceAgreement.AutoPayTermsAndConditions);
                            model.financedInvoices = data.premiumFinanceAgreement.FinancedInvoices;

                            window.embedPDF(data.base64EncodedPdf, document.querySelector('#pdfContainer'));
                            $('#pfaModalDialog').modal('show');
                        }
                    })
                    .fail(function (response) {
                        model.premiumFinanceAgreementErrored(true);
                        model.invalidateAgreement();
                    })
                    .always(function (response) {
                        model.premiumFinanceAgreementLoading(false);
                    });
                }

                this.isAgreementValid = function() {
                    return model.premiumFinanceAgreementConsent() &&
                    model.premiumFinanceAgreementName() != '' &&
                    model.premiumFinanceAgreementPhone() != '' &&
                    model.premiumFinanceAgreementEmail() != '';
                };

                this.invalidateAgreement = function () {
                    model.premiumFinanceAgreementConsent(false);
                    model.modalPremiumFinanceAgreementConsent(false);
                    model.submitAttempted(false);
                    model.agreementButtonCheckDisplay(false);
                    model.showAgreementFinancialBreakdown(false);
                }

                this.showInvalidAgreementMessage = function() {
                    return !model.isAgreementValid() && model.submitAttempted();
                }

                this.showTermsAndConditionsModal = function () {
                    $('#termsAndConditionsModalDialog').modal('show');
                    return;
                }


                this.submitForm = function() {
                    model.submitAttempted(true);

                    if (!model.confirmDisclaimer()) {
                        showModalMessage('Confirmation', 'Please confirm that you accept the terms by checking the box below.');

                        return false;
                    }

                    if (model.isAgreementValid() && !model.financeConnectDisclaimerAccepted()) {
                        showModalMessage('Confirmation', 'Please accept the finance connect disclaimer.');
                        return false;
                    }

                    if (model.invoices().some(i => i.FinanceDownPayment() > 0) && !model.isAgreementValid()) {
                        $('#show-pfa').focus();
                        return false;
                    }

                    return true;
                }

                this.currentSort = ko.observable("None");

                this.sortInvoices = function(type) {
                    var multiplier = 0;

                    if (model.currentSort() == type) {
                        multiplier = -1;
                        model.currentSort("Descending" + type);
                    }
                    else {
                        multiplier = 1;
                        model.currentSort(type);
                    }
                    model.fullInvoiceList(model.fullInvoiceList().sort(function (left, right) {
                        // Not Yet Invoiced goes to the bottom.
                        if (left.Amount == null)
                            return 1;
                        if (right.Amount == null)
                            return -1;

                        if (type == "Id") {
                            return left.Id.localeCompare(right.Id) * multiplier
                        }
                        else if (type == "Name") {
                            return left.Name.localeCompare(right.Name) * multiplier
                        }
                        else if (type == "DueDate") {
                            if (left.DueDateString == null && right.DueDateString == null)
                                return 0;
                            if (left.DueDateString == null)
                                return -1 * multiplier;
                            if (right.DueDateString == null)
                                return 1 * multiplier;

                            var leftDate = new Date(left.DueDateString);
                            var rightDate = new Date(right.DueDateString);

                            return multiplier * (leftDate - rightDate);
                        }
                        else if (type == "Amount") {
                            return multiplier * (left.Amount - right.Amount);
                        }
                    }));
                }
                 this.shouldAutopayEnable = ko.computed(function () {
                    if (self.invoices().every(i => i.FinanceDownPayment() <= 0) && self.enableAutopay() == true) {
                        return true;
                    }
                    return false;
                }, this);
            }

            $("#RoutingNumber").popover({
                html: true,
                placement: 'bottom',
                content: function () {
                    return $('#bankRoutingNumberPopup').html();
                },
                title: function () {
                    return 'Routing Number';
                }
            });

            $("#RoutingNumber").keypress(function () {
                $('#RoutingNumber').popover('hide');
            });

            $("#AccountNumber").popover({
                html: true,
                placement: 'bottom',
                content: function () {
                    return $('#bankAccountNumberPopup').html();
                },
                title: function () {
                    return 'Account Number';
                }
            });

            $("#AccountNumber").keypress(function () {
                $('#AccountNumber').popover('hide');
            });

            jQuery.validator.addMethod('disallowGreaterLessThan', function (value, element) {
                if (String(value).includes('>') || String(value).includes('<')) {
                    setErrorMessage('< and > characters are not allowed in this field');
                    element.title = '< and > characters are not allowed in this field';
                    return false;
                }
                else {
                    setErrorMessage(null);
                    element.title = '';
                    return true;
                }
            }, '< and > characters are not allowed in this field');

            function phoneMask() {
                var num = $(this).val().replace(/\D/g,'');
                if(num.length >= 6 && num.length <= 10) {
                    $(this).val(num.substring(0,3) + '-' + num.substring(3,6) + '-' + num.substring(6,10));
                }
                else if(num.length >= 3 && num.length <=6) {
                    $(this).val(num.substring(0,3) + '-' + num.substring(3,6));
                }
            }

            $('[type="tel"]').on("blur", phoneMask);

            $("#payment-form").validate({
                rules: {
                    Amount: {
                        required: true,
                        number: true
                    },
                    RoutingNumber: {
                        number: true
                    },
                    AccountNumber: {
                        number: true
                    },
                    ConfirmAccountNumber: {
                        number: true
                    },
                    Frequency: {
                        number: true,
                        range: [0, 100]
                    },
                    IntervalCount: {
                        number: true,
                        range: [0, 1000]
                    },
                    NumberOfPayments: {
                        number: true,
                        range: [0, 1000]
                    },
                    ConfirmAccountNumber: {
                        equalTo: "#AccountNumber"
                    },
                    StartDate: {
                        date: true
                    },
                    EndDate: {
                        date: true
                    }
                },
                submitHandler: function (form) {
                    if (!model.sessionId()) {
                        if (grecaptcha.getResponse()) {
                            $('#Submit').attr('disabled', true);
                            form.submit();
                        } else {
                            showModalMessage('Please Confirm the reCaptcha', 'Please confirm the reCaptcha at the bottom of the page.');
                        }
                    }
                    else {
                        $('#Submit').attr('disabled', true);
                        form.submit();
                    }
                },
                errorPlacement: function(error, element) { },
                errorClass: "validation-error",
            });

            $("#pfa-form").validate({
                rules: {
                    premiumFinanceAgreementPhone: {
                        required: true,
                        phoneUS: true
                    }
                },
                submitHandler: function (form) {
                    if (model.modalPremiumFinanceAgreementConsent() &&
                        model.modalPremiumFinanceAgreementName() != '' &&
                        model.modalPremiumFinanceAgreementPhone() != '' &&
                        model.modalPremiumFinanceAgreementEmail() != '') {

                        model.agreementButtonCheckDisplay(true);
                        model.showAgreementFinancialBreakdown(true);

                        model.premiumFinanceAgreementConsent(model.modalPremiumFinanceAgreementConsent());
                        model.premiumFinanceAgreementName(model.modalPremiumFinanceAgreementName());
                        model.premiumFinanceAgreementPhone(model.modalPremiumFinanceAgreementPhone());
                        model.premiumFinanceAgreementEmail(model.modalPremiumFinanceAgreementEmail());

                        model.financedInvoices.forEach((filteredInvoice) => {
                            var invoice = model.invoices().find(inv => inv.Id == filteredInvoice.Id);
                            invoice.DownPaymentAmount(filteredInvoice.DownPaymentAmount);
                            invoice.FinanceDownPayment(invoice.DownPaymentAmount());
                            invoice.Verification(filteredInvoice.Verification);
                            invoice.DataToken(filteredInvoice.DataToken);
                            invoice.premiumFinanceAgreementConsentedAtleastOnce(true);
                        });
                    }
                    else {
                        model.invalidateAgreement();
                    }

                    $("#pfaModalDialog").modal('hide');
                },
                errorPlacement: function(error, element) { },
                highlight: function (element, errorClass) {
                    if ($(element).is(':checkbox')) {
                        $("label[for=" + element.id + "]").addClass("checkbox-label-validation-error");
                    }
                    else {
                        $(element).addClass(errorClass);
                    }
                },
                unhighlight: function (element, errorClass) {
                    if ($(element).is(':checkbox')) {
                        $("label[for=" + element.id + "]").removeClass("checkbox-label-validation-error");
                    }
                    else {
                        $(element).removeClass(errorClass);
                    }
                },
                errorClass: "validation-error"
            });

            $('input[type=text], textarea').each(function () {
                $(this).rules('add', {
                    disallowGreaterLessThan: true
                });
            });

            $("#StartDate").datepicker();
            $("#EndDate").datepicker();

            $('#ConfirmAccountNumber').bind("cut copy paste", function (e) {
                e.preventDefault();
            });

            $("#ConfirmAccountNumber").popover({
                html: true,
                placement: 'bottom',
                content: function () {
                    return $('#bankAccountNumberPopup').html();
                },
                title: function () {
                    return 'Account Number';
                }
            });

            $("#ConfirmAccountNumber").keypress(function () {
                $('#ConfirmAccountNumber').popover('hide');
            });


            $('#files').fileupload({
                dataType: 'json',
                progress: function (e, data) {
                    var progress = parseInt(data.loaded / data.total * 100, 10);
                    var result = $.grep(model.attachments(), function(x){ return x.temporaryId === data.files[0].temporaryId; });

                    if (result.length > 0) {
                        result[0].Progress(progress);
                    }
                },
                maxChunkSize: 4000000,
                maxFileSize: 10000000,
                done: function (e, data) {
                    var result = $.grep(model.attachments(), function(x){ return x.temporaryId === data.files[0].temporaryId; });

                    if (result.length > 0) {
                        result[0].Id = data.result[0].Id;
                        result[0].IsDeleting(false);
                        result[0].CanBeDeleted(true);
                        result[0].Progress(100);

                        model.fileModels(ko.toJSON(model.attachments));
                    }
                }
            }).on('fileuploadadd', function (e, data) {
                $.each(data.files, function (index, file) {
                    file.temporaryId = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10);
                    file.Name = file.name;
                    file.IsDeleting = ko.observable(false);
                    file.CanBeDeleted = ko.observable(false);
                    file.Progress = ko.observable(0);

                    model.attachments.push(file);
                });
            });


            model = new PaymentModel();

            ko.applyBindings(model);

            UpdatePayerFee();
            SetRequiredPaymentFields(model);

        });

        function hideDuplicateWarning() {
            $('#warning-area').hide();
            $('#warning-message').hide();
        }

        function UpdateTotalAmount() {
            var total = 0;

            model.fullInvoiceList().forEach(function (invoice) {
                total += parseFloat(invoice.PaidAmount());
                total += parseFloat(invoice.FinanceDownPayment());
            });

            model.amount(total);
        }

        function UpdatePayerFee() {

            var attributeValues = new Object();

                
                attributeValues["invoiceNumber"] = model.TransactionAttribute4209
                

            attributeValues.amount = model.amount;

            if (false) {
                $.get('/Payments/PayerFee', attributeValues, function (data) {
                    model.payerAchFee(data.AchPayerFee);
                    model.achTotal(data.AchPayerFee + parseFloat(attributeValues.amount()));
                    model.payerCreditCardFee(data.CreditCardPayerFee);
                    model.creditCardTotal(data.CreditCardPayerFee + parseFloat(model.amount()));

                    if (model.paymentMethod() == 'Ach') {
                        model.payerFee(model.payerAchFee());
                        model.total(model.achTotal());
                    } else if (model.paymentMethod() == 'CreditCard') {
                        model.payerFee(model.payerCreditCardFee());
                        model.total(model.creditCardTotal());
                    }
                });
            }
            else {
                var achFee = numeral(model.amount()).value() * numeral(model.achRate()).value() / 100;
                achFee = Math.max(model.minimumAchFee(), achFee);
                achFee = Math.min(model.maximumAchFee(), achFee);
                var achPayerFee = achFee;
                if (model.percentageAchPayerFeeModifier() != 0) {
                    achPayerFee = achPayerFee * (1 + numeral(model.percentageAchPayerFeeModifier()).value() / 100);
                }
                else {
                    achPayerFee += numeral(model.flatAchPayerFeeModifier()).value();
                }
                if (achPayerFee < 0) {
                    achPayerFee = 0;
                }
                model.payerAchFee(achPayerFee);
                model.achTotal(numeral(model.payerAchFee()).value() + numeral(model.amount()).value());
                   
                       model.payerCreditCardFee(numeral(model.amount()).value() * numeral(model.payerCreditCardRate()).value() / 100);
                   
                   model.creditCardTotal(numeral(model.amount()).value() + numeral(model.payerCreditCardFee()).value());

                   if (model.paymentMethod() == 'Ach') {
                       model.payerFee(model.payerAchFee());
                       model.total(model.achTotal());
                   } else if (model.paymentMethod() == 'CreditCard') {
                       model.payerFee(model.payerCreditCardFee());
                       model.total(model.creditCardTotal());
                   }
               }
        }

        function ShowSignInPopup() {
            showModalMessage('Please Sign In', 'Please <a href="/SignIn">sign in</a> or <a href="/SignUp">sign up</a> for a free account to use this feature.');
        }

        function ShowDeletePaymentMethod(tokenPublicId, accountNumber, transactionType) {
            confirmAction("Confirmation", "This will delete the record of your " + transactionType + " with account number " + accountNumber + ".", function () { DeletePaymentMethod(tokenPublicId) });
        }

        function DeletePaymentMethod(tokenPublicId) {
            // Hide the deleted payment before sending the web request so we can decrement the count on the correct payment method type.
            $("." + tokenPublicId).css("display", "none");
            if (model.paymentMethod() == 'Ach') {
                model.tokenPublicId('newAch');
                model.currentAchToken('newAch');
                model.achTokenCount(model.achTokenCount() - 1);
            }
            else {
                model.tokenPublicId('newCreditCard');
                model.currentCreditCardToken('newCreditCard');
                model.creditCardTokenCount(model.creditCardTokenCount() - 1);
            }
            $.post("/Payments/DeletePaymentMethod", { tokenId: tokenPublicId })
            .done(function (result) {
                if (!result.Success) {
                    $("." + tokenPublicId).css("display", "block");
                    showModalMessage("Error", "The selected payment token could not be deleted. It is currently in use by an unprocessed payment.")
                }
            })
        }

        function CancelAutoPaySubscription() {
            confirmAction("Cancel AutoPay Subscription", "Are you sure you would like to cancel your AutoPay subscription?", function () {
                if (model.autoPaySubscriptionId() != null) {
                var previousAutoPaySubscriptionId = model.autoPaySubscriptionId();
                $.post("/Invoices/CancelAutoPaySubscription", { id: model.autoPaySubscriptionId() }, function (result) {
                    if (result != true) {
                        model.autoPaySubscriptionId(previousAutoPaySubscriptionId);
                        setErrorMessage("Failed to cancel AutoPay subscription.")
                    }
                });
                model.autoPaySubscriptionId(null);
            }
            });
        }

        function AreAnyAttributeValuesEmptyOrInvalid() {
            
            var field = model.TransactionAttribute4209();

            if (true && (field == null || field == ''))
                return true;
            

            return false;
        }

        function RefreshInvoices(onLoad) {
            if (AreAnyAttributeValuesEmptyOrInvalid()) {
                model.fullInvoiceList([]);
                return;
            }

            model.invoiceSearches(model.invoiceSearches() + 1);
            model.invoiceSearchText('');
            var attributeValues = new Object();

                
                attributeValues["invoiceNumber"] = model.TransactionAttribute4209();
                

            attributeValues["payer"] = model.payer();
            attributeValues["emailAddress"] = model.emailAddress();

            $.post('/Invoices', attributeValues, function (data) {
                data.Invoices.forEach(function (invoice) {
                    invoice.PaidAmount = ko.observable(model.paidInvoiceAmounts[invoice.Id] ? model.paidInvoiceAmounts[invoice.Id] : 0).extend({ numeric: 2 });
                    invoice.FinanceDownPayment = ko.observable(0).extend({ numeric: 2 });
                    invoice.CommentReason = ko.observable(model.paidInvoiceCommentReasons[invoice.Id] || 'Other');
                    invoice.CommentPlaceholder = ko.pureComputed(function () {
                        switch (invoice.CommentReason()) {
                            case 'Financing':
                                return 'Please provide the name of the finance company.';
                            case 'Incorrect Invoice Amount':
                                return 'Please provide more detail.';
                            case 'Other':
                                return 'Please provide comments.';
                            default:
                                return 'Comments (required)';
                        }
                    });
                    invoice.Comment = ko.observable(model.paidInvoiceComments[invoice.Id]);
                    invoice.ShowDetails = ko.observable(false);
                    invoice.isInvoiceFinanced = ko.observable(false);
                    invoice.isEnableFinanceButton = ko.observable(true);
                    invoice.financeQuoteText = ko.observable('');
                    invoice.premiumFinanceAgreementConsentedAtleastOnce = ko.observable(false);
                    invoice.FinanceEligibilityHash = ko.observable(invoice.FinanceEligibilityHash);
                    invoice.DownPaymentAmount = ko.observable(invoice.DownPaymentAmount);
                    invoice.Verification = ko.observable(invoice.Verification);
                    invoice.DataToken = ko.observable(invoice.DataToken);

                    invoice.PaidAmount.subscribe(function (value) {
                        UpdateTotalAmount();
                    });

                    invoice.FinanceDownPayment.subscribe(function (value) {
                        UpdateTotalAmount();
                    });
                });

                model.invoicesPayerName(data.PayerName);
                model.status(data.Status);
                model.fullInvoiceList(data.Invoices);
                model.invoiceAttributeMetadata(data.InvoiceAttributeMetadata);
                model.invoiceItemAttributeMetadata(data.InvoiceItemAttributeMetadata);
                model.autoPaySubscriptionId(data.AutoPaySubscriptionId);
                model.invoiceSearchFailed(data.Status === 2);
                model.enableAutopay(data.EnableAutopay);
                model.autoPayCancelable(data.AutoPayCancelable)
                model.anyFinancingEligible(data.AnyFinancingEligible);
                model.financingAccountId(data.FinancingAccountId);

                var parameters = {};
                if (location.search)
                    location.search.substr(1).split("&").forEach(function (item) {
                        var s = item.split("="), k = s[0], v = s[1] && decodeURIComponent(s[1]); (parameters[k] = parameters[k] || []).push(v)
                    })
                var prepopulateInvoices = ((typeof parameters.invoiceId != 'undefined') || (typeof parameters.notInvoiced != 'undefined')) && model.initialInvoices();

                model.invoices().forEach(function (invoice) {
                    var $paidAmountInput = $("[name='" + invoice.FieldId + "-paidAmount']");
                    if (invoice.Amount == null)
                        $paidAmountInput.rules("add", { range: [0, 10000000] });
                    else if (invoice.Amount > 0)
                        $paidAmountInput.rules("add", { range: [0, invoice.MaximumAmount] });
                    else
                        $paidAmountInput.rules("add", { range: [invoice.Amount, 0] });

                    if (prepopulateInvoices) {
                        if ((typeof parameters.invoiceId != 'undefined') && parameters.invoiceId.indexOf(invoice.Id) != -1) {
                            invoice.PaidAmount(invoice.Amount != null ? invoice.Amount : 1)
                        }
                        else if (invoice.Amount == null) {
                            invoice.PaidAmount(parseFloat(parameters.notInvoiced));
                        }
                    }
                });

                model.initialInvoices(false);
                UpdateTotalAmount();

                model.invoiceSearches(model.invoiceSearches() - 1);
                if (!onLoad) {
                    model.invalidateAgreement();
                }
                model.premiumFinanceAgreementErrored(false);
            }).fail(function () {
                model.fullInvoiceList([]);
                model.invoiceSearches(model.invoiceSearches() - 1);
                model.invoiceSearchFailed(true);
            }).always(function (response) {
                model.invoiceSearchResponseStatusCode(response.status);
            });
        }

        function validateCustomAttribute(event) {
            if (!event.srcElement.reportValidity()) {
                $(event.srcElement).removeClass('valid');
                $(event.srcElement).addClass('validation-error');
                $(event.srcElement).siblings('.transaction-attribute-regex-error-msg').show();
            }
            else {
                $(event.srcElement).addClass('valid');
                $(event.srcElement).removeClass('validation-error');
                $(event.srcElement).siblings('.transaction-attribute-regex-error-msg').hide();
            }
        }

        function onDownloadPfa() {
            var quoteNumber = model.premiumFinanceAgreementQuoteNumber();
            var base64String = model.premiumFinanceAgreementPdfData();
            const fileName = "PremiumFinanceAgreement-" +quoteNumber +".pdf";
            if (base64String.startsWith("JVB")) {
                base64String = "data:application/pdf;base64," + base64String;
                downloadFileObject(base64String, fileName);
            } else if (base64String.startsWith("data:application/pdf;base64")) {
                downloadFileObject(base64String, fileName);
            } else {
                console.error("Not a valid Base64 PDF string!");
            }
        }

        function downloadFileObject(base64String, fileName) {
            const linkSource = base64String;
            const downloadLink = document.createElement("a");
            downloadLink.href = linkSource;
            downloadLink.download = fileName;
            downloadLink.click();
        }
    </script>


</body></html>

                             

Screenshot: