Ejemplo n.º 1
0
 public function show_license_payment()
 {
     if (Input::has('return_url')) {
         Session::set('return_url', Input::get('return_url'));
     }
     if (Input::has('affiliate_key')) {
         if ($affiliate = Affiliate::where('affiliate_key', '=', Input::get('affiliate_key'))->first()) {
             Session::set('affiliate_id', $affiliate->id);
         }
     }
     if (!Session::get('affiliate_id')) {
         return Utils::fatalError();
     }
     if (Input::has('test_mode')) {
         Session::set('test_mode', Input::get('test_mode'));
     }
     $account = $this->accountRepo->getNinjaAccount();
     $account->load('account_gateways.gateway');
     $accountGateway = $account->account_gateways[0];
     $gateway = $accountGateway->gateway;
     $paymentLibrary = $gateway->paymentlibrary;
     $acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
     $affiliate = Affiliate::find(Session::get('affiliate_id'));
     $data = ['showBreadcrumbs' => false, 'hideHeader' => true, 'url' => 'license', 'amount' => LICENSE_PRICE, 'client' => false, 'contact' => false, 'paymentLibrary' => $paymentLibrary, 'gateway' => $gateway, 'acceptedCreditCardTypes' => $acceptedCreditCardTypes, 'countries' => Country::remember(DEFAULT_QUERY_CACHE)->orderBy('name')->get(), 'currencyId' => 1, 'paymentTitle' => $affiliate->payment_title, 'paymentSubtitle' => $affiliate->payment_subtitle];
     return View::make('payments.payment', $data);
 }
 public function doRegister()
 {
     $affiliate = Affiliate::where('affiliate_key', '=', SELF_HOST_AFFILIATE_KEY)->first();
     $license = new License();
     $license->first_name = Input::get('first_name');
     $license->last_name = Input::get('last_name');
     $license->email = Input::get('email');
     $license->transaction_reference = Request::getClientIp();
     $license->license_key = Utils::generateLicense();
     $license->affiliate_id = $affiliate->id;
     $license->product_id = PRODUCT_SELF_HOST;
     $license->is_claimed = 1;
     $license->save();
     return '';
 }