<commit_before><script type="text/javascript" src="https://<%= payment_method.preferred_server %>/v1.1/affirm.js"></script>
<div id="affirm_button"></div>
<script>
if(typeof AffirmPaymentMethods === "undefined")
{
    //register the click handler only once
    AffirmPaymentMethods = {};
    function setAffirmCheckout(checkedPaymentMethod){
        if(AffirmPaymentMethods[checkedPaymentMethod])
        {
            affirm.checkout.set(AffirmPaymentMethods[checkedPaymentMethod]);
        }
    }

    $(document).ready(function() {
        var checkedPaymentMethod = $('div[data-hook="checkout_payment_step"] input[type="radio"]:checked').val();
        setAffirmCheckout(checkedPaymentMethod);
        $('div[data-hook="checkout_payment_step"] input[type="radio"]').click(function(e)
        {
            setAffirmCheckout($(e.target).val());
        });
        $('.continue').click( function(){
            var checkedPaymentMethod = $('div[data-hook="checkout_payment_step"] input[type="radio"]:checked').val();
            if(AffirmPaymentMethods[checkedPaymentMethod])
            {
                affirm.open();
                return false;
            }
        });
    })
}

var affirm_checkout_data = {
    checkout_id:          "<%= @order.number %>",
    currency:             "USD",
    shipping_amount:      <%= @order.shipment_total * 100 %>,
    shipping_type:        "<%= @order.shipments.first.shipping_method.name if @order.shipments %>",
    tax_amount:           <%= @order.additional_tax_total * 100 %>,
    misc_fee_amount:      <%= (@order.adjustment_total - @order.additional_tax_total) * 100 %>,<commit_msg>using affirm.checkout.open instead of affirm.open<commit_after><script type="text/javascript" src="https://<%= payment_method.preferred_server %>/v1.1/affirm.js"></script>
<div id="affirm_button"></div>
<script>
if(typeof AffirmPaymentMethods === "undefined")
{
    //register the click handler only once
    AffirmPaymentMethods = {};
    function setAffirmCheckout(checkedPaymentMethod){
        if(AffirmPaymentMethods[checkedPaymentMethod])
        {
            affirm.checkout.set(AffirmPaymentMethods[checkedPaymentMethod]);
        }
    }

    $(document).ready(function() {
        var checkedPaymentMethod = $('div[data-hook="checkout_payment_step"] input[type="radio"]:checked').val();
        setAffirmCheckout(checkedPaymentMethod);
        $('div[data-hook="checkout_payment_step"] input[type="radio"]').click(function(e)
        {
            setAffirmCheckout($(e.target).val());
        });
        $('.continue').click( function(){
            var checkedPaymentMethod = $('div[data-hook="checkout_payment_step"] input[type="radio"]:checked').val();
            if(AffirmPaymentMethods[checkedPaymentMethod])
            {
                affirm.checkout.open();
                return false;
            }
        });
    })
}

var affirm_checkout_data = {
    checkout_id:          "<%= @order.number %>",
    currency:             "USD",
    shipping_amount:      <%= @order.shipment_total * 100 %>,
    shipping_type:        "<%= @order.shipments.first.shipping_method.name if @order.shipments %>",
    tax_amount:           <%= @order.additional_tax_total * 100 %>,
    misc_fee_amount:      <%= (@order.adjustment_total - @order.additional_tax_total) * 100 %>,
{'fraction_non_alphanumeric': 0.15398496240601503, 'fraction_numerical': 0.006616541353383459, 'mean_word_length': 2.992797118847539, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3742335', 'n_tokens_mistral': 997, 'n_tokens_neox': 952, 'n_words': 126}