summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-17 18:42:05 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-17 18:42:05 +0200
commit9dc473339319c82718db5aac472eee0b26473e5b (patch)
treeaa663ccfe0c98200beae4d942a504b2a3cc3d9a4
parentd1d9f92bf6398fdc6e2bb9a7d4a040659032c674 (diff)
better res from securefinalizer
-rwxr-xr-xStoneIsland/www/index.html4
-rwxr-xr-xStoneIsland/www/js/lib/cart/CartConfirm.js18
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')