update PaymentLibrariesSeeder

Signed-off-by: Nisaba <34550856+Nisaba@users.noreply.github.com>
This commit is contained in:
Nisaba 2024-05-20 16:00:57 +00:00 committed by GitHub
parent a949501466
commit f1186624c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@ -8,6 +9,7 @@
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace Database\Seeders;
use App\Models\Gateway;
@ -85,12 +87,13 @@ class PaymentLibrariesSeeder extends Seeder
['id' => 59, 'name' => 'Forte', 'provider' => 'Forte', 'is_offsite' => false, 'sort_order' => 21, 'key' => 'kivcvjexxvdiyqtj3mju5d6yhpeht2xs', 'fields' => '{"testMode":false,"apiLoginId":"","apiAccessId":"","secureKey":"","authOrganizationId":"","organizationId":"","locationId":""}'],
['id' => 60, 'name' => 'PayPal REST', 'provider' => 'PayPal_Rest', 'key' => '80af24a6a691230bbec33e930ab40665', 'fields' => '{"clientId":"","secret":"","signature":"","testMode":false}'],
['id' => 61, 'name' => 'PayPal Platform', 'provider' => 'PayPal_PPCP', 'key' => '80af24a6a691230bbec33e930ab40666', 'fields' => '{"testMode":false}'],
['id' => 62, 'name' => 'BTCPay', 'provider' => 'BTCPay', 'key' => 'vpyfbmdrkqcicpkjqdusgjfluebftuva', 'fields' => '{"btcpayUrl":"", "apiKey:"", "storeId":"", "webhookSecret":""}'],
];
foreach ($gateways as $gateway) {
$record = Gateway::whereName($gateway['name'])
->whereProvider($gateway['provider'])
->first();
->whereProvider($gateway['provider'])
->first();
if ($record) {
$record->fill($gateway);
$record->save();
@ -101,13 +104,13 @@ class PaymentLibrariesSeeder extends Seeder
Gateway::query()->update(['visible' => 0]);
Gateway::whereIn('id', [1,3,7,11,15,20,39,46,55,50,57,52,58,59,60])->update(['visible' => 1]);
Gateway::whereIn('id', [1, 3, 7, 11, 15, 20, 39, 46, 55, 50, 57, 52, 58, 59, 60, 62])->update(['visible' => 1]);
if (Ninja::isHosted()) {
Gateway::whereIn('id', [20,49])->update(['visible' => 0]);
Gateway::whereIn('id', [56,61])->update(['visible' => 1]);
Gateway::whereIn('id', [20, 49])->update(['visible' => 0]);
Gateway::whereIn('id', [56, 61])->update(['visible' => 1]);
}
Gateway::all()->each(function ($gateway) {
$gateway->site_url = $gateway->getHelp();
$gateway->save();