mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:07:32 -05:00 
			
		
		
		
	Init class variables if they do not exist
This commit is contained in:
		
							parent
							
								
									9bca3ef170
								
							
						
					
					
						commit
						05cb4be207
					
				@ -41,7 +41,8 @@ class SessionDomains
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            Cookie::queue(Cookie::forget('invoice_ninja_session', '/'));
 | 
					            Cookie::queue(Cookie::forget('invoice_ninja_session', '/'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            config(['session.domain' => $request->getHost()]);
 | 
					            config(['session.domain' => $domain_name]);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return $next($request);        
 | 
					        return $next($request);        
 | 
				
			||||||
 | 
				
			|||||||
@ -222,6 +222,8 @@ class BaseDriver extends AbstractPaymentDriver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function createPayment($data, $status = Payment::STATUS_COMPLETED): Payment
 | 
					    public function createPayment($data, $status = Payment::STATUS_COMPLETED): Payment
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]) )        
 | 
				
			||||||
            $this->confirmGatewayFee();
 | 
					            $this->confirmGatewayFee();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*Never create a payment with a duplicate transaction reference*/
 | 
					        /*Never create a payment with a duplicate transaction reference*/
 | 
				
			||||||
@ -253,6 +255,10 @@ class BaseDriver extends AbstractPaymentDriver
 | 
				
			|||||||
        $payment->client_contact_id = $client_contact_id;
 | 
					        $payment->client_contact_id = $client_contact_id;
 | 
				
			||||||
        $payment->saveQuietly();
 | 
					        $payment->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Return early if the payment is no completed or pending*/
 | 
				
			||||||
 | 
					        if(!in_array($status, [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING]) )
 | 
				
			||||||
 | 
					            return $payment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->payment_hash->payment_id = $payment->id;
 | 
					        $this->payment_hash->payment_id = $payment->id;
 | 
				
			||||||
        $this->payment_hash->save();
 | 
					        $this->payment_hash->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -312,11 +312,12 @@ class MolliePaymentDriver extends BaseDriver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if($record){
 | 
					            if($record){
 | 
				
			||||||
                $client = $record->client;
 | 
					                $client = $record->client;
 | 
				
			||||||
 | 
					                $this->client = $client;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else{
 | 
					            else{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $client = Client::withTrashed()->find($this->decodePrimaryKey($payment->metadata->client_id));
 | 
					                $client = Client::withTrashed()->find($this->decodePrimaryKey($payment->metadata->client_id));
 | 
				
			||||||
 | 
					                $this->client = $client;
 | 
				
			||||||
                // sometimes if the user is not returned to the site with a response from Mollie 
 | 
					                // sometimes if the user is not returned to the site with a response from Mollie 
 | 
				
			||||||
                // we may not have a payment record - in these cases we need to re-construct the payment
 | 
					                // we may not have a payment record - in these cases we need to re-construct the payment
 | 
				
			||||||
                // record from the meta data in the payment hash.
 | 
					                // record from the meta data in the payment hash.
 | 
				
			||||||
@ -326,6 +327,9 @@ class MolliePaymentDriver extends BaseDriver
 | 
				
			|||||||
                    /* Harvest Payment Hash*/
 | 
					                    /* Harvest Payment Hash*/
 | 
				
			||||||
                    $payment_hash = PaymentHash::where('hash', $payment->metadata->hash)->first();
 | 
					                    $payment_hash = PaymentHash::where('hash', $payment->metadata->hash)->first();
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
 | 
					                    /* If we are here, then we do not have access to the class payment hash, so lets set it here*/
 | 
				
			||||||
 | 
					                    $this->payment_hash = $payment_hash;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    $data = [
 | 
					                    $data = [
 | 
				
			||||||
                        'gateway_type_id' => $payment->metadata->gateway_type_id,
 | 
					                        'gateway_type_id' => $payment->metadata->gateway_type_id,
 | 
				
			||||||
                        'amount' => $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total,
 | 
					                        'amount' => $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user