mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:17:32 -05:00 
			
		
		
		
	Fix error with payment methods
This commit is contained in:
		
							parent
							
								
									d3116f7a06
								
							
						
					
					
						commit
						5f861f491a
					
				@ -540,16 +540,16 @@ class BasePaymentDriver
 | 
				
			|||||||
        $paymentMethod->setRelation('account_gateway_token', $customer);
 | 
					        $paymentMethod->setRelation('account_gateway_token', $customer);
 | 
				
			||||||
        $paymentMethod = $this->creatingPaymentMethod($paymentMethod);
 | 
					        $paymentMethod = $this->creatingPaymentMethod($paymentMethod);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // archive the old payment method
 | 
					 | 
				
			||||||
        $oldPaymentMethod = PaymentMethod::clientId($this->client()->id)
 | 
					 | 
				
			||||||
            ->wherePaymentTypeId($paymentMethod->payment_type_id)
 | 
					 | 
				
			||||||
            ->first();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ($oldPaymentMethod) {
 | 
					 | 
				
			||||||
            $oldPaymentMethod->delete();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ($paymentMethod) {
 | 
					        if ($paymentMethod) {
 | 
				
			||||||
 | 
					            // archive the old payment method
 | 
				
			||||||
 | 
					            $oldPaymentMethod = PaymentMethod::clientId($this->client()->id)
 | 
				
			||||||
 | 
					                ->wherePaymentTypeId($paymentMethod->payment_type_id)
 | 
				
			||||||
 | 
					                ->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ($oldPaymentMethod) {
 | 
				
			||||||
 | 
					                $oldPaymentMethod->delete();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $paymentMethod->save();
 | 
					            $paymentMethod->save();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user