Created
August 30, 2013 15:15
-
-
Save bjmc/6390905 to your computer and use it in GitHub Desktop.
This is a silly little helper function to fill in all the values for a new Zuora hosted payment page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function populateValues(hosted_domain, environment) { | |
var $ = jQuery; | |
$('#pageName').val('Add Credit Card' + ' - ' + environment); | |
$('#domain').val(hosted_domain); | |
$('input[name="pageTitle"]').val('Credit Card'); | |
$('#callbackPath').val('/service/graph/billing/callback'); | |
$('#paymentGateway').val('2c92c0f83f54bdef013f59ce65d87719'); | |
var css_data = "body {\n width: 100%;\n padding: 0;\n margin: 0;\n color: #333333;\n font-family: \"Helvetica Neue\",Arial,Helvetica,sans-serif;\n font-size: 14px;\n line-height: 1.5; }\n\ntable {\n border: 0 none;\n border-collapse: collapse;\n border-spacing: 0;\n margin-top: 10px;\n width: 100%; }\n\n.z_hppm_field_label_cell {\n font-size: 1.1em;\n text-align: right;\n vertical-align: middle;\n width: 48%;\n padding: 0 1%;\n border: 0;\n display: block;\n float: left; }\n\n.z_hppm_field_value_cell {\n vertical-align: middle;\n border: 0;\n padding: 0 1%;\n display: block;\n float: left; }\n\n.z_hppm_input_cardSecurityCode {\n width: 50px; }\n\n.z_hppm_radio_input {\n padding: 2px;\n vertical-align: middle;\n font-size: inherit; }\n\n.z_hppm_input_creditCardType {\n float: left; }\n\n\x2F*\n * We need to reset this stupidity, they used a SPAN. A SPAN!\n *\x2F\n.z_hppm_field_value_cell_creditCardType .z_hppm_image {\n margin: 0;\n display: block;\n float: left;\n height: 20px;\n width: 40px; }\n\n\x2F**\n * Stupid trick, remove the dumb \"select\" from the options.\n *\x2F\n#z_hppm_option_text_creditCardExpirationMonth_0, #z_hppm_option_text_creditCardExpirationYear_0 {\n display: none; }\n\n.z_hppm_input_creditCardHolderName {\n width: 300px; }\n\n.z_hppm_input_creditCardState, .z_hppm_input_creditCardPostalCode {\n width: 100px; }\n\n.z_hppm_field_info_cell {\n color: #666666;\n display: block;\n float: left;\n width: 100%;\n text-indent: 51%;\n text-align: left; }\n .z_hppm_field_info_cell:before {\n content: \" \"; }\n\n#z_hppm_field_info_cell_creditCardExpirationMonth {\n text-indent: 52%; }\n #z_hppm_field_info_cell_creditCardExpirationMonth:before {\n content: \"month \x2F year\"; }\n\n#z_hppm_field_info_cell_creditCardAddress1:before {\n content: \"line 1\"; }\n\n#z_hppm_field_info_cell_creditCardAddress2:before {\n content: \"line 2 (optional)\"; }\n\n.z_hppm_field_label_cell_creditCardAddress2 {\n visibility: hidden; }\n\n.z_hppm_image_MasterCard {\n background-image: url(\"https:\x2F\x2Fgo.sandbox.globuscs.info\x2Fimage\x2Flogo_cc_20_mastercard.png\");\n background-position: -10px center; }\n\n.z_hppm_image_Visa {\n background-image: url(\"https:\x2F\x2Fgo.sandbox.globuscs.info\x2Fimage\x2Flogo_cc_20_visa.png\");\n background-position: -5px center; }\n\n.z_hppm_image_AmericanExpress {\n background-image: url(\"https:\x2F\x2Fgo.sandbox.globuscs.info\x2Fimage\x2Flogo_cc_20_amex.png\");\n background-position: -5px center; }\n\n.z_hppm_image_Discover {\n background-image: url(\"https:\x2F\x2Fgo.sandbox.globuscs.info\x2Fimage\x2Flogo_cc_20_discover.png\");\n background-position: -10px center; }\n\n.z_hppm_field_value_cell_cardSecurityCode div {\n width: 100px; }\n\n.z_hppm_field_row {\n padding: 5px 0;\n display: block;\n width: 100%;\n clear: both; }\n" | |
var label_text = ["Card Type", "Card Number", "Expiration Date", | |
"Security Code", "Name on Card", "Country", "Address", | |
"A", "City", "State/Province", "Postal Code", | |
"Contact Phone Number", "Email Address"] | |
var check_vals = [false, false, true, true, true, true, true, true, true, | |
true, true, true, true, true, true, true, true, false, | |
true, true, true, true, true, true, false, false, false, | |
false]; | |
$('input[type=checkbox]').each(function(n, el){$(el).prop("checked", check_vals[n])}); | |
$('input[id$=_label]').each(function(n, el){$(el).val(label_text[n])}); | |
$('textarea[name="css"]').val(css_data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment