add checks prior to attempting to add in payment types

This commit is contained in:
David Bomba 2022-12-08 14:19:43 +11:00
parent 1ebaea42d1
commit 70db8052c0
5 changed files with 30 additions and 10 deletions

View File

@ -56,6 +56,7 @@ class PaymentType extends StaticModel
const INSTANT_BANK_PAY = 45;
const FPX = 46;
const KLARNA = 47;
const Interac_E_Transfer = 48;
public static function parseCardType($cardName)
{

View File

@ -21,9 +21,11 @@ class PDF extends FPDI
{
$this->SetXY(0, -5);
$this->SetFont('Arial', 'I', 9);
$this->SetTextColor(135, 135, 135);
$trans = ctrans('texts.pdf_page_info', ['current' => $this->PageNo(), 'total' => '{nb}']);
$trans = iconv('UTF-8', 'ISO-8859-7', $trans);
$this->Cell(0, 5, $trans, 0, 0, $this->text_alignment);
}

View File

@ -14,21 +14,37 @@ return new class extends Migration {
*/
public function up()
{
Schema::table('payment_types', function (Blueprint $table) {
$type = new PaymentType();
$pt = PaymentType::find(47);
if(!$pt)
{
$type = new PaymentType();
$type->id = 47;
$type->name = 'Klarna';
$type->gateway_type_id = GatewayType::KLARNA;
$type->save();
});
$type = new GatewayType();
}
$type->id = 23;
$type->alias = 'klarna';
$type->name = 'Klarna';
$type->save();
$pt = PaymentType::find(48);
if(!$pt)
{
$type = new PaymentType();
$type->id = 48;
$type->name = 'Interac E-Transfer';
$type->save();
}
$gt = GatewayType::find(23);
if(!$gt)
{
$type = new GatewayType();
$type->id = 23;
$type->alias = 'klarna';
$type->name = 'Klarna';
$type->save();
}
}
};

View File

@ -17,5 +17,6 @@ return new class extends Migration
$table->string('matomo_url',191)->nullable();
$table->bigInteger('matomo_id')->nullable();
});
}
};

View File

@ -4891,7 +4891,7 @@ $LANG = array(
'restored_transaction_rule' => 'Successfully restored transaction rule',
'search_transaction_rule' => 'Search Transaction Rule',
'search_transaction_rules' => 'Search Transaction Rules',
'payment_type_Interac E-Transfer' => 'Interac E-Transfer',
);
return $LANG;