mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 08:17:32 -05:00 
			
		
		
		
	Fixes for update customer
This commit is contained in:
		
							parent
							
								
									adcdd69177
								
							
						
					
					
						commit
						6b30b38e32
					
				@ -62,13 +62,11 @@ class UpdateCustomer implements ShouldQueue
 | 
				
			|||||||
            return;
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $company_gateway = CompanyGateway::find($this->company_gateway_id);
 | 
					        $company_gateway = CompanyGateway::find($this->company_gateway_id);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $stripe = $company_gateway->driver()->init();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $customer = $stripe->findOrCreateCustomer();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $client = Client::withTrashed()->find($this->client_id);
 | 
					        $client = Client::withTrashed()->find($this->client_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $stripe = $company_gateway->driver($client)->init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $customer = $stripe->findOrCreateCustomer();
 | 
				
			||||||
        //Else create a new record
 | 
					        //Else create a new record
 | 
				
			||||||
        $data['name'] = $client->present()->name();
 | 
					        $data['name'] = $client->present()->name();
 | 
				
			||||||
        $data['phone'] = substr($client->present()->phone(), 0, 20);
 | 
					        $data['phone'] = substr($client->present()->phone(), 0, 20);
 | 
				
			||||||
@ -80,6 +78,14 @@ class UpdateCustomer implements ShouldQueue
 | 
				
			|||||||
        $data['address']['state'] = $client->state;
 | 
					        $data['address']['state'] = $client->state;
 | 
				
			||||||
        $data['address']['country'] = $client->country ? $client->country->iso_3166_2 : '';
 | 
					        $data['address']['country'] = $client->country ? $client->country->iso_3166_2 : '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $data['shipping']['name'] = $client->present()->name();
 | 
				
			||||||
 | 
					        $data['shipping']['address']['line1'] = $client->shipping_address1;
 | 
				
			||||||
 | 
					        $data['shipping']['address']['line2'] = $client->shipping_address2;
 | 
				
			||||||
 | 
					        $data['shipping']['address']['city'] = $client->shipping_city;
 | 
				
			||||||
 | 
					        $data['shipping']['address']['postal_code'] = $client->shipping_postal_code;
 | 
				
			||||||
 | 
					        $data['shipping']['address']['state'] = $client->shipping_state;
 | 
				
			||||||
 | 
					        $data['shipping']['address']['country'] = $client->shipping_country ? $client->shipping_country->iso_3166_2 : '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        \Stripe\Customer::update($customer->id, $data, $stripe->stripe_connect_auth);
 | 
					        \Stripe\Customer::update($customer->id, $data, $stripe->stripe_connect_auth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user