fix: improve Google Pay handling with additional status checks, robust data extraction, and a fallback verification button
This commit is contained in:
@@ -133,8 +133,8 @@ class NorthCheckoutController extends Controller
|
||||
$status = $response->json();
|
||||
$currentStatus = $status['status'] ?? '';
|
||||
|
||||
// The North API status check might return Approved, completed, or success.
|
||||
$successStatuses = ['approved', 'completed', 'success'];
|
||||
// The North API status check might return Approved, completed, success, authorized, or captured.
|
||||
$successStatuses = ['approved', 'completed', 'success', 'authorized', 'captured'];
|
||||
|
||||
if (in_array(strtolower($currentStatus), $successStatuses)) {
|
||||
// Check if already checked out to avoid duplicates
|
||||
@@ -142,10 +142,19 @@ class NorthCheckoutController extends Controller
|
||||
|
||||
if (!$existingCheckout) {
|
||||
// According to docs, when status is Approved, transaction details are in 'body'
|
||||
// Digital wallets might have these at the top level
|
||||
$body = $status['body'] ?? [];
|
||||
$winnertotal = $status['amount'] ?? ($body['amount'] ?? WinningBids::where('winning_bidder_num', $bidder->idbidders)->sum('winning_cost'));
|
||||
$winnertotal = $status['amount'] ??
|
||||
($body['amount'] ??
|
||||
($status['amount_total'] ??
|
||||
WinningBids::where('winning_bidder_num', $bidder->idbidders)->sum('winning_cost')));
|
||||
|
||||
$payment_method = 3; // Credit Card
|
||||
$cc_transaction = $body['auth_guid'] ?? ($status['transactionId'] ?? 'NORTH_EC');
|
||||
$cc_transaction = $body['auth_guid'] ??
|
||||
($status['transaction_id'] ??
|
||||
($status['transactionId'] ??
|
||||
($status['id'] ?? 'NORTH_EC')));
|
||||
|
||||
$cc_amount = $winnertotal;
|
||||
$check_number = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user