Add base classes

This commit is contained in:
Lars Kusch 2022-12-16 11:02:49 +01:00
parent 8fef356ece
commit e2bc018c97
5 changed files with 54 additions and 0 deletions

View File

@ -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']],

View File

@ -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:

View File

@ -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)
{

View File

@ -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:

View File

@ -0,0 +1,39 @@
<?php
use App\Models\GatewayType;
use App\Models\PaymentType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$pt = PaymentType::find(49);
if(!$pt)
{
$type = new PaymentType();
$type->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();
}
}
};