diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-09-28 19:22:55 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-09-28 19:22:55 -0400 |
| commit | 8bf5b7f2e3be707523d202066f0c14dcd172f46a (patch) | |
| tree | 8ea0564be09bd416ee05fc0f74e80a18d52a66f1 /StoneIsland/platforms/ios/www/js/sdk/payment.js | |
| parent | ef694896c0d53f5dbd49377e5b2382368846ad65 (diff) | |
build
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/sdk/payment.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/sdk/payment.js | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/StoneIsland/platforms/ios/www/js/sdk/payment.js b/StoneIsland/platforms/ios/www/js/sdk/payment.js new file mode 100644 index 00000000..048cde4b --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/sdk/payment.js @@ -0,0 +1,72 @@ +sdk.payment = (function(){ + var payment = {} + + payment.list_credit_cards = function(opt){ + $.ajax({ + method: "GET", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + payment.add_credit_card = function(opt){ + $.ajax({ + method: "POST", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards.json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + data: opt.data, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + payment.delete_credit_card = function(opt){ + $.ajax({ + method: "DELETE", + url: sdk.path("Account.API/1.5", "users/" + auth.user_id + "/cards/" + opt.guid + ".json"), + headers: { + "x-yoox-appname": auth.appname, + "x-yoox-account-token": auth.access_token, + }, + success: function(data){ + console.log(data) + opt.success(data) + }, + error: opt.error, + }) + } + + 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 |
