diff options
| author | Rene Ae <aehtyb@gmail.com> | 2015-11-11 20:20:40 -0600 |
|---|---|---|
| committer | Rene Ae <aehtyb@gmail.com> | 2015-11-11 20:20:40 -0600 |
| commit | 962b2fe877d761a4abe957d138f7f435a8d62cb0 (patch) | |
| tree | b7d18c4ff686cc2c2ccf06e8b5631e6505c45ec6 | |
| parent | 0f1a1220b9085f1da05ce6fce8da11d8045b7dde (diff) | |
more payment tests
| -rw-r--r-- | StoneIsland/www/js/sdk/payment.js | 15 | ||||
| -rw-r--r-- | StoneIsland/www/js/sdk/shipping.js | 1 | ||||
| -rw-r--r-- | test/test/04-cart.js | 44 |
3 files changed, 38 insertions, 22 deletions
diff --git a/StoneIsland/www/js/sdk/payment.js b/StoneIsland/www/js/sdk/payment.js index cea70296..a31e3a32 100644 --- a/StoneIsland/www/js/sdk/payment.js +++ b/StoneIsland/www/js/sdk/payment.js @@ -1,9 +1,9 @@ sdk.payment = (function(){ var payment = {} - payment.list_credit_cards = function(opt){ + payment.add_credit_card = function(opt){ return $.ajax({ - method: "GET", + method: "POST", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), headers: { "x-yoox-appname": auth.appname, @@ -17,10 +17,12 @@ sdk.payment = (function(){ error: opt.error, }) } - - payment.add_credit_card = function(opt){ + + // LISTING A CREDIT CARD ONCE A CARD HAS BEEN ADDED PRODUCES ERROR + + payment.list_credit_cards = function(opt){ return $.ajax({ - method: "POST", + method: "GET", url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), headers: { "x-yoox-appname": auth.appname, @@ -28,7 +30,8 @@ sdk.payment = (function(){ }, data: opt.data, success: function(data){ - // console.log(data) + console.log("listing credit cards") + console.log(data) opt.success(data) }, error: opt.error, diff --git a/StoneIsland/www/js/sdk/shipping.js b/StoneIsland/www/js/sdk/shipping.js index a9e507e6..0325e17b 100644 --- a/StoneIsland/www/js/sdk/shipping.js +++ b/StoneIsland/www/js/sdk/shipping.js @@ -70,6 +70,7 @@ sdk.shipping = (function() { "x-yoox-appname": auth.appname, "x-yoox-cart-token": sdk.cart.token, }, + // temporarily commented out /* data: { "Id": opt.id, diff --git a/test/test/04-cart.js b/test/test/04-cart.js index 7638bac2..4457712f 100644 --- a/test/test/04-cart.js +++ b/test/test/04-cart.js @@ -142,8 +142,8 @@ describe('shipping', function(){ }) describe('#set_delivery_type()', function(){ - //RETURNING A 415 ERROR (which isnt listed as potential error).. ? - + //RETURNING A 415 ERROR (which isnt listed as potential error).. ? + it('set delivery type', function(done){ var d_type = { "Id": 1, @@ -214,17 +214,7 @@ describe('payment', function(){ }) }) }) - describe('#list_credit_cards()', function(){ - // send nothing - it('list credit cards', function(done){ - promise(sdk.payment.list_credit_cards, { data: {} }).then(function(data){ - assert(data.Header.StatusCode == 200) - console.log("listing credit cards"); - console.log(data) - done() - }) - }) - }) + var last_guid @@ -252,6 +242,18 @@ describe('payment', function(){ }) }) }) + + describe('#list_credit_cards()', function(){ + // send nothing + it('list credit cards', function(done){ + promise(sdk.payment.list_credit_cards, { data: {} }).then(function(data){ + assert(data.Header.StatusCode == 200) + console.log(data) + done() + }) + }) + }) + describe('#delete_credit_card()', function(){ it('delete credit card', function(done){ promise(sdk.payment.delete_credit_card, { guid: last_guid }).then(function(data){ @@ -295,17 +297,27 @@ describe('payment', function(){ }) }) }) - + + // TODO: list the credit cards on file + describe('#use_stored_credit_card()', function(){ /* it('use stored credit card', function(done){ - promise(sdk.cart.use_stored_credit_card, { data: {} }).then(function(data){ + var card_on_file = { + "Guid": opt.guid, + "UserId": auth.user_id, + "AccessToken": auth.access_token, + "Cvv": opt.cvv, + "Issue": opt.issue, + } + promise(sdk.cart.use_stored_credit_card, { data: card_on_file }).then(function(data){ assert(data.Header.StatusCode == 200) done() }) }) - */ +*/ }) + }) |
