summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-11-30 23:58:19 -0500
committerJules Laplace <jules@okfoc.us>2015-11-30 23:58:19 -0500
commit881c5de5b7709d06e88fdf554a021b8f1eddb9ed (patch)
tree252676e443822412a624ac5125d7c82f7b50db18
parent848730bdbc1e1b2c81274385d85fd385422323d8 (diff)
more cart
-rw-r--r--StoneIsland/www/css/nav.css5
-rw-r--r--StoneIsland/www/js/lib/cart/CartPayment.js9
-rw-r--r--StoneIsland/www/js/lib/cart/CartSummary.js2
-rw-r--r--StoneIsland/www/js/lib/nav/CreditCardView.js1
-rw-r--r--StoneIsland/www/js/lib/view/Serializable.js8
5 files changed, 20 insertions, 5 deletions
diff --git a/StoneIsland/www/css/nav.css b/StoneIsland/www/css/nav.css
index 61834f8b..814a8c3f 100644
--- a/StoneIsland/www/css/nav.css
+++ b/StoneIsland/www/css/nav.css
@@ -334,3 +334,8 @@ h1 {
letter-spacing: 1px;
font-weight: bold;
}
+
+.msg {
+ padding: 20px;
+ display: inline-block;
+}
diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js
index 222e2ac9..e65c7e8e 100644
--- a/StoneIsland/www/js/lib/cart/CartPayment.js
+++ b/StoneIsland/www/js/lib/cart/CartPayment.js
@@ -52,6 +52,7 @@ var CartPayment = FormView.extend({
setTimeout(function(){
var state = this.$same_as_shipping.prop("checked")
this.$billing_address_rapper.toggle( ! state )
+ this.address.disabled = state
}.bind(this))
},
@@ -113,7 +114,10 @@ var CartPayment = FormView.extend({
var shipping_info = {}, address_data, address_id, cc_info = {}, cc_data, cc_id
var shipping_type = $("[name=ShippingType]").filter(function(){ return $(this).prop("checked") }).val()
- if (this.address_list_mode) {
+ if (this.$same_as_shipping.prop("checked")) {
+ address_data = app.cart.shipping.data
+ }
+ else if (this.address_list_mode) {
address_id = this.$("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val()
address_data = app.account.addressLookup[ address_id ]
}
@@ -129,6 +133,9 @@ var CartPayment = FormView.extend({
"guid": cc_data.Guid,
"cvv": this.$("[name=CvvConfirm]"),
}
+
+ console.log("got card on file")
+
app.curtain.show("loading")
promise(sdk.cart.use_stored_credit_card, { data: card_on_file }).then(function(data){
app.curtain.hide("loading")
diff --git a/StoneIsland/www/js/lib/cart/CartSummary.js b/StoneIsland/www/js/lib/cart/CartSummary.js
index 72c44405..cfd34bd7 100644
--- a/StoneIsland/www/js/lib/cart/CartSummary.js
+++ b/StoneIsland/www/js/lib/cart/CartSummary.js
@@ -133,7 +133,7 @@ var CartSummary = ScrollableView.extend({
updateTotals: function(){
var subtotal = this.data.Cart.Totals.TotalWithoutPromotions
var shipping_cost = this.data.Cart.DeliveryMethod.Selected.Amount.Total
- var tax = 0
+ var tax = this.data.Cart.Totals.TotalSalesTax
var total = this.data.Cart.Totals.TotalToPay
this.$subtotal.html( as_cash(subtotal) )
diff --git a/StoneIsland/www/js/lib/nav/CreditCardView.js b/StoneIsland/www/js/lib/nav/CreditCardView.js
index ba3ac54a..63784618 100644
--- a/StoneIsland/www/js/lib/nav/CreditCardView.js
+++ b/StoneIsland/www/js/lib/nav/CreditCardView.js
@@ -40,6 +40,7 @@ var CreditCardView = SerializableView.extend({
},
validate_fields: function(data, errors){
+ if (this.disabled) { return }
var card = this.$number.validateCreditCard(this.cardOptions)
if (! card.valid) { errors.push([ "Number", "Your card number is invalid." ]) }
if (! data.ExpirationMonth || data.ExpirationMonth == "NONE") { errors.push([ "ExpirationMonth", "Please enter the expiration month." ]) }
diff --git a/StoneIsland/www/js/lib/view/Serializable.js b/StoneIsland/www/js/lib/view/Serializable.js
index b1e095d3..6ef8eda3 100644
--- a/StoneIsland/www/js/lib/view/Serializable.js
+++ b/StoneIsland/www/js/lib/view/Serializable.js
@@ -68,9 +68,11 @@ var SerializableView = View.extend({
var data = data || this.serialize()
var errors = errors || []
var presence_msgs = this.validate_presence || {}
- Object.keys(presence_msgs).forEach(function(k){
- if (! data[k]) errors.push( [ k, presence_msgs[k] ] )
- })
+ if (! this.disabled) {
+ Object.keys(presence_msgs).forEach(function(k){
+ if (! data[k]) errors.push( [ k, presence_msgs[k] ] )
+ })
+ }
this.validate_fields && this.validate_fields(data, errors)
this.cc && this.cc.validate(data, errors)
this.address && this.address.validate(data, errors)