1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Support affiliate partners

This commit is contained in:
Hillel Coren 2017-08-14 17:51:29 +03:00
parent 274bda8fa7
commit e197870775

View File

@ -40,18 +40,20 @@ class AccountRepository
$company->utm_content = Input::get('utm_content');
$company->referral_code = Session::get(SESSION_REFERRAL_CODE);
if (env('PROMO_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PROMO_CAMPAIGN'))) {
$company->discount = .75;
$company->promo_expires = date_create()->modify('14 days')->format('Y-m-d');
}
if (Input::get('utm_campaign')) {
if (env('PROMO_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PROMO_CAMPAIGN'))) {
$company->discount = .75;
$company->promo_expires = date_create()->modify('14 days')->format('Y-m-d');
}
if (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
$company->plan = PLAN_PRO;
$company->plan_term = PLAN_TERM_YEARLY;
$company->plan_price = PLAN_PRICE_PRO_MONTHLY;
$company->plan_started = date_create()->format('Y-m-d');
$company->plan_paid = date_create()->format('Y-m-d');
$company->plan_expires = date_create()->modify('1 year')->format('Y-m-d');
if (env('PARTNER_CAMPAIGN') && hash_equals(Input::get('utm_campaign'), env('PARTNER_CAMPAIGN'))) {
$company->plan = PLAN_PRO;
$company->plan_term = PLAN_TERM_YEARLY;
$company->plan_price = PLAN_PRICE_PRO_MONTHLY;
$company->plan_started = date_create()->format('Y-m-d');
$company->plan_paid = date_create()->format('Y-m-d');
$company->plan_expires = date_create()->modify('1 year')->format('Y-m-d');
}
}
$company->save();