{{ title }}
+{{ card_desc }}
+diff --git a/app/app/urls.py b/app/app/urls.py
index 0a631605d01..a20b888ac9b 100644
--- a/app/app/urls.py
+++ b/app/app/urls.py
@@ -232,6 +232,11 @@
re_path(r'^youtube/?', retail.views.youtube, name='youtube'),
re_path(r'^web3/?', retail.views.web3, name='web3'),
+ # increase funding limit
+ re_path(r'^requestincrease/?',
+ retail.views.increase_funding_limit_request,
+ name='increase_funding_limit_request'),
+
# link shortener
url(r'^l/(.*)$/?', linkshortener.views.linkredirect, name='redirect'),
url(r'^credit/(.*)$/?', credits.views.credits, name='credit'),
diff --git a/app/assets/v2/js/pages/increase_funding_limit_request_form.js b/app/assets/v2/js/pages/increase_funding_limit_request_form.js
new file mode 100644
index 00000000000..12dd8e32837
--- /dev/null
+++ b/app/assets/v2/js/pages/increase_funding_limit_request_form.js
@@ -0,0 +1,64 @@
+
+// Overwrite from shared.js
+// eslint-disable-next-line no-empty-function
+var trigger_form_hooks = function() {
+};
+
+$(document).ready(function() {
+ $('[for=id_comment]').append(
+ ' (500 ' + gettext('characters left') + ')'
+ );
+ $('[name=comment]').bind('input propertychange', function() {
+ this.value = this.value.replace(/ +(?= )/g, '');
+
+ if (this.value.length > 500) {
+ this.value = this.value.substring(0, 500);
+ }
+
+ $('#charcount').html(500 - this.value.length);
+ });
+
+ const form = $('#increase_request_form');
+
+ form.validate({
+ submitHandler: function(form) {
+ const inputElements = $(form).find(':input');
+ const formData = {};
+
+ inputElements.removeAttr('disabled');
+ $.each($(form).serializeArray(), function() {
+ formData[this.name] = this.value;
+ });
+
+ inputElements.attr('disabled', 'disabled');
+ loading_button($('.js-submit'));
+
+ const payload = JSON.stringify(formData);
+
+ $.post('/requestincrease', payload).then(
+ function(result) {
+ inputElements.removeAttr('disabled');
+ $('#requested_by').attr('disabled', 'disabled');
+ unloading_button($('.js-submit'));
+
+ $('#primary_form').hide();
+ $('#success_container').show();
+ }
+ ).fail(
+ function(result) {
+ inputElements.removeAttr('disabled');
+ $('#requested_by').attr('disabled', 'disabled');
+ unloading_button($('.js-submit'));
+
+ var alertMsg = result && result.responseJSON ? result.responseJSON.error : null;
+
+ if (alertMsg === null) {
+ alertMsg = gettext('Network error. Please reload the page and try again.');
+ }
+
+ _alert({ message: alertMsg }, 'error');
+ }
+ );
+ }
+ });
+});
diff --git a/app/dashboard/tip_views.py b/app/dashboard/tip_views.py
index f87b8ff3921..1ef33d506be 100644
--- a/app/dashboard/tip_views.py
+++ b/app/dashboard/tip_views.py
@@ -21,6 +21,7 @@
import json
import logging
+from django.conf import settings
from django.contrib import messages
from django.http import JsonResponse
from django.shortcuts import redirect
@@ -329,12 +330,21 @@ def send_tip_3(request):
if this_tip.value_in_usdt_now:
tips_last_week_value += this_tip.value_in_usdt_now
is_over_tip_weekly_limit = tips_last_week_value > request.user.profile.max_tip_amount_usdt_per_week
+
+ increase_funding_form_title = _('Request a Funding Limit Increasement')
+ increase_funding_form = f'{increase_funding_form_title}'
+
if is_over_tip_tx_limit:
response['status'] = 'error'
- response['message'] = _('This tip is over the per-transaction limit of $') + str(max_per_tip) + ('. Please try again later or contact support.')
+ response['message'] = _('This tip is over the per-transaction limit of $') +\
+ str(max_per_tip) + '. ' + increase_funding_form
elif is_over_tip_weekly_limit:
response['status'] = 'error'
- response['message'] = _('You are over the weekly tip send limit of $') + str(request.user.profile.max_tip_amount_usdt_per_week) + ('. Please try again later or contact support.')
+ response['message'] = _('You are over the weekly tip send limit of $') +\
+ str(request.user.profile.max_tip_amount_usdt_per_week) +\
+ '. ' + increase_funding_form
+
return JsonResponse(response)
diff --git a/app/marketing/mails.py b/app/marketing/mails.py
index 14fa94bf24f..6916d3e0507 100644
--- a/app/marketing/mails.py
+++ b/app/marketing/mails.py
@@ -759,3 +759,31 @@ def new_bounty_request(model):
)
finally:
translation.activate(cur_language)
+
+
+def new_funding_limit_increase_request(profile, cleaned_data):
+ to_email = 'founders@gitcoin.co'
+ from_email = profile.email or settings.SERVER_EMAIL
+ cur_language = translation.get_language()
+ usdt_per_tx = cleaned_data.get('usdt_per_tx', 0)
+ usdt_per_week = cleaned_data.get('usdt_per_week', 0)
+ comment = cleaned_data.get('comment', '')
+ accept_link = f'{settings.BASE_URL}requestincrease?'\
+ f'profile_pk={profile.pk}&'\
+ f'usdt_per_tx={usdt_per_tx}&'\
+ f'usdt_per_week={usdt_per_week}'
+
+ try:
+ setup_lang(to_email)
+ subject = _('New Funding Limit Increase Request')
+ body = f'New Funding Limit Request from {profile} ({profile.absolute_url}).\n\n'\
+ f'New Limit in USD per Transaction: {usdt_per_tx}\n'\
+ f'New Limit in USD per Week: {usdt_per_week}\n\n'\
+ f'To accept the Funding Limit, visit: {accept_link}\n'\
+ f'Administration Link: ({settings.BASE_URL}_administrationdashboard/profile/'\
+ f'{profile.pk}/change/#id_max_tip_amount_usdt_per_tx)\n\n'\
+ f'Comment:\n{comment}'
+
+ send_mail(from_email, to_email, subject, body, from_name=_("No Reply from Gitcoin.co"))
+ finally:
+ translation.activate(cur_language)
diff --git a/app/retail/forms.py b/app/retail/forms.py
new file mode 100644
index 00000000000..50356780463
--- /dev/null
+++ b/app/retail/forms.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+"""Define retail related forms.
+
+Copyright (C) 2018 Gitcoin Core
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see
{{ card_desc }}
+