diff options
| -rwxr-xr-x | StoneIsland/www/index.html | 4 | ||||
| -rwxr-xr-x | StoneIsland/www/js/lib/cart/CartConfirm.js | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 0c2169d0..3e48c515 100755 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -892,6 +892,10 @@ <div class="payment_method"></div> </div> + <div class="container-message submessage"> + <span class="msg"></span> + </div> + </div> </div> diff --git a/StoneIsland/www/js/lib/cart/CartConfirm.js b/StoneIsland/www/js/lib/cart/CartConfirm.js index a82509af..7f7d49b2 100755 --- a/StoneIsland/www/js/lib/cart/CartConfirm.js +++ b/StoneIsland/www/js/lib/cart/CartConfirm.js @@ -118,21 +118,25 @@ var CartConfirm = FormView.extend({ this.$shipping_method.html(data.DeliveryMethod.Selected.Type == 1 ? "* STANDARD SHIPPING" : "* EXPRESS SHIPPING") var cc = data.Payment.CreditCard - var cc_street = cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") - var cc_type = cc.Type == "AmericanExpress" ? "American Express" : cc.Type + var cc_street = cc ? cc.HolderAddress.replace(/\n$/,"").replace("\n", ", ") : "" + var cc_type = cc ? cc.Type == "AmericanExpress" ? "American Express" : cc.Type : "" + var cc_name = cc ? cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() : "" + var cc_eNcrYpTed = cc ? cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 : "" - this.$payment_name.html( cc.HolderName.toUpperCase() + " " + cc.HolderSurname.toUpperCase() ) - this.$payment_method.html( cc_type.toUpperCase() + " XXXX-XXXX-XXXX-" + cc.Last4 ) + this.$payment_name.html( cc_name ) + this.$payment_method.html( cc_eNcrYpTed ) app.curtain.hide("loading") }, save: function(){ app.curtain.show("loading") - promise(sdk.cart.finalize, {}).then(function(){ + promise(sdk.cart.secure_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 +144,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') |
