diff options
| -rw-r--r-- | StoneIsland/www/js/sdk/cart.js | 7 | ||||
| -rw-r--r-- | test/test/04-cart.js | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/StoneIsland/www/js/sdk/cart.js b/StoneIsland/www/js/sdk/cart.js index 0f8f6f99..0316e234 100644 --- a/StoneIsland/www/js/sdk/cart.js +++ b/StoneIsland/www/js/sdk/cart.js @@ -188,17 +188,17 @@ sdk.cart = (function(){ error: opt.error, }) } - + cart.finalize = function(opt){ return $.ajax({ - method: "PUT", + method: "POST", url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/secureFinalizer.json"), headers: { "x-yoox-appname": auth.appname, "x-yoox-cart-token": cart.token, "x-yoox-device": auth.device, }, - data: JSON.stringify( opt.data ), + data: JSON.stringify( opt.data || {} ), success: function(data){ console.log(data) // order number is: @@ -208,5 +208,6 @@ sdk.cart = (function(){ error: opt.error, }) } + return cart })()
\ No newline at end of file diff --git a/test/test/04-cart.js b/test/test/04-cart.js index 9c6a7931..4d302891 100644 --- a/test/test/04-cart.js +++ b/test/test/04-cart.js @@ -318,5 +318,14 @@ describe('payment', function(){ describe('checkout', function(){ describe('#finalize()', function(){ + it('fails to finalize a cart with test data', function(done){ + promise(sdk.cart.finalize, { ReturnUrl: "stoneisland.com", Token: sdk.auth.access_token }).then(function(data){ + console.log("SUCCESS", data) + done() + }).error(function(data){ + console.log("FAILURE", data) + done() + }) + }) }) }) |
