<commit_before><script type="text/javascript" src="//code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="https://samurai.feefighters.com/assets/api/samurai.js"></script>
<script type="text/javascript">
Samurai.init({
  merchant_key: '{{ integration.merchant_key }}' {% if integration.test_mode %},
  sandbox: true
  {% endif %}
});

Samurai.on('form', 'payment', function(event, data) {
  $.post('{% url samurai_transaction %}', data.payment_method, function(data) {
    var transaction = $.parseJSON(data).transaction;
    if(transaction.success) {
      $('form').children('.results').html('<h3>Your purchase is complete!</h3><h4>'+transaction.payment_method.payment_method.first_name+' '+transaction.payment_method.payment_method.last_name+': $'+transaction.amount+' - '+transaction.description+'</h4>');
      Samurai.trigger('form', 'completed');
    } else {
      Samurai.PaymentErrorHandler.forForm($('form').get(0)).handleErrorsFromResponse(transaction);
    }
  });
});
</script>
<div data-samurai-payment-form></div><commit_msg>Bind the form payment events when the Samurai client is ready.<commit_after><script type="text/javascript" src="//code.jquery.com/jquery.min.js"></script>
<script type="text/javascript" src="https://samurai.feefighters.com/assets/api/samurai.js"></script>
<script type="text/javascript">
Samurai.init({
  merchant_key: '{{ integration.merchant_key }}' {% if integration.test_mode %},
  sandbox: true
  {% endif %}
});

Samurai.ready(function() {
  Samurai.on('form', 'payment', function(event, data) {
    $.post('{% url samurai_transaction %}', data.payment_method, function(data) {
      var transaction = $.parseJSON(data).transaction;
      if(transaction.success) {
        $('form').children('.results').html('<h3>Your purchase is complete!</h3><h4>'+transaction.payment_method.payment_method.first_name+' '+transaction.payment_method.payment_method.last_name+': $'+transaction.amount+' - '+transaction.description+'</h4>');
        Samurai.trigger('form', 'completed');
      } else {
        Samurai.PaymentErrorHandler.forForm($('form').get(0)).handleErrorsFromResponse(transaction);
      }
    });
  });
});
</script>
<div data-samurai-payment-form></div>
{'fraction_non_alphanumeric': 0.19417040358744395, 'fraction_numerical': 0.004484304932735426, 'mean_word_length': 5.30225988700565, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '5699737', 'n_tokens_mistral': 712, 'n_tokens_neox': 685, 'n_words': 96}