mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Extract Stripe utilites
This commit is contained in:
parent
b94ce97bac
commit
cf503b4531
16
app/PaymentDrivers/Stripe/Utilities.php
Normal file
16
app/PaymentDrivers/Stripe/Utilities.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\PaymentDrivers\Stripe;
|
||||
|
||||
trait Utilities
|
||||
{
|
||||
public function convertFromStripeAmount($amount, $precision)
|
||||
{
|
||||
return $amount / pow(10, $precision);
|
||||
}
|
||||
|
||||
public function convertToStripeAmount($amount, $precision)
|
||||
{
|
||||
return $amount * pow(10, $precision);
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Stripe\Utilities;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
@ -30,7 +31,7 @@ use Stripe\Stripe;
|
||||
|
||||
class StripePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
use MakesHash;
|
||||
use MakesHash, Utilities;
|
||||
|
||||
protected $refundable = true;
|
||||
|
||||
@ -374,15 +375,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $payment;
|
||||
}
|
||||
|
||||
public function convertFromStripeAmount($amount, $precision)
|
||||
{
|
||||
return $amount / pow(10, $precision);
|
||||
}
|
||||
|
||||
public function convertToStripeAmount($amount, $precision)
|
||||
{
|
||||
return $amount * pow(10, $precision);
|
||||
}
|
||||
/**
|
||||
* Creates a new String Payment Intent
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user