Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Http/Controllers/Controller.php
Назад
<?php namespace App\Http\Controllers; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; use Illuminate\Http\Request; use Illuminate\Support\Facades\Mail; use App\Mail\MyMail; use App\Models\Setting; use App\Repositories\LeaseRepository; class Controller extends BaseController { use AuthorizesRequests, ValidatesRequests; private $secret; public function __construct() { $this->secret = config('constants.stripe.secret_key'); \Stripe\Stripe::setApiKey($this->secret); } public function testingRoute(Request $request){ // $data['fullname']= 'hm'; // $data['firstname']= 'Hammad'; // $data['lastname']= 'Moiz'; // $data['email']= 'hm@yoyo.com'; // $data['code']= 'hm'; // $data['phone_number']= '+56789'; // $data['message']= 'this is message'; // $check = Mail::to("hassan_mateen@yopmail.com")->send(new MyMail($data)); dd($request->code); // $user = auth()->user(); // $methods = $user->paymentMethods(); // // $subscription = $user->subscription('test_package')->cancel(); // $subscription = $user->newSubscription('test_package', 'price_1OOxnHLkh9gjNb7JWdGX6TL4')->create($methods[0]->id); // dd($check); // return view('auth.passwords.email'); } public function getAndStoreCode(Request $request){ try { //code... \Log::info('Hey its been hitting'); $code = $request->code; $match_this = ['user_id' => 1, 'setting_key' => config('constants.docusign.docu_sign_code_key')]; $update = Setting::updateOrCreate($match_this,['setting_value'=> $code]); $LeaeRepo = new LeaseRepository(); $flag = $LeaeRepo->callback($code); if($flag){ $doc_id = \Session::get('doc_id'); return redirect()->route('landlord.lease.sent', ['doc_id' => $doc_id]); } \Log::info('Docusign Succesfully Connected'); return response()->json([ 'code' => 200, 'message' => $flag, ],200); } catch (\Throwable $th) { \Log::info('Docusign Error in Connection Error: '.$th->getMessage().' ON LINE: '.$th->getLine(),[$th]); return response()->json([ 'code' => 500, 'message' => $th->getMessage(), 'line' => $th->getLine(), ],500); } } public function createCustomer(Request $request){ try { // Use Stripe's library to make requests... $customer = \Stripe\Customer::create([ 'email' => 'abc@abc.com', //customer email 'name' => "John Doe", //customer name 'phone' => "+12345678", //customer phone 'description' => 'My test customer', ]); // make sure to save customer id in database ($customer->id) return $response->json(['customer'=>$customer],200); } catch (\Stripe\Exception\CardException $e) { return $response->json(['error'=>$e->getError()->message],$e->getHttpStatus()); } catch (\Stripe\Exception\RateLimitException $e) { // Too many requests made to the API too quickly return $response->json(['error'=>'Too Many requests made'],$e->getHttpStatus()); } catch (\Stripe\Exception\InvalidRequestException $e) { // Invalid parameters were supplied to Stripe's API return $response->json(['error'=>'Invalid params'],$e->getHttpStatus()); } catch (\Stripe\Exception\AuthenticationException $e) { // Authentication with Stripe's API failed // (maybe you changed API keys recently) return $response->json(['error'=>'Stripe Authentication failed'],$e->getHttpStatus()); } catch (\Stripe\Exception\ApiConnectionException $e) { // Network communication with Stripe failed return $response->json(['error'=>'Network communication error'],$e->getHttpStatus()); } catch (\Stripe\Exception\ApiErrorException $e) { // Display a very generic error to the user, and maybe send yourself an email return $response->json(['error'=>$e->getError()->message],$e->getHttpStatus()); } catch (\Exception $e) { // Something else happened, completely unrelated to Stripe return $response->json(['error'=>$e->getMessage()],500); } } public function createSetupIntent(){ // retruve customer stripe id from database first $customer = Customer::where('id',112223)->first(); $intent = \Stripe\SetupIntent::create([ 'payment_method_types' => ['us_bank_account'], 'customer' => $customer->stripe_customer_id, ]); // save setup intent id in database as well for recurring future //payments $customer->updte([ 'setup_intent_id' => $intent->id ]); return $response->json(['token'=>$intent->client_secret],200); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка