public function run() { DB::table('payments')->delete(); //$user = \App\User::where('email','=','*****@*****.**')->first(); $affiliate = \App\Affiliate::where('id', '>', 0)->first(); \App\Payment::create(['affiliate_id' => $affiliate->id, 'payment_key' => 'AB029309', 'amount' => 1.0, 'pay_result' => '{}', 'ipn_result' => '', 'status' => 1]); }
/** * Process the PaymentWall payment * * @param Request $request */ public function getPaymentWall(Request $request) { $pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']); if ($pingback->validate()) { $virtualCurrency = $pingback->getVirtualCurrencyAmount(); $user = User::find($request->uid); if (settings('paymentwall_double')) { $n_credits = $virtualCurrency * 2; } else { $n_credits = $virtualCurrency; } if ($pingback->isDeliverable()) { // Give credits to user $user->money = $user->money + $n_credits; $user->save(); Payment::create(['user_id' => $user->ID, 'transaction_id' => $request->ref, 'amount' => $n_credits]); } elseif ($pingback->isCancelable()) { // Remove credits from user $user->money = $user->money + $n_credits; $user->save(); $payment = Payment::find($request->ref); $payment->delete(); } echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent } else { echo $pingback->getErrorSummary(); } }
public function postNewCustomer(NewCustomerRequest $request, Customer $customer, CustomerProfile $profile, Payment $payment) { $this->customer = $customer->create(['firstname' => Str::title($request->input('firstname')), 'lastname' => Str::title($request->input('lastname')), 'email' => Str::lower($request->input('email')), 'phone' => $request->input('phone')]); if ($this->customer) { $dob = explode('/', $request->input('dob')); $dob_piece = [$dob[2], $dob[1], $dob[0]]; $this->profile = $profile->create(['customer_id' => $this->customer->id, 'dob' => implode('-', $dob_piece), 'gender_id' => $request->input('gender'), 'state_id' => $request->input('state_of_origin'), 'hostel_address' => $request->input('hostel_address'), 'guardian_name' => Str::words($request->input('guardian_name')), 'guardian_phone' => $request->input('guardian_phone'), 'guardian_address' => $request->input('guardian_address')]); // Add Payment Balance $this->payment = $payment->create(['customer_id' => $this->customer->id, 'start_balance' => empty($request->input('account_balance')) ? 0 : $request->input('account_balance'), 'account_balance' => empty($request->input('account_balance')) ? 0 : $request->input('account_balance')]); // Generate THC Code $thc_code = thcFormater($this->customer->id); // Generate QR Code generateQRCode($thc_code); // Add Customer THC generated code $customer->whereId($this->customer->id)->update(['thc' => $thc_code, 'qrcode' => '/customers/qrcodes/' . $thc_code . '.png']); if ($this->profile) { flash()->success('Customer Added Successfully!'); } else { flash()->error('An error occurred, try adding the Customer again!'); } } else { flash()->error('An error occurred, try adding the Customer again!'); } return redirect()->route('customer.list'); }
/** * Handles a payment. * * @param App/Http/Requests/DonationRequest $request * @return Response */ public function postIndex(DonationRequest $request) { $errors = []; $fakeUser = false; $user = $this->user; $input = Input::all(); // Build our \App\Payment model. $payment = ['customer' => $user->user_id, 'attribution' => $input['attribution'], 'ip' => $request->getClientIp(), 'amount' => $input['amount'] * 100, 'currency' => "usd", 'subscription' => NULL]; // Handle input depending on the type of payment. // Stripe does subscriptions and charges differently. switch ($input['payment']) { case "once": $tx = ['description' => "Infinity Next Dev", 'source' => $input['stripeToken'], 'receipt_email' => $input['email']]; $receipt = $user->charge($payment['amount'], $tx); break; case "monthly": $tx = ['description' => "Infinity Next Dev", 'source' => $input['stripeToken'], 'email' => $input['email']]; $receipt = $user->subscription("monthly-{$input['amount']}")->create($input['stripeToken'], $tx); $payment['subscription'] = "monthly-{$input['amount']}"; break; } if ($receipt !== false) { // Record our payment. // This stores no identifying information, // besides an optional user ID. Payment::create($payment)->save(); } else { $errors[] = "Your card failed to process and has not been charged."; } if ($request->ajax()) { return response()->json(['amount' => count($errors) ? false : "\$" . $payment['amount'] / 100, 'errors' => $errors]); } else { return $this->view(static::VIEW_DONATE); } }
/** * Run the database seeds. * * @return void */ public function run() { Payment::create(['description_es' => 'Efectivo', 'description_en' => 'Cash']); Payment::create(['description_es' => 'Cargado a la habitación', 'description_en' => 'Charged to room']); Payment::create(['description_es' => 'Tarjeta', 'description_en' => 'Credit Card']); Payment::create(['description_es' => 'Convenio con Empresa', 'description_en' => 'Company Agreement']); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Apartment $apartment, Lease $lease, Request $request) { // $this->validate($request, ['amount' => 'required | numeric']); $input = $request->all(); $input['paid_date'] = Carbon::parse($input['paid_date']); $payment = Payment::create($input); PaymentAllocation::create(['amount' => $input['amount'], 'month' => Carbon::parse($input['paid_date'])->month, 'year' => Carbon::parse($input['paid_date'])->year, 'payment_id' => $payment->id]); return redirect()->route('apartments.lease.show', ['name' => $lease->apartment->name, 'id' => $lease->id]); }
public function store(PaymentRequest $request) { Payment::create($request->all()); /*$expense = Expense::latest()->first(); $project = Project::find($expense->project_id); \Session::flash('flash_message', 'Expense for $' . $expense->amount_paid . ' was added for ' . $project->project_name . ' project.'); */ return redirect('expenses'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $validator = Validator::make($request->all(), ['payment_name' => 'required|unique:payments']); if ($validator->fails()) { return redirect('payment/create')->withErrors($validator)->withInput(); } $input = $request->all(); Payment::create($input); Session::flash('message', 'Data successfully added'); return redirect('payment'); }
/** * Run the database seeds. * * @return void */ public function run() { $user = User::create(['username' => 'admin', 'email' => '*****@*****.**', 'password' => bcrypt('admin')]); $user->isAdmin = 1; $user->save(); \File::makeDirectory(public_path() . "/content/admin"); \File::makeDirectory(public_path() . "/content/admin/photos/"); $dest = public_path() . "/content/admin/photos/profile.png"; $file = public_path() . "/img/profile.png"; \File::copy($file, $dest); UserInfo::create(["user_id" => $user->id, "photo" => "/content/admin/photos/profile.png"]); //init Payment Payment::create(['stripe_publishable_key' => '', 'stripe_secret_key' => '', 'paypal_client_id' => '', 'paypal_secret' => '']); }
/** * Process the PayPal payment * * @param Request $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function postPayPalComplete(Request $request) { $complete = $this->gateway->completePurchase(['transactionReference' => $request->paymentId, 'payerId' => $request->PayerID]); $response = $complete->send(); $data = $response->getData(); if ($data['state'] === 'approved') { $user = UserInfo::find(Auth::user()->username); $amount = round($data['transactions'][0]['amount']['total']); $payment_amount = settings('paypal_double') ? $amount * settings('paypal_per') * 2 : $amount * settings('paypal_per'); Payment::create(['user_id' => Auth::user()->id, 'transaction_id' => $data['id'], 'amount' => $amount]); $user->pvalues = $user->pvalues + $payment_amount; $user->save(); } flash()->success(trans('donate.paypal.success')); return redirect('donate'); }
/** * @param Request $request * * @return $this|\Illuminate\View\View */ public function pay_reserve_booking_now(Request $request) { $booking = Booking::find($request->booking_id); $trip = Trip::find($booking->trip_id); $trip_id = $trip->id; $passengers = 1; $travel_company_id = $trip->travel_company_id; if ($request->has('cashcard_code')) { $code = strtoupper($request->cashcard_code); if ($this->cashCard->checkIfCashCardCodeIsValid($code, $trip->id, $passengers)) { $status = "paid"; $booking->status = $status; $booking->ticket_number = rand() . time(); $booking->save(); Payment::create(['trip_id' => $booking->trip->id, 'amount' => $booking->trip->fare, 'user_id' => Auth::user()->get()->id, 'booking_id' => $booking->id, 'travel_company_id' => $travel_company_id]); $user = Auth::user()->get(); // $mail = view('mails.ticket')->render(); Session::put('r_b_c_data', $booking); Session::put('r_b_c_passengers', $passengers); Session::put('r_b_c_trip_id', $trip_id); // Mail::send('mails.new', ['user' => $user], function ($m) use ($user) { // $m->to($user->email, $user->name)->subject('Passenger name booking detail'); // }); return redirect()->route('reserved-trip-paid'); } else { return redirect()->back()->withErrors('There was a problem processing the payment'); } } elseif ($request->has('speedBanking_code')) { $code = $request->speed_banking_code; if ($this->cashCard->checkIfCashCardCodeIsValid($code, $trip->id, $passengers)) { dd('paying speedBanking'); $status = "paid"; // $this->insert($passengers, $request->all(), $user_id, $trip_id, $status); return view('payment.success'); } else { return redirect()->back()->withErrors('There was a problem processing the payment'); } } }
/** * Run the database seeds. * * @return void */ public function run() { \App\Payment::create(['title' => 'SEOcoin', 'icon' => 'https://static.webshopapp.com/assets/icon-payment-blank.png', 'price_incl' => 6.05, 'price_excl' => 5.0, 'tax_rate' => 0.21]); \App\Payment::create(['title' => 'iDeal', 'icon' => 'ideal', 'price_incl' => 2.42, 'price_excl' => 2.0, 'tax_rate' => 0.21]); \App\Payment::create(['title' => 'Mastercard', 'icon' => 'mastercard', 'price_incl' => 1.21, 'price_excl' => 1.0, 'tax_rate' => 0.21]); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); /** * academic institution */ factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) { Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]); $this->command->info('address done!'); Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]); $this->command->info('phone done!'); $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 1, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]); $this->command->info('institution done!'); AcademicMember::create(['id' => $institution->id, 'institution_type_id' => 2]); $this->command->info('academic done!'); $head = PaymentHead::getHead(1, 1)->first(); $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]); $this->command->info('payment done!' . $member->id); $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']); $this->command->info('narration done!'); Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]); $this->command->info('Journal done!'); RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]); $this->command->info('request done!'); }); /** * non academic institution */ factory(Member::class, 'institution', 5)->create()->each(function ($member) use($faker) { Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]); $this->command->info('address done!'); Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]); $this->command->info('phone done!'); $institution = Institution::create(['member_id' => $member->id, 'membership_type_id' => 2, 'salutation_id' => 1, 'name' => $faker->company, 'head_name' => $faker->name, 'head_designation' => $faker->word, 'email' => $faker->email, 'mobile' => 1234567890]); $this->command->info('institution done!'); $head = PaymentHead::getHead(9, 1)->first(); $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]); $this->command->info('payment done!' . $member->id); $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']); $this->command->info('narration done!'); Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]); $this->command->info('Journal done!'); RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]); $this->command->info('request done!'); }); /** * professional individual */ factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) { Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]); $this->command->info('address done!'); Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]); $this->command->info('phone done!'); $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 4, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]); $this->command->info('individual done!'); $professional = ProfessionalMember::create(['id' => $individual->id, 'organisation' => $faker->company, 'designation' => $faker->word]); $this->command->info('professional done!'); $head = PaymentHead::getHead(17, 1)->first(); $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]); $this->command->info('payment done!' . $member->id); $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']); $this->command->info('narration done!'); Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]); $this->command->info('Journal done!'); RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]); $this->command->info('request done!'); }); /** * academic individual */ factory(Member::class, 'individual', 5)->create()->each(function ($member) use($faker) { Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => 'IND', 'state_code' => CsiChapter::find($member->csi_chapter_id)->state->state_code, 'address_line_1' => $faker->streetAddress, 'city' => State::filterByStateCode(CsiChapter::find($member->csi_chapter_id)->state->state_code)->first()->name, 'pincode' => 110052]); $this->command->info('address done!'); Phone::create(['member_id' => $member->id, 'std_code' => 011, 'landline' => 47028209, 'country_code' => 91, 'mobile' => 1234567890]); $this->command->info('phone done!'); $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => 3, 'salutation_id' => $faker->randomElement(range(1, 5)), 'first_name' => $faker->firstName, 'middle_name' => $faker->word, 'last_name' => $faker->lastname, 'card_name' => $faker->name, 'gender' => $faker->randomElement(['m', 'f']), 'dob' => $faker->date('d/m/Y')]); $this->command->info('individual done!'); $student_details = StudentMember::create(['id' => $individual->id, 'student_branch_id' => 1, 'college_name' => $faker->company, 'course_name' => $faker->word, 'course_branch' => $faker->word, 'course_duration' => 3]); $this->command->info('student done!'); $head = PaymentHead::getHead(21, 1)->first(); $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]); $this->command->info('payment done!' . $member->id); $narration = Narration::create(['payer_id' => $member->id, 'mode' => 1, 'transaction_number' => str_random(12), 'bank' => 'sbi', 'branch' => 'kamla nagar', 'date_of_payment' => $faker->date('d/m/Y'), 'drafted_amount' => $head->amount, 'proof' => '6.jpg']); $this->command->info('narration done!'); Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id, 'paid_amount' => $head->amount]); $this->command->info('Journal done!'); RequestService::create(['service_id' => Service::getServiceIDByType('membership'), 'payment_id' => $payment->id, 'member_id' => $member->id]); $this->command->info('request done!'); }); }
public function postPaymentwall(Request $request) { /** * Pingback Listener Script * For Virtual Currency API * Copyright (c) 2010-2013 Paymentwall Team */ /** * Define your application-specific options */ define('SECRET', settings('paymentwall_key')); define('IP_WHITELIST_CHECK_ACTIVE', true); define('CREDIT_TYPE_CHARGEBACK', 2); /** * The IP addresses below are Paymentwall's * servers. Make sure your pingback script * accepts requests from these addresses ONLY. * */ $ipsWhitelist = array('174.36.92.186', '174.36.96.66', '174.36.92.187', '174.36.92.192', '174.37.14.28'); /** * Collect the GET parameters from the request URL */ $userId = isset($request->uid) ? $request->uid : null; $credits = isset($request->currency) ? $request->currency : null; $type = isset($request->type) ? $request->type : null; $refId = isset($request->ref) ? $request->ref : null; $signature = isset($request->sig) ? $request->sig : null; $sign_version = isset($request->sign_version) ? $request->sign_version : null; $result = false; /** * If there are any errors encountered, the script will list them * in an array. */ $errors = array(); if (!empty($userId) && !empty($credits) && isset($type) && !empty($refId) && !empty($signature)) { $signatureParams = array(); if (empty($sign_version) || $sign_version <= 1) { $signatureParams = array('uid' => $userId, 'currency' => $credits, 'type' => $type, 'ref' => $refId); } else { $signatureParams = array(); foreach ($_GET as $param => $value) { $signatureParams[$param] = $value; } unset($signatureParams['sig']); } /** * check if IP is in whitelist and if signature matches */ $signatureCalculated = $this->calculatePingbackSignature($signatureParams, SECRET, $sign_version); /** * Run the security check -- if the request's origin is one * of Paymentwall's servers, and if the signature matches * the parameters. */ if (!IP_WHITELIST_CHECK_ACTIVE || in_array($_SERVER['REMOTE_ADDR'], $ipsWhitelist)) { if ($signature == $signatureCalculated) { $result = true; $user = User::find($userId); if (settings('paymentwall_double')) { $n_credits = $credits * 2; } else { $n_credits = $credits; } if ($type == CREDIT_TYPE_CHARGEBACK) { /** * Deduct credits from user. Note that currency amount * sent for chargeback is negative, e.g. -5, so be * careful about the sign Don't deduct negative * number, otherwise user will gain credits instead * of losing them * */ // Remove credits from user $user->money = $user->money + $n_credits; $user->save(); $payment = Payment::find($refId); $payment->delete(); } else { // Give credits to user $user->money = $user->money + $n_credits; $user->save(); Payment::create(['user_id' => $user->ID, 'transaction_id' => $refId, 'amount' => $n_credits]); } } else { $errors['signature'] = 'Signature is not valid!'; } } else { $errors['whitelist'] = 'IP not in whitelist!'; } } else { $errors['params'] = 'Missing parameters!'; } /** * Always make sure to echo OK so Paymentwall * will know that the transaction is successful. */ if ($result) { echo 'OK'; } else { echo implode(' ', $errors); } }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { $payment = Payment::create($request->all()); return redirect()->route('payment.index'); }
/** * @param $booking * @param $travel_company_id */ private function make_payment($booking, $travel_company_id) { Payment::create(['trip_id' => $booking->trip->id, 'amount' => $booking->trip->fare, 'user_id' => Auth::user()->get()->id, 'booking_id' => $booking->id, 'travel_company_id' => $travel_company_id]); }
/** * Handles a payment. * * @param App/Http/Requests/DonationRequest $request * @return Response */ public function postIndex(DonationRequest $request) { $errors = []; $fakeUser = false; $user = $this->user; $input = Input::all(); // Build our \App\Payment model. $payment = ['customer' => $user->user_id, 'attribution' => $input['attribution'], 'payment_ip' => $request->getClientIp(), 'amount' => $input['amount'] * 100, 'currency' => "usd", 'subscription' => NULL]; // Handle input depending on the type of payment. // Stripe does subscriptions and charges differently. switch ($input['payment']) { case "once": /* Stripe $tx = [ 'description' => "Infinity Next Dev", 'source' => $input['nonce'], 'receipt_email' => $input['email'], ]; */ $tx = ['amount' => $payment['amount'] / 100, 'paymentMethodNonce' => $input['nonce'], 'options' => ['submitForSettlement' => true]]; $receipt = $user->charge($payment['amount'], $tx); break; /* case "monthly": Stripe $tx = [ 'description' => "Infinity Next Dev", 'source' => $input['nonce'], 'email' => $input['email'], ]; $receipt = $user->subscription("monthly-{$input['amount']}")->create($input['nonce'], $tx); $tx = [ 'paymentMethodNonce' => $input['nonce'], 'email' => $input['email'], ]; $receipt = $user->subscription("monthly-{$input['amount']}")->create($input['nonce'], $tx); $payment['subscription'] = "monthly-{$input['amount']}"; break; */ } if ($receipt instanceof \Braintree_Result_Error) { $errors[] = $receipt->message; $receipt = false; } if ($receipt !== false) { if (env('APP_DEBUG') === false || env('APP_ENV', 'local') !== "production") { // Record our payment. // This stores no identifying information, // besides an optional user ID. Payment::create($payment)->save(); } } else { $errors[] = "Your card failed to process and has not been charged."; } if ($request->ajax()) { return response()->json(['amount' => count($errors) ? false : "\$" . $payment['amount'] / 100, 'errors' => $errors]); } else { return $this->view(static::VIEW_DONATE); } }
public function createPayment(Request $request) { $Payment = Payment::create($request->all()); return response()->json($Payment); }
private function storeStudentIndividual() { $var = DB::transaction(function ($connection) { $membership_period = Input::get('membership-period'); $salutation = Input::get('salutation'); $fname = Input::get('fname'); $mname = Input::get('mname'); $lname = Input::get('lname'); $card_name = Input::get('card_name'); $dob = Input::get('dob'); $gender = Input::get('gender'); $country = Input::get('country'); $state = Input::get('state'); $address = Input::get('address'); $city = Input::get('city'); $pincode = Input::get('pincode'); $stud_branch = Input::get('stud_branch'); $college = Input::get('college'); $course = Input::get('course'); $cbranch = Input::get('cbranch'); $cduration = Input::get('cduration'); $email1 = Input::get('email1'); $email2 = Input::get('email2'); $std = Input::get('std'); $phone = Input::get('phone'); $country_code = Input::get('country-code'); $mobile = Input::get('mobile'); $paymentMode = Input::get('paymentMode'); $tno = Input::get('tno'); $drawn = Input::get('drawn'); $bank = Input::get('bank'); $branch = Input::get('branch'); $paymentReciept = Input::file('paymentReciept'); $amountPaid = Input::get('amountPaid'); $student_branch = AcademicMember::Where('is_student_branch', $stud_branch)->first(); $chapter = $student_branch->institution->member->csi_chapter_id; $member = new Member(); $member->membership_id = 2; // individual member $membership_type = 3; // student member $member->csi_chapter_id = $chapter; $member->email = $email1; $member->email_extra = $email2; $member->password = bcrypt('1234'); $member->save(); $member->id; $filename = $member->id . '.'; $filename .= $paymentReciept->getClientOriginalExtension(); Address::create(['type_id' => 1, 'member_id' => $member->id, 'country_code' => $country, 'state_code' => $state, 'address_line_1' => $address, 'city' => $city, 'pincode' => $pincode]); Phone::create(['member_id' => $member->id, 'std_code' => $std, 'landline' => $phone, 'country_code' => $country_code, 'mobile' => $mobile]); $paymentReciept->move(storage_path('uploads/payment_proofs'), $filename); $individual = Individual::create(['member_id' => $member->id, 'membership_type_id' => $membership_type, 'salutation_id' => $salutation, 'first_name' => $fname, 'middle_name' => $mname, 'last_name' => $lname, 'card_name' => $card_name, 'gender' => $gender, 'dob' => $dob]); $student_details = StudentMember::create(['id' => $individual->id, 'student_branch_id' => $student_branch->id, 'college_name' => $college, 'course_name' => $course, 'course_branch' => $cbranch, 'course_duration' => $cduration]); // 2nd arg is currency.. needs to be queried to put here $head = PaymentHead::getHead($membership_period, 1)->first(); $payment = Payment::create(['paid_for' => $member->id, 'payment_head_id' => $head->id, 'service_id' => 1]); $narration = Narration::create(['payer_id' => $member->id, 'mode' => $paymentMode, 'transaction_number' => $tno, 'bank' => $bank, 'branch' => $branch, 'date_of_payment' => $drawn, 'drafted_amount' => $head->amount, 'paid_amount' => $amountPaid, 'proof' => $filename]); $journal = Journal::create(['payment_id' => $payment->id, 'narration_id' => $narration->id]); if (!is_null($member->id) && $member->id > 0) { $user = $member; } return $member; }); return $var; }
/** * Creates and returns a new Payment. * * @return App\Payment */ private function createPayment() { return App\Payment::create(['metatype_id' => $this->getMetaType()['id'], 'due_date' => \Carbon\Carbon::now()->format('d/m/Y'), 'value' => $this->faker->randomFloat(2, 0.01, 99999999999.99001), 'paid_date' => \Carbon\Carbon::now()->format('d/m/Y'), 'description' => $this->faker->paragraph(3)]); }
public function pay($bank_id, Request $request) { $user_id = $request->input('o_uid'); $amount = $request->input('o_amount') / 100; $item_id = $request->input('o_tid'); $result_code = $request->input('result_code'); $trx_id = $request->input('trx_id'); if ($result_code == 1 and $user_id > 0) { Payment::create(['user_id' => $user_id, 'item_id' => $item_id, 'transaction_id' => $trx_id, 'amount' => $amount, 'status' => 1, 'currency' => 'GEL']); return Response::view('admin.billings.payment.register', compact('bank_id', 'user_id', 'amount', 'item_id', 'result_code', 'trx_id'))->header('Content-Type', 'text/xml'); } elseif ($user_id && $item_id && $trx_id && $amount) { Payment::create(['user_id' => $user_id, 'item_id' => $item_id, 'transaction_id' => $trx_id, 'amount' => $amount, 'status' => 0, 'currency' => 'GEL']); return Response::view('admin.billings.payment.register', compact('bank_id', 'user_id', 'amount', 'item_id', 'result_code', 'trx_id'))->header('Content-Type', 'text/xml'); } else { return Response::view('admin.billings.payment.register')->header('Content-Type', 'text/xml'); } }