diff options
Diffstat (limited to 'StoneIsland/www/js')
| -rw-r--r-- | StoneIsland/www/js/lib/auth/SignupView.js | 6 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartPayment.js | 56 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/cart/CartShipping.js | 5 |
3 files changed, 47 insertions, 20 deletions
diff --git a/StoneIsland/www/js/lib/auth/SignupView.js b/StoneIsland/www/js/lib/auth/SignupView.js index 22b310de..a78af233 100644 --- a/StoneIsland/www/js/lib/auth/SignupView.js +++ b/StoneIsland/www/js/lib/auth/SignupView.js @@ -4,7 +4,8 @@ var SignupView = FormView.extend({ action: sdk.account.signup, last_data: null, - + +/* test_data: { "Email": "testit.account" + Math.floor(Math.random() * 10000000) + "@yoox.com", "Password": "TestPassword", @@ -16,7 +17,8 @@ var SignupView = FormView.extend({ "DataProfiling": true, "DataProfiling2": true, }, - +*/ + events: { "click .privacy-msg": "privacy_link", "submit form": "save", diff --git a/StoneIsland/www/js/lib/cart/CartPayment.js b/StoneIsland/www/js/lib/cart/CartPayment.js index fec5e1d1..222e2ac9 100644 --- a/StoneIsland/www/js/lib/cart/CartPayment.js +++ b/StoneIsland/www/js/lib/cart/CartPayment.js @@ -9,6 +9,7 @@ var CartPayment = FormView.extend({ address_list_mode: false, cc_list_mode: false, + data: {}, events: { "change [name=SameAsShipping]": "toggle_shipping", @@ -28,6 +29,7 @@ var CartPayment = FormView.extend({ this.$cc_list = this.$(".cc_list") this.$cc_form = this.$(".cc") this.$cc_dropdown = this.$(".cc_dropdown") + this.$cc_confirm = this.$(".cc_confirm") this.address = new AddressView ({ parent: this, checkPhone: false }) this.cc = new CreditCardView ({ parent: this }) @@ -75,6 +77,7 @@ var CartPayment = FormView.extend({ this.cc.disabled = this.cc_list_mode this.$cc_form.toggle(! this.cc_list_mode) this.$cc_list.toggle(this.cc_list_mode) + this.$cc_confirm.toggle(this.cc_list_mode) }, populate: function(){ @@ -107,37 +110,56 @@ var CartPayment = FormView.extend({ }, finalize: function(data){ - var shipping_info = {}, address_data, address_id, cc_info = {}, cc_data, cc_id + 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.list_mode) { - address_id = $("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() + if (this.address_list_mode) { + address_id = this.$("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() address_data = app.account.addressLookup[ address_id ] } else { address_data = data } + if (this.cc_list_mode) { - cc_id = $("[name=CCId]").filter(function(){ return $(this).prop("checked") }).val() + cc_id = this.$("[name=CCId]").filter(function(){ return $(this).prop("checked") }).val() cc_data = app.account.ccLookup[ cc_id ] + + var card_on_file = { + "guid": cc_data.Guid, + "cvv": this.$("[name=CvvConfirm]"), + } + app.curtain.show("loading") + promise(sdk.cart.use_stored_credit_card, { data: card_on_file }).then(function(data){ + app.curtain.hide("loading") + this.success() + }.bind(this)).error(function(data){ + app.curtain.hide("loading") + }.bind(this)) + + return } else { cc_data = data } - shipping_info.Name = address_data.Name - shipping_info.Surname = address_data.Surname - shipping_info.Email = auth.user.Email - shipping_info.Phone = address_data.Phone - shipping_info.Mobile = address_data.Phone - shipping_info.StreetWithNumber = address_data.Address - shipping_info.PostalCode = address_data.ZipCode - shipping_info.City = address_data.City - shipping_info.Province = address_data.Province - shipping_info.Region = address_data.Province - shipping_info.CountryCode = "US" - - return shipping_info + var credit_info = { + "HolderName": address_data.Name, + "HolderSurname": address_data.Surname, + "HolderAddress": address_data.Adress, + "HolderCity": address_data.City, + "HolderProvince": address_data.Province, + "HolderZip": address_data.ZipCode, + "HolderISOCountry": CANADIAN_LOOKUP[ address_data.Province ] ? "CA" : "US", + "HolderEmail": auth.user.Email, + "CardNumber": "", + "Type": cc_data.Type, + "ExpirationMonth": cc_data.ExpirationMonth, + "ExpirationYear": cc_data.ExpirationYear, + "Cvv": cc_data.Cvv, + } + + return credit_info }, success: function(){ diff --git a/StoneIsland/www/js/lib/cart/CartShipping.js b/StoneIsland/www/js/lib/cart/CartShipping.js index 9b8205c1..ec9394da 100644 --- a/StoneIsland/www/js/lib/cart/CartShipping.js +++ b/StoneIsland/www/js/lib/cart/CartShipping.js @@ -5,6 +5,7 @@ var CartShipping = FormView.extend({ action: sdk.cart.set_shipping_address, list_mode: true, + data: {}, template: $("#cart_shipping .template").html(), @@ -84,7 +85,7 @@ var CartShipping = FormView.extend({ }) if (this.list_mode) { - address_id = $("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() + address_id = this.$("[name=AddressId]").filter(function(){ return $(this).prop("checked") }).val() address_data = app.account.addressLookup[ address_id ] } else { @@ -103,6 +104,8 @@ var CartShipping = FormView.extend({ shipping_info.Region = address_data.Province shipping_info.CountryCode = CANADIAN_LOOKUP[ address_data.Province ] ? "CA" : "US" + this.data = shipping_info + return shipping_info }, |
