mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 02:14:29 -04:00
Fix white label purchases with PayPal
This commit is contained in:
parent
a6c100eb47
commit
701f6c3851
@ -7,6 +7,7 @@ use App\Models\Country;
|
||||
use App\Models\License;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
use App\Ninja\Repositories\AccountRepository;
|
||||
use App\Libraries\CurlUtils;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use CreditCard;
|
||||
@ -290,4 +291,31 @@ class NinjaController extends BaseController
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
public function purchaseWhiteLabel()
|
||||
{
|
||||
if (Utils::isNinja()) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
$url = NINJA_APP_URL . '/buy_now';
|
||||
$contactKey = $user->primaryAccount()->account_key;
|
||||
|
||||
$data = [
|
||||
'account_key' => NINJA_LICENSE_ACCOUNT_KEY,
|
||||
'contact_key' => $contactKey,
|
||||
'product_id' => PRODUCT_WHITE_LABEL,
|
||||
'first_name' => Auth::user()->first_name,
|
||||
'last_name' => Auth::user()->last_name,
|
||||
'email' => Auth::user()->email,
|
||||
'return_link' => true,
|
||||
];
|
||||
|
||||
if ($url = CurlUtils::post($url, $data)) {
|
||||
return redirect($url);
|
||||
} else {
|
||||
return redirect()->back()->withError(trans('texts.error_refresh_page'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class VerifyCsrfToken extends BaseVerifier
|
||||
'hook/email_bounced',
|
||||
'reseller_stats',
|
||||
'payment_hook/*',
|
||||
'buy_now/*',
|
||||
'buy_now*',
|
||||
'hook/bot/*',
|
||||
];
|
||||
|
||||
|
@ -235,7 +235,9 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
|
||||
Route::post('bluevine/signup', 'BlueVineController@signup');
|
||||
Route::get('bluevine/hide_message', 'BlueVineController@hideMessage');
|
||||
Route::get('bluevine/completed', 'BlueVineController@handleCompleted');
|
||||
|
||||
Route::get('white_label/hide_message', 'NinjaController@hideWhiteLabelMessage');
|
||||
Route::get('white_label/purchase', 'NinjaController@purchaseWhiteLabel');
|
||||
|
||||
Route::get('reports', 'ReportController@showReports');
|
||||
Route::post('reports', 'ReportController@showReports');
|
||||
|
@ -93,7 +93,11 @@
|
||||
}
|
||||
|
||||
function buyProduct(affiliateKey, productId) {
|
||||
window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/buy_now/?account_key={{ NINJA_LICENSE_ACCOUNT_KEY }}&product_id=' + productId + '&contact_key={{ Auth::user()->primaryAccount()->account_key }}' + '&redirect_url=' + window.location.href);
|
||||
|
||||
location.href = "{{ url('white_label/purchase') }}";
|
||||
|
||||
//window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/buy_now/?account_key={{ NINJA_LICENSE_ACCOUNT_KEY }}&product_id=' + productId + '&contact_key={{ Auth::user()->primaryAccount()->account_key }}' + '&redirect_url=' + window.location.href);
|
||||
|
||||
/*
|
||||
var url = '{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/buy_now/';
|
||||
$.ajax({
|
||||
|
Loading…
x
Reference in New Issue
Block a user