diff options
| author | Jules Laplace <jules@okfoc.us> | 2015-11-26 01:12:00 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2015-11-26 01:12:00 -0500 |
| commit | 1e43ba3776bfa2415bdc8f93adc7b6f09569316b (patch) | |
| tree | d7336d353cfb5d305c79411d36d89efdbe9b2f89 /StoneIsland/www/js/lib/account/PaymentView.js | |
| parent | 818a4f598851d4fbfac5addbfd3fedc59772ac2b (diff) | |
store cc number
Diffstat (limited to 'StoneIsland/www/js/lib/account/PaymentView.js')
| -rw-r--r-- | StoneIsland/www/js/lib/account/PaymentView.js | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/StoneIsland/www/js/lib/account/PaymentView.js b/StoneIsland/www/js/lib/account/PaymentView.js index dcf509c8..9410fa42 100644 --- a/StoneIsland/www/js/lib/account/PaymentView.js +++ b/StoneIsland/www/js/lib/account/PaymentView.js @@ -1,6 +1,8 @@ var PaymentView = FormView.extend({ el: "#payment", + + action: sdk.payment.add_credit_card, events: { }, @@ -13,19 +15,19 @@ var PaymentView = FormView.extend({ "City":"Ferrara", "Province":"NY", "HolderIsoCountry":"IT", + "CreditCardCountry": "US", "ZipCode":"40200", - "Phone":"12343340200", - "Type":"Amex", - "Number":"378282246310005", + "Type":"Visa", + "Number":"4111111111111111", "ExpirationMonth":"09", "ExpirationYear":"2017", - "Cvv":"123", + "Cvv":"1233", }, initialize: function(){ this.$form = this.$("form") this.$msg = this.$(".msg") - this.address = new AddressView ({ parent: this }) + this.address = new AddressView ({ parent: this, checkPhone: false }) this.cc = new CreditCardView ({ parent: this }) this.scroller = new IScroll('#payment', app.iscroll_options) }, @@ -34,7 +36,7 @@ var PaymentView = FormView.extend({ if (! auth.logged_in()) { return app.router.go("intro") } app.footer.show("SAVE", "CANCEL") document.body.className = "payment" - this.preload() + // this.preload() }, populate: function(data){ @@ -44,7 +46,37 @@ var PaymentView = FormView.extend({ }, finalize: function(data){ - return null + if (this.cc.data && this.cc.data.Guid) { + sdk.payment.delete_credit_card({ + guid: this.cc.data.Guid, + success: function(){}, + error: function(){}, + }) + } + + data.IsDefault = "true" // this.$isDefault.prop("checked") ? "true" : "false" + data.UserId = sdk.auth.user_id + data.HolderIsoCountry = "US" + data.CreditCardNumber = data.Number + data.IsPreferred = "true" + + console.log(data) + return data + }, + + success: function(data){ + app.curtain.show("loading") + app.account.listAddresses(function(){ + app.curtain.hide("loading") + }) + }, + + error: function(data){ + console.log(data) + }, + + cancel: function(){ + app.router.go("intro") }, }) |
