diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index fea2e07e..a6aedf09 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -197,6 +197,9 @@ class PaymentController extends Controller 'status' => $response->result->status, 'amount' => $paypalProduct->quantity, 'price' => $paypalProduct->price, + 'tax_value' => $this->getTaxValue($paypalProduct), + 'tax_percent' => $this->getTaxPercent(), + 'total_price' => $this->getTotalPrice($paypalProduct), 'currency_code' => $paypalProduct->currency_code, 'payer' => json_encode($response->result->payer), ]); @@ -235,7 +238,7 @@ class PaymentController extends Controller */ public function cancel(Request $request) { - return redirect()->route('store.index')->with('success', 'Payment was Cannceled'); + return redirect()->route('store.index')->with('success', 'Payment was Canceled'); } @@ -254,6 +257,7 @@ class PaymentController extends Controller ->editColumn('price', function (Payment $payment) { return $payment->formatCurrency(); }) + ->editColumn('created_at', function (Payment $payment) { return $payment->created_at ? $payment->created_at->diffForHumans() : ''; }) diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 85bb4b0d..6646327e 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -29,6 +29,9 @@ class Payment extends Model 'type', 'amount', 'price', + 'tax_value', + 'total_price', + 'tax_percent', 'currency_code', ]; diff --git a/database/migrations/2021_11_05_071456_add_tax_to_paymentlogs.php b/database/migrations/2021_11_05_071456_add_tax_to_paymentlogs.php new file mode 100644 index 00000000..3796ee9e --- /dev/null +++ b/database/migrations/2021_11_05_071456_add_tax_to_paymentlogs.php @@ -0,0 +1,36 @@ +decimal('tax_value',8,2)->after('price')->nullable(); + $table->integer('tax_percent')->after('tax_value')->nullable(); + $table->decimal('total_price',8,2)->after('tax_percent')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('payments', function (Blueprint $table) { + $table->dropColumn('tax_value'); + $table->dropColumn('tax_percent'); + $table->dropColumn('total_price'); + }); + } +} diff --git a/resources/views/admin/payments/index.blade.php b/resources/views/admin/payments/index.blade.php index d22b2788..b6765901 100644 --- a/resources/views/admin/payments/index.blade.php +++ b/resources/views/admin/payments/index.blade.php @@ -37,7 +37,10 @@