Update 2024_06_11_231143_add_rotessa_gateway.php

Reefactored code as per request 2ea54b0042 (r1693681342)

Signed-off-by: Kendall Arneaud <kendall.arneaud@gmail.com>
This commit is contained in:
Kendall Arneaud 2024-07-27 12:18:28 -04:00 committed by GitHub
parent aa5d43405c
commit fa0c3f27e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,35 +15,23 @@ return new class extends Migration
public function up(): void
{
Model::unguard();
\DB::statement('SET FOREIGN_KEY_CHECKS=0;');
$record = Gateway::where('name', '=', 'Rotessa')->first();
$count = (int) Gateway::count();
$configuration = new \stdClass;
$configuration->api_key = '';
$configuration->test_mode = true;
if (!$record) {
$gateway = new Gateway;
} else {
$gateway = $record;
if(!Gateway::find(63)) {
$configuration = new \stdClass;
$configuration->api_key = '';
$configuration->test_mode = true;
$gateway->id = 63;
$gateway->name = 'Rotessa';
$gateway->key = '91be24c7b792230bced33e930ac61676';
$gateway->provider = 'Rotessa';
$gateway->is_offsite = true;
$gateway->fields = \json_encode($configuration);
$gateway->visible = 1;
$gateway->site_url = "https://rotessa.com";
$gateway->default_gateway_type_id = 2;
$gateway->save();
}
$gateway->id = 4002;
$gateway->name = 'Rotessa';
$gateway->key = Str::lower(Str::random(32));
$gateway->provider = 'Rotessa';
$gateway->is_offsite = true;
$gateway->fields = \json_encode($configuration);
$gateway->visible = 1;
$gateway->site_url = "https://rotessa.com";
$gateway->default_gateway_type_id = 2;
$gateway->save();
Gateway::query()->where('name','=', 'Rotessa')->update(['visible' => 1]);
\DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
/**