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

Commit

Permalink
Merge pull request #67 from adammathys/remove-vendored-assets
Browse files Browse the repository at this point in the history
Remove vendored assets
  • Loading branch information
adammathys authored Mar 8, 2017
2 parents 98aa56d + b6c4ab4 commit 7e7a769
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 7,080 deletions.
3 changes: 0 additions & 3 deletions app/assets/javascripts/spree/braintree_hosted_form.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//= require braintree/3.9.0/client.js
//= require braintree/3.9.0/hosted-fields.js

function BraintreeHostedForm($paymentForm, $hostedFields, paymentMethodId) {
this.paymentForm = $paymentForm;
this.hostedFields = $hostedFields;
Expand Down
21 changes: 14 additions & 7 deletions app/assets/javascripts/spree/checkout/braintree.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//= require spree/braintree_hosted_form

$(function() {
/* This provides a default error handler for Braintree. Since we prevent
* submission if tokenization fails, we need to manually re-enable the
Expand All @@ -23,13 +25,18 @@ $(function() {
var $paymentForm = $("#checkout_form_payment"),
$hostedFields = $("[data-braintree-hosted-fields]");

$hostedFields.each(function() {
var $this = $(this);
var id = $this.data("id");
$.when(
$.getScript("https://js.braintreegateway.com/web/3.9.0/js/client.min.js"),
$.getScript("https://js.braintreegateway.com/web/3.9.0/js/hosted-fields.min.js")
).done(function() {
$hostedFields.each(function() {
var $this = $(this);
var id = $this.data("id");

var braintreeForm = new BraintreeHostedForm($paymentForm, $this, id);
braintreeForm.initializeHostedFields().
then(braintreeForm.addFormHook(braintreeError)).
fail(braintreeError);
var braintreeForm = new BraintreeHostedForm($paymentForm, $this, id);
braintreeForm.initializeHostedFields().
then(braintreeForm.addFormHook(braintreeError)).
fail(braintreeError);
});
});
});
2 changes: 0 additions & 2 deletions app/assets/javascripts/spree/frontend/paypal_button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//= require braintree/3.9.0/paypal

/**
* Constructor for PayPal button object
* @constructor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
//= require braintree/3.9.0/client
//= require braintree/3.9.0/data-collector
//= require spree/braintree_hosted_form.js

window.SolidusPaypalBraintree = {
APPLE_PAY_API_VERSION: 1,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@
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
$.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 %>
Expand Down

This file was deleted.

Loading

0 comments on commit 7e7a769

Please sign in to comment.