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)
|
||||
{
|
||||
$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');
|
||||
|
||||
$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');
|
||||
$checkoutId = config('services.north.checkout_id');
|
||||
$profileId = config('services.north.profile_id');
|
||||
@@ -56,6 +64,7 @@ class NorthCheckoutController extends Controller
|
||||
'checkoutId' => $checkoutId,
|
||||
'profileId' => $profileId,
|
||||
'amount' => (float)$total_cost,
|
||||
'products' => $products,
|
||||
]);
|
||||
|
||||
if ($response->failed()) {
|
||||
|
||||
Reference in New Issue
Block a user