forked from TFMM/silent-auction
feat: include products in checkout and increase form container size
This commit is contained in:
@@ -37,9 +37,17 @@ class NorthCheckoutController extends Controller
|
|||||||
public function createSession(Request $request, $bidder_id)
|
public function createSession(Request $request, $bidder_id)
|
||||||
{
|
{
|
||||||
$bidder = Bidders::findOrFail($bidder_id);
|
$bidder = Bidders::findOrFail($bidder_id);
|
||||||
$winnings = WinningBids::where('winning_bidder_num', $bidder->idbidders)->get();
|
$winnings = WinningBids::with('items')->where('winning_bidder_num', $bidder->idbidders)->get();
|
||||||
$total_cost = $winnings->sum('winning_cost');
|
$total_cost = $winnings->sum('winning_cost');
|
||||||
|
|
||||||
|
$products = $winnings->map(function($winning) {
|
||||||
|
return [
|
||||||
|
'name' => $winning->items->item_desc ?? 'Auction Item',
|
||||||
|
'price' => (float)$winning->winning_cost,
|
||||||
|
'quantity' => 1
|
||||||
|
];
|
||||||
|
})->toArray();
|
||||||
|
|
||||||
$apiKey = config('services.north.private_api_key');
|
$apiKey = config('services.north.private_api_key');
|
||||||
$checkoutId = config('services.north.checkout_id');
|
$checkoutId = config('services.north.checkout_id');
|
||||||
$profileId = config('services.north.profile_id');
|
$profileId = config('services.north.profile_id');
|
||||||
@@ -56,6 +64,7 @@ class NorthCheckoutController extends Controller
|
|||||||
'checkoutId' => $checkoutId,
|
'checkoutId' => $checkoutId,
|
||||||
'profileId' => $profileId,
|
'profileId' => $profileId,
|
||||||
'amount' => (float)$total_cost,
|
'amount' => (float)$total_cost,
|
||||||
|
'products' => $products,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($response->failed()) {
|
if ($response->failed()) {
|
||||||
|
|||||||
@@ -1,6 +1,19 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
<style>
|
||||||
|
#checkout-container {
|
||||||
|
min-height: 600px;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ensure the iframe inside the container takes full width */
|
||||||
|
#checkout-container iframe {
|
||||||
|
width: 100% !important;
|
||||||
|
min-height: 600px !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user