Add DirectDebit to GoCardlessPaymentDriver

This commit is contained in:
Benjamin Beganović 2021-10-16 15:35:07 +02:00
parent e06aefdd22
commit 32f81ab253

View File

@ -38,6 +38,7 @@ class GoCardlessPaymentDriver extends BaseDriver
public static $methods = [ public static $methods = [
GatewayType::BANK_TRANSFER => \App\PaymentDrivers\GoCardless\ACH::class, GatewayType::BANK_TRANSFER => \App\PaymentDrivers\GoCardless\ACH::class,
GatewayType::DIRECT_DEBIT => \App\PaymentDrivers\GoCardless\DirectDebit::class,
]; ];
const SYSTEM_LOG_TYPE = SystemLog::TYPE_GOCARDLESS; const SYSTEM_LOG_TYPE = SystemLog::TYPE_GOCARDLESS;
@ -63,6 +64,14 @@ class GoCardlessPaymentDriver extends BaseDriver
$types[] = GatewayType::BANK_TRANSFER; $types[] = GatewayType::BANK_TRANSFER;
} }
if (
$this->client
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['GBR'])
) {
$types[] = GatewayType::DIRECT_DEBIT;
}
return $types; return $types;
} }