Sha256: 44d2b135f4a82f86ecc7433b7ca8393238bcc70e18cd4849c7a57fdad459bc41

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

<% address = current_order.ship_address %>
<% id = payment_method.id %>

<% content_for :head do %>
  <%= javascript_include_tag "spree/checkout/braintree" %>
<% end %>

<% if current_store.braintree_configuration.paypal? %>
  <script src="https://www.paypalobjects.com/api/button.js?"
          data-merchant="braintree"
          data-id="paypal-button"
          data-button="checkout"
          data-color="blue"
          data-size="medium"
          data-shape="pill"
          data-button_type="button"
          data-button_disabled="true"
          ></script>

  <script>
    var address = {
      line1: '<%= address.address1 %>',
      line2: '<%= address.address2 %>',
      city: '<%= address.city %>',
      state: '<%= address.state.name %>',
      postalCode: '<%= address.zipcode %>',
      countryCode: '<%= address.country.iso %>',
      phone: '<%= address.phone %>',
      recipientName: '<%= "#{address.firstname} #{address.lastname}" %>'
    }

    $.when(
      $.getScript("https://js.braintreegateway.com/web/3.9.0/js/client.min.js"),
      $.getScript("https://js.braintreegateway.com/web/3.9.0/js/paypal.min.js"),
      $.getScript("https://js.braintreegateway.com/web/3.9.0/js/data-collector.min.js")
    ).done(function() {
      var button = new PaypalButton(document.querySelector("#paypal-button"));
      button.initialize({
        flow: 'vault',
        enableShippingAddress: true,
        shippingAddressOverride: address,
        shippingAddressEditable: false
      });
    });
  </script>
<% end %>

<% if current_store.braintree_configuration.credit_card? %>
  <fieldset class="braintree-hosted-fields" data-braintree-hosted-fields data-id="<%= id %>">
    <%= render "spree/shared/braintree_hosted_fields", id: id %>
  </fieldset>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_paypal_braintree-0.1.0 lib/views/frontend/spree/checkout/payment/_paypal_braintree.html.erb