From e7453e3224daec936a819126f01de67585d43e24 Mon Sep 17 00:00:00 2001 From: emery Date: Tue, 13 Aug 2013 15:57:50 -0700 Subject: [PATCH] Move billing info first/last name into credit card only dom. #74 The PayPal API gives us first/last so no point in requiring it. Unfortunately can't say the same for address, which is needed for sales tax. --- build/recurly.js | 12 +- build/recurly.min.js | 2 +- changelog.md | 3 + examples/subscribe.html | 1 + src/dom/billing_info_fields.jade | 14 +- src/js/ui.js | 6 +- test/all.html | 6 +- test/support/jquery-1.10.0.js | 9800 ++++++++++++++++++++++++++++++ test/support/qunit.css | 232 + test/support/qunit.js | 1510 +++++ version | 2 +- 11 files changed, 11567 insertions(+), 21 deletions(-) create mode 100644 test/support/jquery-1.10.0.js create mode 100644 test/support/qunit.css create mode 100644 test/support/qunit.js diff --git a/build/recurly.js b/build/recurly.js index 64a9e0eb0..b0a34eee2 100644 --- a/build/recurly.js +++ b/build/recurly.js @@ -1,4 +1,4 @@ -// Recurly.js - v2.2.2 +// Recurly.js - v2.2.3 // // Communicates with Recurly via a JSONP API, // generates UI, handles user error, and passes control to the client @@ -50,7 +50,7 @@ R.settings = { , oneErrorPerField: true }; -R.version = '2.2.2'; +R.version = '2.2.3'; R.dom = {}; @@ -1599,10 +1599,10 @@ function pullBillingInfoFields($form, billingInfo, options, pull) { billingInfo.paymentMethod = pull.field($form, '.payment_method'); - billingInfo.firstName = pull.field($form, '.billing_info .first_name', V(R.isNotEmpty)); - billingInfo.lastName = pull.field($form, '.billing_info .last_name', V(R.isNotEmpty)); - if(billingInfo.paymentMethod !== 'paypal') { + billingInfo.firstName = pull.field($form, '.billing_info .first_name', V(R.isNotEmpty)); + billingInfo.lastName = pull.field($form, '.billing_info .last_name', V(R.isNotEmpty)); + billingInfo.number = pull.field($form, '.card_number', V(R.isNotEmpty), V(R.isValidCC)); billingInfo.cvv = pull.field($form, '.cvv', V(R.isNotEmpty), V(R.isValidCVV)); billingInfo.month = pull.field($form, '.month'); @@ -2381,7 +2381,7 @@ R.dom['contact_info_fields'] = '
Contact Info
VAT Number
You will be taken to PayPal to authorize a billing agreement.

Please make sure pop-ups aren\'t blocked.
'; +R.dom['billing_info_fields'] = '
Billing Info
First Name
Last Name
Credit Card Number
CVV
Expires
Address
Apt/Suite
City
State/Province
Zip/Postal
VAT Number
You will be taken to PayPal to authorize a billing agreement.

Please make sure pop-ups aren\'t blocked.
'; ////////////////////////////////////////////////// // Compiled from src/dom/subscribe_form.jade diff --git a/build/recurly.min.js b/build/recurly.min.js index 859fa5efd..a33523604 100644 --- a/build/recurly.min.js +++ b/build/recurly.min.js @@ -1 +1 @@ -(function(f){function v(D){function C(){}C.prototype=D||this;return new C()}var h={};h.settings={enableGeoIP:true,acceptedCards:["visa","mastercard","discover","american_express"],oneErrorPerField:true};h.version="2.2.2";h.dom={};h.Error={toString:function(){return"RecurlyJS Error: "+this.message}};h.raiseError=function(C){var D=v(h.Error);D.message=C;throw D};h.config=function(C){f.extend(true,h.settings,C);if(!C.baseURL){var D=h.settings.subdomain||h.raiseError("company subdomain not configured");h.settings.baseURL="https://"+D+".recurly.com/jsonp/"+D+"/"}};function u(D,C){if(D==1){return C.substr(0,C.length-1)}return""+D+" "+C}(h.Cost=function(C){this._cents=C||0}).prototype={toString:function(){return h.formatCurrency(this.dollars())},cents:function(C){if(C===undefined){return this._cents}return new h.Cost(C)},dollars:function(C){if(C===undefined){return this._cents/100}return new h.Cost(C*100)},mult:function(C){return new h.Cost(this._cents*C)},add:function(C){if(C.cents){C=C.cents()}return new h.Cost(this._cents+C)},sub:function(C){if(C.cents){C=C.cents()}return new h.Cost(this._cents-C)}};h.Cost.FREE=new h.Cost(0);(h.TimePeriod=function(D,C){this.length=D;this.unit=C}).prototype={toString:function(){return""+u(this.length,this.unit)},toDate:function(){var C=new Date();switch(this.unit){case"month":C.setMonth(C.getMonth()+this.length);break;case"day":C.setDay(C.getDay()+this.length);break}return C},clone:function(){return new h.TimePeriod(this.length,this.unit)}};(h.RecurringCost=function(D,C){this.cost=D;this.interval=C}).prototype={toString:function(){return""+this.cost+" every "+this.interval},clone:function(){return new h.TimePeriod(this.length,this.unit)}};h.RecurringCost.FREE=new h.RecurringCost(0,null);(h.RecurringCostStage=function(C,D){this.recurringCost=C;this.duration=D}).prototype={toString:function(){this.recurringCost.toString()+" for "+this.duration.toString()}};h.locale={};h.locale.errors={emptyField:"Required field",missingFullAddress:"Please enter your full address.",invalidEmail:"Invalid",invalidCC:"Invalid",invalidCVV:"Invalid",invalidCoupon:"Invalid",cardDeclined:"Transaction declined",acceptTOS:"Please accept the Terms of Service.",invalidQuantity:"Invalid quantity"};h.locale.currencies={};h.locale.currency={format:"%u%n",separator:".",delimiter:",",precision:2};function s(C,D){var F=h.locale.currencies[C]=v(h.locale.currency);for(var E in D){F[E]=D[E]}}s("USD",{symbol:"$"});s("AUD",{symbol:"$"});s("CAD",{symbol:"$"});s("EUR",{symbol:"\u20ac"});s("GBP",{symbol:"\u00a3"});s("CZK",{symbol:"\u004b"});s("DKK",{symbol:"\u006b\u0072"});s("HUF",{symbol:"Ft"});s("JPY",{symbol:"\u00a5"});s("NOK",{symbol:"kr"});s("NZD",{symbol:"$"});s("PLN",{symbol:"\u007a"});s("SGD",{symbol:"$"});s("SEK",{symbol:"kr"});s("CHF",{symbol:"Fr"});s("ZAR",{symbol:"R"});h.settings.locale=h.locale;h.knownCards={visa:{prefixes:[4],name:"Visa"},mastercard:{prefixes:[51,52,53,54,55],name:"MasterCard"},american_express:{prefixes:[34,37],name:"American Express"},discover:{prefixes:[6011,62,64,65],name:"Discover"},diners_club:{prefixes:[305,36,38],name:"Diners Club"},carte_blanche:{prefixes:[300,301,302,303,304,305]},jcb:{prefixes:[35],name:"JCB"},enroute:{prefixes:[2014,2149],name:"EnRoute"},maestro:{prefixes:[5018,5020,5038,6304,6759,6761],name:"Maestro"},laser:{prefixes:[6304,6706,6771,6709],name:"Laser"}};h.detectCardType=function(E){E=E.replace(/\D/g,"");var H=h.knownCards;for(var C in H){if(H.hasOwnProperty(C)){var I=H[C];for(var G=0,D=I.prefixes.length;G").hide();F.attr("action",D).attr("method","POST").attr("enctype","application/x-www-form-urlencoded");f('').attr({name:"recurly_token",value:E}).appendTo(F);f("body").append(F);F.submit()};function k(F){var E=f("
');if(!P.displayQuantity){J.find(".quantity").remove()}J.data("add_on",P);J.appendTo(K)}K.delegate(".quantity input","change keyup",function(ab){var Y=f(this).closest(".add_on");var aa=Y.data("add_on");var Z=parseInt(f(this).val(),10)||1;V.findAddOnByCode(aa.code).quantity=Z;M()});K.bind("selectstart",function(Y){if(f(Y.target).is(".add_on")){Y.preventDefault()}});K.delegate(".add_on","click",function(ac){if(f(ac.target).closest(".quantity").length){return}var aa=!f(this).hasClass("selected");f(this).toggleClass("selected",aa);var ab=f(this).data("add_on");if(aa){var Y=V.redeemAddOn(ab);var Z=f(this).find(".quantity input");Y.quantity=parseInt(Z.val(),10)||1;Z.focus()}else{V.removeAddOn(ab.code)}M()})}}else{K.remove()}var N=C.find(".coupon");var R=null;function W(){var Y=N.find("input").val();if(Y==R){return}R=Y;if(!Y){N.removeClass("invalid").removeClass("valid");N.find(".description").text("");V.coupon=undefined;M();return}N.addClass("checking");V.getCoupon(Y,function(Z){N.removeClass("checking");V.coupon=Z;N.removeClass("invalid").addClass("valid");N.find(".description").text(Z.description);M()},function(){V.coupon=undefined;N.removeClass("checking");N.removeClass("valid").addClass("invalid");N.find(".description").text(h.locale.errors.invalidCoupon);M()})}if(D.enableCoupons){N.find("input").bind("keyup change",function(Y){});N.find("input").keypress(function(Y){if(Y.charCode==13){Y.preventDefault();W()}});N.find(".check").click(function(){W()});N.find("input").blur(function(){N.find(".check").click()})}else{N.remove()}var I=C.find(".vat");var X=C.find(".vat_number");var Q=X.find("input");I.find(".title").text("VAT at "+h.settings.VATPercent+"%");function L(){var Z=C.find(".country select").val();var ab=h.isVATNumberApplicable(Z);X.toggleClass("applicable",ab);X.toggleClass("inapplicable",!ab);var aa=Q.val();var Y=h.isVATChargeApplicable(Z,aa);I.toggleClass("applicable",Y);I.toggleClass("inapplicable",!Y)}C.find(".country select").change(function(){O.country=f(this).val();M();L()}).change();Q.bind("keyup change",function(){O.vatNumber=f(this).val();M();L()});C.submit(function(Y){Y.preventDefault();a(C);C.find(".error").remove();C.find(".invalid").removeClass("invalid");B(function(Z){q(C,V.plan,D,Z);i(C,H,D,Z);d(C,O,D,Z);y(C,Z)},function(){C.addClass("submitting");var Z=C.find("button.submit").text();C.find("button.submit").attr("disabled",true).text("Please Wait");V.save({signature:D.signature,success:function(aa){if(D.successHandler){D.successHandler(h.getToken(aa))}if(D.successURL){var ab=D.successURL;h.postResult(ab,aa,D)}},error:function(aa){if(!D.onError||!D.onError(aa)){p(C,aa)}},complete:function(){C.removeClass("submitting");C.find("button.submit").removeAttr("disabled").text(Z)}})})});W();M();if(D.beforeInject){D.beforeInject(C.get(0))}f(function(){var Y=f(D.target);Y.html(C);if(D.afterInject){D.afterInject(C.get(0))}})}};h.paypal={start:function(G){var J=window.name;if(J.indexOf("recurly_result")>-1){window.name="";J=""}var H=f.extend(G.data,{post_message:true,referer:window.location.href}),E=G.url+"?"+f.param(H),C=window.open(E,"recurly_paypal","menubar=1,resizable=1");window.popup=C;f(window).on("message",I);var D=setInterval(function(){var L=decodeURIComponent(window.name),M=L.match(/recurly_result=(.*)[&$]?/),K=M&&f.parseJSON(M[1]);if(K){F(K);window.name=J}},1000);function F(K){try{C.close()}finally{G.success(K);G.complete();f(window).unbind("message",I);clearInterval(D)}}function I(M){var L=document.createElement("a");L.href=h.settings.baseURL;var K=L.protocol+"//"+L.host.replace(/:\d+$/,"");if(M.originalEvent.origin==K){F(M.originalEvent.data)}}}};h.states={};h.states.US={"-":"Select State","--":"------------",AK:"Alaska",AL:"Alabama",AP:"Armed Forces Pacific",AR:"Arkansas",AS:"American Samoa",AZ:"Arizona",CA:"California",CO:"Colorado",CT:"Connecticut",DC:"District of Columbia",DE:"Delaware",FL:"Florida",FM:"Federated States of Micronesia",GA:"Georgia",GU:"Guam",HI:"Hawaii",IA:"Iowa",ID:"Idaho",IL:"Illinois",IN:"Indiana",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",MA:"Massachusetts",MD:"Maryland",ME:"Maine",MH:"Marshall Islands",MI:"Michigan",MN:"Minnesota",MO:"Missouri",MP:"Northern Mariana Islands",MS:"Mississippi",MT:"Montana",NC:"North Carolina",ND:"North Dakota",NE:"Nebraska",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NV:"Nevada",NY:"New York",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",PR:"Puerto Rico",PW:"Palau",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VA:"Virginia",VI:"Virgin Islands",VT:"Vermont",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming"};h.states.CA={"-":"Select State","--":"------------",AB:"Alberta",BC:"British Columbia",MB:"Manitoba",NB:"New Brunswick",NL:"Newfoundland",NS:"Nova Scotia",NU:"Nunavut",ON:"Ontario",PE:"Prince Edward Island",QC:"Quebec",SK:"Saskatchewan",NT:"Northwest Territories",YT:"Yukon Territory",AA:"Armed Forces Americas",AE:"Armed Forces Europe, Middle East, & Canada"};h.dom.contact_info_fields='
Contact Info
First Name
Last Name
Phone Number
Company/Organization Name
';h.dom.billing_info_fields='
Billing Info
First Name
Last Name
Credit Card Number
CVV
Expires
Address
Apt/Suite
City
State/Province
Zip/Postal
VAT Number
You will be taken to PayPal to authorize a billing agreement.

Please make sure pop-ups aren\'t blocked.
';h.dom.subscribe_form='';h.dom.update_billing_info_form='
';h.dom.one_time_transaction_form='
';h.dom.terms_of_service='';window.Recurly=h})(jQuery); \ No newline at end of file +(function(f){function v(D){function C(){}C.prototype=D||this;return new C()}var h={};h.settings={enableGeoIP:true,acceptedCards:["visa","mastercard","discover","american_express"],oneErrorPerField:true};h.version="2.2.3";h.dom={};h.Error={toString:function(){return"RecurlyJS Error: "+this.message}};h.raiseError=function(C){var D=v(h.Error);D.message=C;throw D};h.config=function(C){f.extend(true,h.settings,C);if(!C.baseURL){var D=h.settings.subdomain||h.raiseError("company subdomain not configured");h.settings.baseURL="https://"+D+".recurly.com/jsonp/"+D+"/"}};function u(D,C){if(D==1){return C.substr(0,C.length-1)}return""+D+" "+C}(h.Cost=function(C){this._cents=C||0}).prototype={toString:function(){return h.formatCurrency(this.dollars())},cents:function(C){if(C===undefined){return this._cents}return new h.Cost(C)},dollars:function(C){if(C===undefined){return this._cents/100}return new h.Cost(C*100)},mult:function(C){return new h.Cost(this._cents*C)},add:function(C){if(C.cents){C=C.cents()}return new h.Cost(this._cents+C)},sub:function(C){if(C.cents){C=C.cents()}return new h.Cost(this._cents-C)}};h.Cost.FREE=new h.Cost(0);(h.TimePeriod=function(D,C){this.length=D;this.unit=C}).prototype={toString:function(){return""+u(this.length,this.unit)},toDate:function(){var C=new Date();switch(this.unit){case"month":C.setMonth(C.getMonth()+this.length);break;case"day":C.setDay(C.getDay()+this.length);break}return C},clone:function(){return new h.TimePeriod(this.length,this.unit)}};(h.RecurringCost=function(D,C){this.cost=D;this.interval=C}).prototype={toString:function(){return""+this.cost+" every "+this.interval},clone:function(){return new h.TimePeriod(this.length,this.unit)}};h.RecurringCost.FREE=new h.RecurringCost(0,null);(h.RecurringCostStage=function(C,D){this.recurringCost=C;this.duration=D}).prototype={toString:function(){this.recurringCost.toString()+" for "+this.duration.toString()}};h.locale={};h.locale.errors={emptyField:"Required field",missingFullAddress:"Please enter your full address.",invalidEmail:"Invalid",invalidCC:"Invalid",invalidCVV:"Invalid",invalidCoupon:"Invalid",cardDeclined:"Transaction declined",acceptTOS:"Please accept the Terms of Service.",invalidQuantity:"Invalid quantity"};h.locale.currencies={};h.locale.currency={format:"%u%n",separator:".",delimiter:",",precision:2};function s(C,D){var F=h.locale.currencies[C]=v(h.locale.currency);for(var E in D){F[E]=D[E]}}s("USD",{symbol:"$"});s("AUD",{symbol:"$"});s("CAD",{symbol:"$"});s("EUR",{symbol:"\u20ac"});s("GBP",{symbol:"\u00a3"});s("CZK",{symbol:"\u004b"});s("DKK",{symbol:"\u006b\u0072"});s("HUF",{symbol:"Ft"});s("JPY",{symbol:"\u00a5"});s("NOK",{symbol:"kr"});s("NZD",{symbol:"$"});s("PLN",{symbol:"\u007a"});s("SGD",{symbol:"$"});s("SEK",{symbol:"kr"});s("CHF",{symbol:"Fr"});s("ZAR",{symbol:"R"});h.settings.locale=h.locale;h.knownCards={visa:{prefixes:[4],name:"Visa"},mastercard:{prefixes:[51,52,53,54,55],name:"MasterCard"},american_express:{prefixes:[34,37],name:"American Express"},discover:{prefixes:[6011,62,64,65],name:"Discover"},diners_club:{prefixes:[305,36,38],name:"Diners Club"},carte_blanche:{prefixes:[300,301,302,303,304,305]},jcb:{prefixes:[35],name:"JCB"},enroute:{prefixes:[2014,2149],name:"EnRoute"},maestro:{prefixes:[5018,5020,5038,6304,6759,6761],name:"Maestro"},laser:{prefixes:[6304,6706,6771,6709],name:"Laser"}};h.detectCardType=function(E){E=E.replace(/\D/g,"");var H=h.knownCards;for(var C in H){if(H.hasOwnProperty(C)){var I=H[C];for(var G=0,D=I.prefixes.length;G").hide();F.attr("action",D).attr("method","POST").attr("enctype","application/x-www-form-urlencoded");f('').attr({name:"recurly_token",value:E}).appendTo(F);f("body").append(F);F.submit()};function k(F){var E=f("
');if(!P.displayQuantity){J.find(".quantity").remove()}J.data("add_on",P);J.appendTo(K)}K.delegate(".quantity input","change keyup",function(ab){var Y=f(this).closest(".add_on");var aa=Y.data("add_on");var Z=parseInt(f(this).val(),10)||1;V.findAddOnByCode(aa.code).quantity=Z;M()});K.bind("selectstart",function(Y){if(f(Y.target).is(".add_on")){Y.preventDefault()}});K.delegate(".add_on","click",function(ac){if(f(ac.target).closest(".quantity").length){return}var aa=!f(this).hasClass("selected");f(this).toggleClass("selected",aa);var ab=f(this).data("add_on");if(aa){var Y=V.redeemAddOn(ab);var Z=f(this).find(".quantity input");Y.quantity=parseInt(Z.val(),10)||1;Z.focus()}else{V.removeAddOn(ab.code)}M()})}}else{K.remove()}var N=C.find(".coupon");var R=null;function W(){var Y=N.find("input").val();if(Y==R){return}R=Y;if(!Y){N.removeClass("invalid").removeClass("valid");N.find(".description").text("");V.coupon=undefined;M();return}N.addClass("checking");V.getCoupon(Y,function(Z){N.removeClass("checking");V.coupon=Z;N.removeClass("invalid").addClass("valid");N.find(".description").text(Z.description);M()},function(){V.coupon=undefined;N.removeClass("checking");N.removeClass("valid").addClass("invalid");N.find(".description").text(h.locale.errors.invalidCoupon);M()})}if(D.enableCoupons){N.find("input").bind("keyup change",function(Y){});N.find("input").keypress(function(Y){if(Y.charCode==13){Y.preventDefault();W()}});N.find(".check").click(function(){W()});N.find("input").blur(function(){N.find(".check").click()})}else{N.remove()}var I=C.find(".vat");var X=C.find(".vat_number");var Q=X.find("input");I.find(".title").text("VAT at "+h.settings.VATPercent+"%");function L(){var Z=C.find(".country select").val();var ab=h.isVATNumberApplicable(Z);X.toggleClass("applicable",ab);X.toggleClass("inapplicable",!ab);var aa=Q.val();var Y=h.isVATChargeApplicable(Z,aa);I.toggleClass("applicable",Y);I.toggleClass("inapplicable",!Y)}C.find(".country select").change(function(){O.country=f(this).val();M();L()}).change();Q.bind("keyup change",function(){O.vatNumber=f(this).val();M();L()});C.submit(function(Y){Y.preventDefault();a(C);C.find(".error").remove();C.find(".invalid").removeClass("invalid");B(function(Z){q(C,V.plan,D,Z);i(C,H,D,Z);d(C,O,D,Z);y(C,Z)},function(){C.addClass("submitting");var Z=C.find("button.submit").text();C.find("button.submit").attr("disabled",true).text("Please Wait");V.save({signature:D.signature,success:function(aa){if(D.successHandler){D.successHandler(h.getToken(aa))}if(D.successURL){var ab=D.successURL;h.postResult(ab,aa,D)}},error:function(aa){if(!D.onError||!D.onError(aa)){p(C,aa)}},complete:function(){C.removeClass("submitting");C.find("button.submit").removeAttr("disabled").text(Z)}})})});W();M();if(D.beforeInject){D.beforeInject(C.get(0))}f(function(){var Y=f(D.target);Y.html(C);if(D.afterInject){D.afterInject(C.get(0))}})}};h.paypal={start:function(G){var J=window.name;if(J.indexOf("recurly_result")>-1){window.name="";J=""}var H=f.extend(G.data,{post_message:true,referer:window.location.href}),E=G.url+"?"+f.param(H),C=window.open(E,"recurly_paypal","menubar=1,resizable=1");window.popup=C;f(window).on("message",I);var D=setInterval(function(){var L=decodeURIComponent(window.name),M=L.match(/recurly_result=(.*)[&$]?/),K=M&&f.parseJSON(M[1]);if(K){F(K);window.name=J}},1000);function F(K){try{C.close()}finally{G.success(K);G.complete();f(window).unbind("message",I);clearInterval(D)}}function I(M){var L=document.createElement("a");L.href=h.settings.baseURL;var K=L.protocol+"//"+L.host.replace(/:\d+$/,"");if(M.originalEvent.origin==K){F(M.originalEvent.data)}}}};h.states={};h.states.US={"-":"Select State","--":"------------",AK:"Alaska",AL:"Alabama",AP:"Armed Forces Pacific",AR:"Arkansas",AS:"American Samoa",AZ:"Arizona",CA:"California",CO:"Colorado",CT:"Connecticut",DC:"District of Columbia",DE:"Delaware",FL:"Florida",FM:"Federated States of Micronesia",GA:"Georgia",GU:"Guam",HI:"Hawaii",IA:"Iowa",ID:"Idaho",IL:"Illinois",IN:"Indiana",KS:"Kansas",KY:"Kentucky",LA:"Louisiana",MA:"Massachusetts",MD:"Maryland",ME:"Maine",MH:"Marshall Islands",MI:"Michigan",MN:"Minnesota",MO:"Missouri",MP:"Northern Mariana Islands",MS:"Mississippi",MT:"Montana",NC:"North Carolina",ND:"North Dakota",NE:"Nebraska",NH:"New Hampshire",NJ:"New Jersey",NM:"New Mexico",NV:"Nevada",NY:"New York",OH:"Ohio",OK:"Oklahoma",OR:"Oregon",PA:"Pennsylvania",PR:"Puerto Rico",PW:"Palau",RI:"Rhode Island",SC:"South Carolina",SD:"South Dakota",TN:"Tennessee",TX:"Texas",UT:"Utah",VA:"Virginia",VI:"Virgin Islands",VT:"Vermont",WA:"Washington",WV:"West Virginia",WI:"Wisconsin",WY:"Wyoming"};h.states.CA={"-":"Select State","--":"------------",AB:"Alberta",BC:"British Columbia",MB:"Manitoba",NB:"New Brunswick",NL:"Newfoundland",NS:"Nova Scotia",NU:"Nunavut",ON:"Ontario",PE:"Prince Edward Island",QC:"Quebec",SK:"Saskatchewan",NT:"Northwest Territories",YT:"Yukon Territory",AA:"Armed Forces Americas",AE:"Armed Forces Europe, Middle East, & Canada"};h.dom.contact_info_fields='
Contact Info
First Name
Last Name
Phone Number
Company/Organization Name
';h.dom.billing_info_fields='
Billing Info
First Name
Last Name
Credit Card Number
CVV
Expires
Address
Apt/Suite
City
State/Province
Zip/Postal
VAT Number
You will be taken to PayPal to authorize a billing agreement.

Please make sure pop-ups aren\'t blocked.
';h.dom.subscribe_form='';h.dom.update_billing_info_form='
';h.dom.one_time_transaction_form='
';h.dom.terms_of_service='';window.Recurly=h})(jQuery); \ No newline at end of file diff --git a/changelog.md b/changelog.md index fab41e3e0..d5d3eecde 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ #Recurly.js CHANGELOG +##Version 2.2.3 (Aug 13, 2013) +- Fix an issue where first/last name show up for PayPal when distinguishContactFromBillingInfo is true + ##Version 2.2.2 (June 6, 2013) - Fix bug in PayPal integration. - Fix a bug where a coupon specified by initial prefilled values would not get applied to the subscription. diff --git a/examples/subscribe.html b/examples/subscribe.html index ab229dfc8..4efdfb1fb 100644 --- a/examples/subscribe.html +++ b/examples/subscribe.html @@ -23,6 +23,7 @@ planCode: 'simpleplan', distinguishContactFromBillingInfo: true, collectCompany: true, + collectContact: false, termsOfServiceURL: 'http://example.com/tos', acceptPaypal: true, acceptedCards: ['mastercard', diff --git a/src/dom/billing_info_fields.jade b/src/dom/billing_info_fields.jade index 184cc3bec..ddd4ae879 100644 --- a/src/dom/billing_info_fields.jade +++ b/src/dom/billing_info_fields.jade @@ -10,15 +10,15 @@ input(type="radio", name="payment_method", value="paypal") .logo -.field.first_name - .placeholder First Name - input(type="text") +.credit_card + .field.first_name + .placeholder First Name + input(type="text") -.field.last_name - .placeholder Last Name - input(type="text") + .field.last_name + .placeholder Last Name + input(type="text") -.credit_card .card_cvv .field.card_number .placeholder Credit Card Number diff --git a/src/js/ui.js b/src/js/ui.js index 1e9332f36..f0d129033 100644 --- a/src/js/ui.js +++ b/src/js/ui.js @@ -540,10 +540,10 @@ function pullBillingInfoFields($form, billingInfo, options, pull) { billingInfo.paymentMethod = pull.field($form, '.payment_method'); - billingInfo.firstName = pull.field($form, '.billing_info .first_name', V(R.isNotEmpty)); - billingInfo.lastName = pull.field($form, '.billing_info .last_name', V(R.isNotEmpty)); - if(billingInfo.paymentMethod !== 'paypal') { + billingInfo.firstName = pull.field($form, '.billing_info .first_name', V(R.isNotEmpty)); + billingInfo.lastName = pull.field($form, '.billing_info .last_name', V(R.isNotEmpty)); + billingInfo.number = pull.field($form, '.card_number', V(R.isNotEmpty), V(R.isValidCC)); billingInfo.cvv = pull.field($form, '.cvv', V(R.isNotEmpty), V(R.isValidCVV)); billingInfo.month = pull.field($form, '.month'); diff --git a/test/all.html b/test/all.html index 4c4f38a97..06fc8ca08 100644 --- a/test/all.html +++ b/test/all.html @@ -2,9 +2,9 @@ - - - + + +