Skip to content

Commit

Permalink
Remove realdue from $paystack handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Nov 8, 2024
1 parent e5f2d69 commit 462cb5d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions app/Services/Payment/PaystackProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function intent(
$msg = 'Transaction Failed';

$reference = Providers::config('reference_prefix', 'TRX-') . Random::string(20, ! 1, ! 0, ! 0, ! 1);
$real_due = round($due * 100, 2);

$response = new \stdClass();

Expand Down Expand Up @@ -77,16 +76,22 @@ public function intent(
]);
}

$tranx = $paystack->transaction->initialize([
'amount' => $real_due, // in kobo
$payload = [
'amount' => $amount, // in kobo
'email' => $user->email, // unique to customers
'reference' => $reference, // unique to transactions
'metadata' => $builder->build(),
'callback_url' => $this->request->get(
'redirect',
Providers::config('payment_verify_url')
),
]);
];

if ($this->request->has('subaccount')) {
$payload['subaccount'] = $this->request->input('subaccount');
}

$tranx = $paystack->transaction->initialize($payload);
}

$code = HttpStatus::OK;
Expand All @@ -95,7 +100,7 @@ public function intent(
// Call the callback function
if ($callback) {
$tranx = new \App\Services\CustomObject($tranx);
$response = $callback($reference, $tranx, $real_due, $msg, $code);
$response = $callback($reference, $tranx, $amount, $msg, $code);
if ($respond) {
return $response;
}
Expand Down Expand Up @@ -358,4 +363,4 @@ public function transfer(

return new \App\Services\CustomObject($response);
}
}
}

0 comments on commit 462cb5d

Please sign in to comment.