Open selfserve to all countries.

This commit is contained in:
Brian Simpson
2013-09-25 01:04:26 -04:00
parent f8f05b12aa
commit 8cf4eaea0e
5 changed files with 5 additions and 17 deletions

View File

@@ -311,7 +311,6 @@ tracking_secret = abcdefghijklmnopqrstuvwxyz0123456789
# (secure) payment domain
payment_domain = https://pay.reddit.local/
ad_domain = http://reddit.local
allowed_pay_countries = United States, United Kingdom, Canada
sponsors =
selfserve_support_email = selfservesupport@mydomain.com
MAX_CAMPAIGNS_PER_LINK = 100

View File

@@ -682,8 +682,7 @@ class PromoteController(ListingController):
edit=VBoolean("edit"),
address=ValidAddress(
["firstName", "lastName", "company", "address",
"city", "state", "zip", "country", "phoneNumber"],
allowed_countries=g.allowed_pay_countries),
"city", "state", "zip", "country", "phoneNumber"]),
creditcard=ValidCard(["cardNumber", "expirationDate",
"cardCode"]))
def POST_update_pay(self, form, jquery, link, campaign, customer_id, pay_id,

View File

@@ -183,7 +183,6 @@ class Globals(object):
'authorized_cnames',
'hardcache_categories',
's3_media_buckets',
'allowed_pay_countries',
'case_sensitive_domains',
'reserved_subdomains',
'TRAFFIC_LOG_HOSTS',

View File

@@ -1929,10 +1929,6 @@ class VDestination(Validator):
}
class ValidAddress(Validator):
def __init__(self, param, allowed_countries = ["United States"]):
self.allowed_countries = allowed_countries
Validator.__init__(self, param)
def set_error(self, msg, field):
Validator.set_error(self, errors.BAD_ADDRESS,
dict(message=msg), field = field)
@@ -1952,11 +1948,7 @@ class ValidAddress(Validator):
elif not zipCode:
self.set_error(_("please provide your zip or post code"), "zip")
elif not country:
self.set_error(_("please pick a country"), "country")
else:
country_name = g.countries.get(country)
if country_name not in self.allowed_countries:
self.set_error(_("Our ToS don't cover your country (yet). Sorry."), "country")
self.set_error(_("please provide your country"), "country")
# Make sure values don't exceed max length defined in the authorize.net
# xml schema: https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd
@@ -1968,6 +1960,7 @@ class ValidAddress(Validator):
(city, 40, 'city'),
(state, 40, 'state'),
(zipCode, 20, 'zip'),
(country, 60, 'country'),
(phoneNumber, 255, 'phoneNumber')
]
for (arg, max_length, form_field_name) in max_lengths:
@@ -1980,7 +1973,7 @@ class ValidAddress(Validator):
company = company or "",
address = address,
city = city, state = state,
zip = zipCode, country = country_name,
zip = zipCode, country = country,
phoneNumber = phoneNumber or "")
class ValidCard(Validator):

View File

@@ -154,14 +154,12 @@ ${unsafe(js.use('sponsored'))}
%elif field == "country":
## TODO: pycountry does country name i18n
<select name="${field}" ${disabled}>
%for code, country_name in g.countries.iteritems():
% if country_name in g.allowed_pay_countries:
%for code, country_name in sorted(g.countries.iteritems(), key=lambda t: t[1]):
<option value="${code}"
%if getattr(data, field, 'United States') == country_name:
selected="selected"
%endif
>${country_name}</option>
% endif
%endfor
</select>
%else: