- set paypal mode in credentials setup

This commit is contained in:
Čarodej
2022-04-04 16:48:29 +02:00
parent c1f775975d
commit b219c00113
25 changed files with 111 additions and 95 deletions

View File

@@ -39,6 +39,8 @@ class StorePaymentServiceCredentialsController
'value' => $setting['value'],
]));
$PayPalDefaultMode = config('subscription.credentials.paypal.is_live') ? 'true' : 'false';
// Get and store credentials
if (! app()->runningUnitTests()) {
$credentials = [
@@ -55,14 +57,14 @@ class StorePaymentServiceCredentialsController
'PAYPAL_CLIENT_ID' => $request->input('key'),
'PAYPAL_CLIENT_SECRET' => $request->input('secret'),
'PAYPAL_WEBHOOK_ID' => $request->input('webhook'),
'PAYPAL_IS_LIVE' => 'true',
'PAYPAL_IS_LIVE' => $request->has('live') ? (string) $request->input('live') : $PayPalDefaultMode,
],
];
// Store credentials into the .env file
setEnvironmentValue($credentials[$request->input('service')]);
// TODO: call plan creation
// TODO: call plan synchronization
// Clear cache
if (! is_dev()) {

View File

@@ -1,4 +1,5 @@
<?php
namespace Domain\Settings\Requests;
use Illuminate\Foundation\Http\FormRequest;
@@ -26,6 +27,7 @@ class StorePaymentServiceCredentialsRequest extends FormRequest
'key' => 'required|string',
'secret' => 'required|string',
'webhook' => 'sometimes|string',
'live' => 'sometimes|nullable|boolean',
];
}
}