Add Razorpay to PaymentLibrariesSeeder & update migration

This commit is contained in:
Benjamin Beganović 2021-10-07 16:51:08 +02:00
parent 0ae52537f0
commit 4c1dd8e03a
2 changed files with 9 additions and 4 deletions

View File

@ -3,7 +3,6 @@
use App\Models\Gateway;
use App\Models\GatewayType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Str;
class Razorpay extends Migration
{
@ -17,10 +16,15 @@ class Razorpay extends Migration
$gateway = new Gateway();
$gateway->id = 58;
$gateway->name = 'Razorpay';
$gateway->key = Str::lower(Str::random(32));
$gateway->key = 'hxd6gwg3ekb9tb3v9lptgx1mqyg69zu9';
$gateway->provider = 'Razorpay';
$gateway->is_offsite = false;
$gateway->fields = new \stdClass;
$configuration = new \stdClass;
$configuration->apiKey = '';
$configuration->apiSecret = '';
$gateway->fields = \json_encode($configuration);
$gateway->visible = true;
$gateway->site_url = 'https://razorpay.com';
$gateway->default_gateway_type_id = GatewayType::HOSTED_PAGE;

View File

@ -81,6 +81,7 @@ class PaymentLibrariesSeeder extends Seeder
['id' => 54, 'name' => 'PAYMILL', 'provider' => 'Paymill', 'key' => 'ca52f618a39367a4c944098ebf977e1c', 'fields' => '{"apiKey":""}'],
['id' => 55, 'name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 21, 'key' => '54faab2ab6e3223dbe848b1686490baa', 'fields' => '{"name":"","text":""}'],
['id' => 57, 'name' => 'Square', 'provider' => 'Square', 'is_offsite' => false, 'sort_order' => 21, 'key' => '65faab2ab6e3223dbe848b1686490baz', 'fields' => '{"accessToken":"","applicationId":"","locationId":"","testMode":false}'],
['id' => 58, 'name' => 'Razorpay', 'provider' => 'Razorpay', 'is_offsite' => false, 'sort_order' => 21, 'key' => 'hxd6gwg3ekb9tb3v9lptgx1mqyg69zu9', 'fields' => '{"apiKey":"","apiSecret":""}'],
];
foreach ($gateways as $gateway) {
@ -97,7 +98,7 @@ class PaymentLibrariesSeeder extends Seeder
Gateway::query()->update(['visible' => 0]);
Gateway::whereIn('id', [1,7,11,15,20,39,46,55,50,57,52])->update(['visible' => 1]);
Gateway::whereIn('id', [1,7,11,15,20,39,46,55,50,57,52,58])->update(['visible' => 1]);
if (Ninja::isHosted()) {
Gateway::whereIn('id', [20])->update(['visible' => 0]);