diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 24d53a510c2e..7a41c48f1fc2 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -149,6 +149,7 @@ class Gateway extends StaticModel GatewayType::EPS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], GatewayType::BANCONTACT => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], GatewayType::BECS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], + GatewayType::BACS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], GatewayType::IDEAL => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], GatewayType::ACSS => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded', 'payment_intent.succeeded']], GatewayType::FPX => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable', 'charge.succeeded']], diff --git a/app/Models/GatewayType.php b/app/Models/GatewayType.php index cc4d0a998fe7..8b0edb053249 100644 --- a/app/Models/GatewayType.php +++ b/app/Models/GatewayType.php @@ -61,6 +61,8 @@ class GatewayType extends StaticModel const KLARNA = 23; + const BACS = 24; + public function gateway() { return $this->belongsTo(Gateway::class); @@ -108,6 +110,8 @@ class GatewayType extends StaticModel return ctrans('texts.eps'); case self::BECS: return ctrans('texts.becs'); + case self::BACS: + return ctrans('texts.bacs'); case self::ACSS: return ctrans('texts.acss'); case self::DIRECT_DEBIT: diff --git a/app/Models/PaymentType.php b/app/Models/PaymentType.php index 5459a83774a8..f718203ec9fb 100644 --- a/app/Models/PaymentType.php +++ b/app/Models/PaymentType.php @@ -57,6 +57,7 @@ class PaymentType extends StaticModel const FPX = 46; const KLARNA = 47; const Interac_E_Transfer = 48; + const BACS = 49; public static function parseCardType($cardName) { diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index c6a4f9fdbcc9..699865183e22 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -239,6 +239,13 @@ class StripePaymentDriver extends BaseDriver && in_array($this->client->country->iso_3166_3, ['CAN', 'USA'])) { $types[] = GatewayType::ACSS; } + if ($this->client + && $this->client->currency() + && in_array($this->client->currency()->code, ['GDB']) + && isset($this->client->country) + && in_array($this->client->country->iso_3166_3, ['GBR'])) { + $types[] = GatewayType::BACS; + } if ($this->client && $this->client->currency() && in_array($this->client->currency()->code, ['EUR', 'DKK', 'GBP', 'NOK', 'SEK', 'AUD', 'NZD', 'CAD', 'PLN', 'CHF']) @@ -302,6 +309,8 @@ class StripePaymentDriver extends BaseDriver return 'gateways.stripe.bancontact'; case GatewayType::BECS: return 'gateways.stripe.becs'; + case GatewayType::BACS: + return 'gateways.stripe.bacs'; case GatewayType::ACSS: return 'gateways.stripe.acss'; case GatewayType::FPX: diff --git a/database/migrations/2022_16_12_54687_add_stripe_bacs.php b/database/migrations/2022_16_12_54687_add_stripe_bacs.php new file mode 100644 index 000000000000..a454e483e29b --- /dev/null +++ b/database/migrations/2022_16_12_54687_add_stripe_bacs.php @@ -0,0 +1,39 @@ +id = 49; + $type->name = 'BACS'; + $type->gateway_type_id = GatewayType::BACS; + $type->save(); + } + + $gt = GatewayType::find(24); + + if(!$gt) + { + $type = new GatewayType(); + $type->id = 24; + $type->alias = 'bacs'; + $type->name = 'BACS'; + $type->save(); + } + } +};