create payment table, update controller
This commit is contained in:
parent
d191e80d61
commit
52cdff8f6f
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Events;
|
||||||
|
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
|
use Illuminate\Broadcasting\PresenceChannel;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class CustomerGitAction
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new event instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the channels the event should broadcast on.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||||
|
*/
|
||||||
|
public function broadcastOn(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
new PrivateChannel('channel-name'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Listeners;
|
||||||
|
|
||||||
|
use App\Events\CustomerGitAction;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
|
||||||
|
class PullUpdateRepository
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the event listener.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*/
|
||||||
|
public function handle(CustomerGitAction $event): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,9 @@ class EventServiceProvider extends ServiceProvider
|
||||||
Registered::class => [
|
Registered::class => [
|
||||||
SendEmailVerificationNotification::class,
|
SendEmailVerificationNotification::class,
|
||||||
],
|
],
|
||||||
|
'App\Events\CustomerGitAction' => [
|
||||||
|
'App\Listeners\PullUpdateRepository',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
use App\Http\Controllers\PayPalController;
|
use App\Http\Controllers\PayPalController;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Pipeline;
|
||||||
|
use Symfony\Component\Process\Process;
|
||||||
|
use Symfony\Component\Process\Exception\ProcessFailedException;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Srmklive\PayPal\Services\PayPal as PayPalClient;
|
use Srmklive\PayPal\Services\PayPal as PayPalClient;
|
||||||
|
|
||||||
|
|
@ -16,33 +19,16 @@ use Srmklive\PayPal\Services\PayPal as PayPalClient;
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
Route::post('/git-hook', function(){
|
||||||
return $request->user();
|
$result = Process::fromShellCommandline('cd .. && dir');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result->mustRun();
|
||||||
|
|
||||||
|
$output = $result->getOutput();
|
||||||
|
return "<textarea>".$output."</textarea>";
|
||||||
|
} catch (ProcessFailedException $exception) {
|
||||||
|
return response()->json(['status' => 'Failed to execute Git pull command'], 500);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::post('create-payment', [PayPalController::class, 'index'])->name('payment.create');
|
|
||||||
Route::get('invoices', function () {
|
|
||||||
$provider = new PayPalClient;
|
|
||||||
$provider->setApiCredentials(config('paypal'));
|
|
||||||
$provider->getAccessToken();
|
|
||||||
|
|
||||||
$data = json_decode('{
|
|
||||||
"name": "Video Streaming Service",
|
|
||||||
"description": "Video streaming service",
|
|
||||||
"type": "SERVICE",
|
|
||||||
"category": "SOFTWARE",
|
|
||||||
"image_url": "https://example.com/streaming.jpg",
|
|
||||||
"home_url": "https://example.com/home"
|
|
||||||
}', true);
|
|
||||||
|
|
||||||
$product = $provider->setRequestHeader('PayPal-Request-Id', 'create-product-' . time())->createProduct($data);
|
|
||||||
|
|
||||||
$inv = $provider->showOrderDetails('0KX38537YL610435R');
|
|
||||||
// $invoice_no = $provider->generateInvoiceNumber();
|
|
||||||
|
|
||||||
dd(
|
|
||||||
$inv
|
|
||||||
);
|
|
||||||
})->name('payment.invoices');
|
|
||||||
|
|
||||||
Route::get('/paypal/payment', [PayPalController::class, 'payment'])->name('paypal.payment');
|
|
||||||
|
|
@ -29,6 +29,7 @@ Route::middleware('auth')->group(function () {
|
||||||
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
|
||||||
Route::group(['prefix' => 'paypal'], function () {
|
Route::group(['prefix' => 'paypal'], function () {
|
||||||
Route::get('/', [PayPalController::class, 'index'])->name('paypal');
|
Route::get('/', [PayPalController::class, 'index'])->name('paypal');
|
||||||
|
Route::get('/payment', [PayPalController::class, 'payment'])->name('paypal.payment');
|
||||||
Route::get('/payment/success', [PayPalController::class, 'paymentSuccess'])->name('paypal.payment.success');
|
Route::get('/payment/success', [PayPalController::class, 'paymentSuccess'])->name('paypal.payment.success');
|
||||||
Route::get('/payment/cancel', [PayPalController::class, 'paymentCancel'])->name('paypal.payment/cancel');
|
Route::get('/payment/cancel', [PayPalController::class, 'paymentCancel'])->name('paypal.payment/cancel');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue