Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Remove separate paypal button and address views
Browse files Browse the repository at this point in the history
  • Loading branch information
Luuk Veenis committed Nov 11, 2016
1 parent 651baf9 commit e3e21a1
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 100 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
<% if current_order.valid? %>
<%= render partial: 'solidus_paypal_braintree/address_field', locals: { shipping_address: current_order.shipping_address } %>
<% end %>
<%= render partial: 'solidus_paypal_braintree/paypal_button' %>
<% address = current_order.ship_address %>

<!-- Load the client component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/client.min.js"></script>
<!-- Load the PayPal component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/paypal.min.js"></script>
<!-- Load the data-collector component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/data-collector.min.js"></script>
<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}" %>'
}
var button = new PaypalButton(document.querySelector("#paypal-button"));

button.initialize({
flow: 'vault',
enableShippingAddress: true,
shippingAddressOverride: address,
shippingAddressEditable: false
});
</script>
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
<% payment_method = current_store.payment_methods.where(active: true).find_by_type('SolidusPaypalBraintree::Gateway') %>
<% if payment_method %>
<%= render partial: 'solidus_paypal_braintree/address_field', locals: { shipping_address: current_order.shipping_address } %>
<script>
var amount = <%= current_order.total %>
var currency = "<%= current_order.currency %>"
</script>
<%= render partial: 'solidus_paypal_braintree/paypal_credit_button' %>
<% end %>
<% address = current_order.ship_address %>

<!-- Load the client component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/client.min.js"></script>
<!-- Load the PayPal component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/paypal.min.js"></script>
<!-- Load the data-collector component. -->
<script src="https://js.braintreegateway.com/web/3.4.0/js/data-collector.min.js"></script>
<script src="https://www.paypalobjects.com/api/button.js?"
data-merchant="braintree"
data-id="paypal-credit-button"
data-button="credit"
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}" %>'
}
var button = new PaypalButton(document.querySelector("#paypal-credit-button"));

button.initialize({
flow: 'checkout',
amount: <%= current_order.total %>,
currency: '<%= current_order.currency %>',
enableShippingAddress: true,
shippingAddressOverride: address,
shippingAddressEditable: false
});
</script>

0 comments on commit e3e21a1

Please sign in to comment.