EVERYTHING WORKING - Safing

This commit is contained in:
WBLKLeipe 2021-11-05 08:45:29 +01:00
parent c69c28bd89
commit 93d8dfcf0b
4 changed files with 51 additions and 2 deletions

View file

@ -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() : '';
})

View file

@ -29,6 +29,9 @@ class Payment extends Model
'type',
'amount',
'price',
'tax_value',
'total_price',
'tax_percent',
'currency_code',
];

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTaxToPaymentlogs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('payments', function (Blueprint $table) {
$table->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');
});
}
}

View file

@ -37,7 +37,10 @@
<th>User</th>
<th>Type</th>
<th>Amount</th>
<th>Price</th>
<th>Product Price</th>
<th>Tax</th>
<th>Tax(%)</th>
<th>Total Price</th>
<th>Payment_ID</th>
<th>Payer_ID</th>
<th>Created at</th>
@ -68,6 +71,9 @@
{data: 'type'},
{data: 'amount'},
{data: 'price'},
{data: 'tax_value'},
{data: 'tax_percent'},
{data: 'total_price'},
{data: 'payment_id'},
{data: 'payer_id'},
{data: 'created_at'},