mirror of
https://github.com/itflow-org/itflow
synced 2026-07-24 17:30:43 +00:00
Cleanup Expense Code in post blocks and remove single use function since stripe payments get reconciled during nightly cron
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Extract the actual Stripe processing fee from a PaymentIntent.
|
||||
* PI must have been created/retrieved with
|
||||
* 'expand' => ['latest_charge.balance_transaction'].
|
||||
* Returns ['fee' => float, 'currency' => 'USD'] or false if unavailable.
|
||||
*/
|
||||
function getStripeGatewayFee($payment_intent)
|
||||
{
|
||||
$bt = $payment_intent->latest_charge->balance_transaction ?? null;
|
||||
|
||||
// Not expanded or not yet created (async payment methods)
|
||||
if (!$bt || is_string($bt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [
|
||||
'fee' => round($bt->fee / 100, 2),
|
||||
'currency' => strtoupper($bt->currency),
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user