1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for client gateways

This commit is contained in:
David Bomba 2021-07-01 15:56:44 +10:00
parent a2d954b706
commit 69461104fe
4 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ class CheckClientExistence
public function handle(Request $request, Closure $next)
{
$multiple_contacts = ClientContact::query()
->with('company','client')
->where('email', auth('contact')->user()->email)
->whereNotNull('email')
->where('email', '<>', '')

View File

@ -37,8 +37,9 @@ class StoreClientGatewayTokenRequest extends Request
public function rules()
{
//ensure client is present
$rules = [
'client_id' => 'required',
'client_id' => 'required|exists:clients,id,company_id,'.auth()->user()->company()->id,
'company_gateway_id' => 'required',
'gateway_type_id' => 'required|integer',
'meta' => 'required',

View File

@ -35,6 +35,7 @@ class ClientGatewayToken extends BaseModel
'gateway_customer_reference',
'gateway_type_id',
'meta',
'client_id',
];
public function getEntityType()

View File

@ -159,7 +159,9 @@ class PaymentRepository extends BaseRepository {
if (array_key_exists('email_receipt', $data) && $data['email_receipt'] == true)
$payment->service()->sendEmail();
elseif(!array_key_exists('email_receipt', $data) && $payment->client->getSetting('client_manual_payment_notification'))
$payment->service()->sendEmail();
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null) ) );
}