mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 01:54:29 -04:00
Make "setPaymentMethod" available in all drivers
This commit is contained in:
parent
2738968170
commit
f61ecef4f2
@ -69,6 +69,10 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
|
||||
protected $customer_reference = '';
|
||||
|
||||
public function setPaymentMethod($payment_method_id = null)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function gatewayTypes()
|
||||
{
|
||||
|
@ -21,6 +21,10 @@ use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\SystemLog;
|
||||
use App\PaymentDrivers\Stripe\ACH;
|
||||
use App\PaymentDrivers\Stripe\Alipay;
|
||||
use App\PaymentDrivers\Stripe\CreditCard;
|
||||
use App\PaymentDrivers\Stripe\SOFORT;
|
||||
use App\PaymentDrivers\Stripe\Utilities;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Request;
|
||||
@ -43,6 +47,15 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
|
||||
protected $payment_method;
|
||||
|
||||
public static $methods = [
|
||||
GatewayType::CREDIT_CARD => CreditCard::class,
|
||||
GatewayType::BANK_TRANSFER => ACH::class,
|
||||
GatewayType::ALIPAY => Alipay::class,
|
||||
GatewayType::SOFORT => SOFORT::class,
|
||||
GatewayType::APPLE_PAY => 1,
|
||||
GatewayType::SEPA => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
* Methods in this class are divided into
|
||||
* two separate streams
|
||||
@ -65,11 +78,11 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
|
||||
}
|
||||
|
||||
public function setPaymentMethod(string $method)
|
||||
public function setPaymentMethod($payment_method_id)
|
||||
{
|
||||
// Example: setPaymentMethod('App\\PaymentDrivers\\Stripe\\CreditCard');
|
||||
|
||||
$this->payment_method = new $method($this);
|
||||
$class = self::$methods[$payment_method_id];
|
||||
|
||||
$this->payment_method = new $class($this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user