diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-09-25 17:04:08 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-09-25 17:04:08 -0400 |
| commit | ef381ff7d329c7d6c2c85a8374be371581849e67 (patch) | |
| tree | 8b8d8118cbdf43d7b8ca9fe7a1b7115197e07c8d | |
| parent | 875ae780b4bd959abd8f01a8e8b1d3e2bedb29d6 (diff) | |
more cart stuff
| -rw-r--r-- | StoneIsland/www/js/sdk/cart.js | 99 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/payment.js | 17 |
2 files changed, 116 insertions, 0 deletions
diff --git a/StoneIsland/www/js/sdk/cart.js b/StoneIsland/www/js/sdk/cart.js index 6c8bab0c..3c16feae 100644 --- a/StoneIsland/www/js/sdk/cart.js +++ b/StoneIsland/www/js/sdk/cart.js @@ -100,6 +100,105 @@ sdk.cart = (function(){ error: opt.error, }) } + + // NOTE: data might be wrapped in a Receiver object + cart.set_shipping_address = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "receiver.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // NB: Payment type may simply be 1 (credit card) + cart.set_payment_type = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/paymentType.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // use with full CC data if not storing it in wallet + cart.set_credit_card = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/creditCard.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + // use with a stored GUID + // NB: if "verification number" is 1, use CVV/CID/CVC security code + // if "verification number" is 2, use "Issue Number" + cart.use_stored_credit_card = function(opt){ + $.ajax({ + method: "PUT", + url: sdk.path("Cart.API/1.6", "carts/" + cart.id + "/userCreditCard.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-cart-token": cart.token, + }, + data: { // NB may be wrapped in UserCreditCard object + "Guid": opt.guid, + "UserId": auth.user_id, + "AccessToken": auth.access_token, + "Cvv": opt.cvv, + "Issue": opt.issue, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + cart.finalize = function(opt){ + $.ajax({ + method: "PUT", + 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: opt.data, + success: function(data){ + console.log(data) + // order number is: + // "Info": "2905Y07FA13020" + opt.success(data) + }, + error: opt.error, + }) + } return cart })()
\ No newline at end of file diff --git a/StoneIsland/www/js/sdk/payment.js b/StoneIsland/www/js/sdk/payment.js index 28fbb508..048cde4b 100644 --- a/StoneIsland/www/js/sdk/payment.js +++ b/StoneIsland/www/js/sdk/payment.js @@ -51,5 +51,22 @@ sdk.payment = (function(){ }) } + payment.get_payment_types = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Cart.API/1.6", "availablePaymentTypes.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-device": auth.device, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + return payment })()
\ No newline at end of file |
