From 33f0b6b7c6ad5aa14f6359a02d928f661ab11a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 29 Sep 2021 14:17:30 +0200 Subject: [PATCH] Conditionally show ACH for US customers --- app/PaymentDrivers/GoCardlessPaymentDriver.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/PaymentDrivers/GoCardlessPaymentDriver.php b/app/PaymentDrivers/GoCardlessPaymentDriver.php index 0c325bb477bf..f445ec14b22d 100644 --- a/app/PaymentDrivers/GoCardlessPaymentDriver.php +++ b/app/PaymentDrivers/GoCardlessPaymentDriver.php @@ -50,9 +50,17 @@ class GoCardlessPaymentDriver extends BaseDriver public function gatewayTypes(): array { - return [ - GatewayType::BANK_TRANSFER, - ]; + $types = []; + + if ( + $this->client + && isset($this->client->country) + && in_array($this->client->country->iso_3166_3, ['USA']) + ) { + $types[] = GatewayType::BANK_TRANSFER; + } + + return $types; } public function authorizeView(array $data)