diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js')
9 files changed, 50 insertions, 28 deletions
diff --git a/StoneIsland/platforms/ios/www/js/index.js b/StoneIsland/platforms/ios/www/js/index.js index 9b54ad44..ea992fc7 100755 --- a/StoneIsland/platforms/ios/www/js/index.js +++ b/StoneIsland/platforms/ios/www/js/index.js @@ -96,17 +96,17 @@ var app = (function(){ app.view = null app.router = new SiteRouter () -// if (sdk.env == "test") { -// app.router.launch() -// } -// else { -// } + // if (sdk.env == "test") { + // app.router.launch() + // } + // else { + // } if (navigator.onLine) { app.account.connect(window.deepLinkRoute || '/intro') app.blog.fetch(function(){ console.log("navigating to deep link route after fetch") - app.router.initial_route = window.deepLinkRoute || "/intro" + app.router.initial_route = window.deepLinkRoute || null app.router.launch() }) } diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js index 19bd3247..19b6fd63 100755 --- a/StoneIsland/platforms/ios/www/js/lib/_router.js +++ b/StoneIsland/platforms/ios/www/js/lib/_router.js @@ -51,6 +51,7 @@ var SiteRouter = Router.extend({ initial_route: null, launch: function(){ + console.log("LAUNCH!") if (this.initial_route) { this.parseRoute( this.initial_route ) } @@ -89,7 +90,7 @@ var SiteRouter = Router.extend({ } // window.FirebasePlugin && window.FirebasePlugin.setScreenName(name) - +console.log("view >>", app.view) app.header.set_back( !! app.view.back ) app.view.show() }.bind(this) diff --git a/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js b/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js index 796ea188..69d4f943 100755 --- a/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js +++ b/StoneIsland/platforms/ios/www/js/lib/account/PaymentView.js @@ -74,8 +74,9 @@ var PaymentView = FormView.extend({ app.curtain.show("loading") app.account.listAddresses({ success: function(){ + this.$msg.html('Your payment information has been saved.') app.curtain.hide("loading") - }, + }.bind(this), error: function(){ app.curtain.hide("loading") }, diff --git a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js index 67a1cfec..abc12818 100755 --- a/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js +++ b/StoneIsland/platforms/ios/www/js/lib/account/ShippingView.js @@ -68,8 +68,9 @@ var ShippingView = FormView.extend({ app.curtain.show("loading") app.account.listAddresses({ success: function(){ + this.$msg.html('Your address has been saved.') app.curtain.hide("loading") - }, + }.bind(this), error: function(){ app.curtain.hide("loading") }, diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js index 6eea977f..e9086982 100755 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js +++ b/StoneIsland/platforms/ios/www/js/lib/blogs/BlogView.js @@ -54,6 +54,7 @@ var BlogView = View.extend({ app.closed.storeClosedMessageTwo = app.store.StoreClosedMessageTwo break } + console.log(data) if (app.closed.storeIsClosed && sdk.env !== 'test') { app.closed.populate(app.store.ClosedStoreImages) diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js index a82509af..031e3359 100755 --- a/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js +++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartConfirm.js @@ -110,20 +110,31 @@ var CartConfirm = FormView.extend({ this.$tax.html( as_cash(tax) ) this.$total.html( as_cash(total) ) - var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ") - var address = data.Receiver.Name.toUpperCase() + " " + data.Receiver.Surname.toUpperCase() + "<br>" + street + ", " - address += data.Receiver.City + ", " + data.Receiver.Region + " " + data.Receiver.PostalCode + if (data.Receiver) { + var street = data.Receiver.StreetWithNumber.replace(/\n$/,"").replace("\n", ", ") + var address = data.Receiver.Name.toUpperCase() + " " + data.Receiver.Surname.toUpperCase() + "<br>" + street + ", " + address += data.Receiver.City + ", " + data.Receiver.Region + " " + data.Receiver.PostalCode - this.$shipping_address.html(address) - this.$shipping_method.html(data.DeliveryMethod.Selected.Type == 1 ? "* STANDARD SHIPPING" : "* EXPRESS SHIPPING") + this.$shipping_address.html(address) + this.$shipping_method.html(data.DeliveryMethod.Selected.Type == 1 ? "* STANDARD SHIPPING" : "* EXPRESS SHIPPING") + } else { + this.$shipping_address.html( "Please enter your shipping information." ) + this.$shipping_method.html( "" ) + } var cc = data.Payment.CreditCard - var cc_street = cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") - var cc_type = cc.Type == "AmericanExpress" ? "American Express" : cc.Type + if (cc) { + var cc_street = cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") + var cc_type = cc.Type == "AmericanExpress" ? "American Express" : cc.Type + var cc_name = cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() + var cc_eNcrYpTed = cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 + this.$payment_name.html( cc_name ) + this.$payment_method.html( cc_eNcrYpTed ) + } else { + this.$payment_name.html( "Please enter your credit card information." ) + this.$payment_method.html( "" ) + } - this.$payment_name.html( cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() ) - this.$payment_method.html( cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 ) - app.curtain.hide("loading") }, @@ -132,7 +143,9 @@ var CartConfirm = FormView.extend({ promise(sdk.cart.finalize, {}).then(function(){ app.curtain.hide("loading") app.router.go('cart/thanks') - }.bind(this)).error(function(data){ + }.bind(this)).error(function(res){ + const data = res.responseJSON + console.log(data) app.curtain.hide("loading") // {"Header":{"StatusCode":403,"Description":"403 Forbidden"},"Error":{"Description":"GenericApiError:CartAlreadyClosed"}} // {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\\"Item has been removed from cart because it is no longer available.\\"\\n235"}}' @@ -140,7 +153,7 @@ var CartConfirm = FormView.extend({ // {"Header":{"StatusCode":409,"Description":"304 NotModified"},"Error":{"Description":"FinalizationError:\"The reciever validation fails."}} // {"Header":{"StatusCode":440,"Description":"304 NotModified"},"Error":{"Description":"GenericApiError:CartFinalizationNotYetCompleted"}} // {"Header":{"StatusCode":441,"Description":"304 NotModified"},"Error":{"Description":"GenericApiError:EmptyCreditCard"}} - switch (data.StatusCode) { + switch (data.StatusCode || data.Header.StatusCode) { case 403: // cart already closed auth.clear_cart(auth.create_cart) app.router.go('thanks') @@ -158,14 +171,17 @@ var CartConfirm = FormView.extend({ }, finalization_error: function(data){ - if (data['Error']['Description'].match(/receiver validation fails/)) { - app.router.go('cart/shipping') + if (data['Error']['Description'].match(/receiver validation fails/i)) { + console.log('cc error') + app.router.go('cart/billing') app.cart.payment.show_errors([["Number","There was a problem with your credit card."]]) } - else if (data['Error']['Description'].match(/cart cannot be empty/)) { + else if (data['Error']['Description'].match(/cart cannot be empty/i)) { + console.log('cart empty') app.router.go('cart/summary') } - else if (data['Error']['Description'].match(/Item has been removed/)) { + else if (data['Error']['Description'].match(/Item has been removed/i)) { + console.log('item does not exist') app.router.go('cart/error') app.cart.error.show_error("We're sorry, but one or more items was out of stock. Please check your cart and try again.") } diff --git a/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js b/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js index 31c371a5..6e071399 100755 --- a/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js +++ b/StoneIsland/platforms/ios/www/js/lib/cart/CartPayment.js @@ -63,7 +63,7 @@ var CartPayment = FormView.extend({ } // this.$address_dropdown.toggle( !! app.account.ccs.length ) - this.address_list_mode = typeof state == "boolean" ? state : ! this.list_mode + this.address_list_mode = typeof state == "boolean" ? state : ! this.address_list_mode this.address.disabled = this.address_list_mode this.$address_form.toggle(! this.address_list_mode) this.$address_list.toggle(this.address_list_mode) diff --git a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js index de5fe951..f1c61072 100755 --- a/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js +++ b/StoneIsland/platforms/ios/www/js/lib/view/Serializable.js @@ -105,7 +105,9 @@ var SerializableView = View.extend({ var msgs = [] errors.forEach(function(e, i){ if (i > 0) { return } - this.$("[name=" + e[0] + "]").addClass('error_hilite') + if (e[0]) { + this.$("[name=" + e[0] + "]").addClass('error_hilite') + } msgs.push(e[1]) }.bind(this)) this.$msg.html(msgs.join("<br>")) diff --git a/StoneIsland/platforms/ios/www/js/sdk/_sdk.js b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js index ef29ff92..aba05ca3 100755 --- a/StoneIsland/platforms/ios/www/js/sdk/_sdk.js +++ b/StoneIsland/platforms/ios/www/js/sdk/_sdk.js @@ -9,7 +9,7 @@ var sdk = (function(){ sdk.init = function(opt){ switch (sdk.env = opt.env || "development") { case 'test': - endpoint = window.location.origin + "/" + endpoint = ('window' in this ? window.location.origin + "/" : "http://lvh.me:9090/") break default: case 'development': |
