mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:14:40 -04:00
Add SOFORT support on Stripe
This commit is contained in:
parent
b5bd3cb632
commit
5e6c65b6a9
@ -417,6 +417,7 @@ if (! defined('APP_NAME')) {
|
||||
define('GATEWAY_TYPE_DWOLLA', 5);
|
||||
define('GATEWAY_TYPE_CUSTOM', 6);
|
||||
define('GATEWAY_TYPE_ALIPAY', 7);
|
||||
define('GATEWAY_TYPE_SOFORT', 8);
|
||||
define('GATEWAY_TYPE_TOKEN', 'token');
|
||||
|
||||
define('TEMPLATE_INVOICE', 'invoice');
|
||||
|
@ -23,9 +23,12 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
];
|
||||
|
||||
if ($gateway = $this->accountGateway) {
|
||||
if ($gateway->getAchEnabled() || $gateway->getSofortEnabled()) {
|
||||
if ($gateway->getAchEnabled()) {
|
||||
$types[] = GATEWAY_TYPE_BANK_TRANSFER;
|
||||
}
|
||||
if ($gateway->getSofortEnabled()) {
|
||||
$types[] = GATEWAY_TYPE_SOFORT;
|
||||
}
|
||||
if ($gateway->getAlipayEnabled()) {
|
||||
$types[] = GATEWAY_TYPE_ALIPAY;
|
||||
}
|
||||
@ -67,10 +70,9 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
|
||||
public function shouldUseSource()
|
||||
{
|
||||
if (in_array($this->gatewayType, [GATEWAY_TYPE_ALIPAY])) {
|
||||
return true;
|
||||
}
|
||||
return in_array($this->gatewayType, [GATEWAY_TYPE_ALIPAY, GATEWAY_TYPE_SOFORT]);
|
||||
|
||||
/*
|
||||
if ($this->gatewayType == GATEWAY_TYPE_BANK_TRANSFER) {
|
||||
$achEnabled = $this->accountGateway->getAchEnabled();
|
||||
$sofortEnabled = $this->accountGateway->getSofortEnabled();
|
||||
@ -91,6 +93,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
|
||||
protected function checkCustomerExists($customer)
|
||||
@ -245,12 +248,13 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
$isBank = $this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER, $paymentMethod);
|
||||
$isAlipay = $this->isGatewayType(GATEWAY_TYPE_ALIPAY, $paymentMethod);
|
||||
$isSofort = $this->isGatewayType(GATEWAY_TYPE_SOFORT, $paymentMethod);
|
||||
|
||||
if ($isBank || $isAlipay) {
|
||||
if ($isBank || $isAlipay || $isSofort) {
|
||||
$payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded' ? PAYMENT_STATUS_COMPLETED : PAYMENT_STATUS_PENDING;
|
||||
if ($isAlipay) {
|
||||
$payment->payment_type_id = PAYMENT_TYPE_ALIPAY;
|
||||
} elseif ($this->shouldUseSource()) {
|
||||
} elseif ($isSofort) {
|
||||
$payment->payment_type_id = PAYMENT_TYPE_SOFORT;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ class GatewayTypesSeeder extends Seeder
|
||||
['alias' => 'dwolla', 'name' => 'Dwolla'],
|
||||
['alias' => 'custom', 'name' => 'Custom'],
|
||||
['alias' => 'alipay', 'name' => 'Alipay'],
|
||||
['alias' => 'sofort', 'name' => 'Sofort'],
|
||||
];
|
||||
|
||||
foreach ($gateway_types as $gateway_type) {
|
||||
|
@ -37,7 +37,7 @@ class PaymentTypesSeeder extends Seeder
|
||||
['name' => 'Venmo'],
|
||||
['name' => 'Money Order'],
|
||||
['name' => 'Alipay', 'gateway_type_id' => GATEWAY_TYPE_ALIPAY],
|
||||
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_BANK_TRANSFER],
|
||||
['name' => 'Sofort', 'gateway_type_id' => GATEWAY_TYPE_SOFORT],
|
||||
];
|
||||
|
||||
foreach ($paymentTypes as $paymentType) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user