{% extends './vista/template/payment/credit_card.twig' %}

{% block scripts_before %}
  <script type="text/javascript" src="//assets.moip.com.br/v2/moip.min.js"></script>
{% endblock %}

{% block script_before_send %}
  var cc = new Moip.CreditCard({
    number: $('input[name=creditcard_ccno]').val(),
    cvc: $('input[name=creditcard_cccvd]').val(),
    expMonth: mes,
    expYear: ano,
    pubKey: publicKey,
  })
  if (cc.isValid()) {
    data['encrypted_value'] = cc.hash();
  }
{% endblock %}

{% block scripts %}
  <script>
    var publicKey = `{{ public_key }}`;
  </script>

  {{ parent() }}

{% endblock %}
