mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:57:33 -05:00 
			
		
		
		
	
						commit
						6aa7a4d90f
					
				@ -141,4 +141,36 @@ class ImportCustomers
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $this->update_payment_methods->updateMethods($customer, $client);
 | 
					        $this->update_payment_methods->updateMethods($customer, $client);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function match()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        foreach($this->stripe->company_gateway->company->clients as $client)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $searchResults = \Stripe\Customer::all([
 | 
				
			||||||
 | 
					                        "email" => $client->present()->email(),
 | 
				
			||||||
 | 
					                        "limit" => 2,
 | 
				
			||||||
 | 
					                        "starting_after" => null
 | 
				
			||||||
 | 
					            ],$this->stripe->stripe_connect_auth);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // nlog(count($searchResults));
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					            if(count($searchResults) == 1)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $cgt = ClientGatewayToken::where('gateway_customer_reference', $searchResults->data[0]->id)->where('company_id', $this->company_gateway->company->id)->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if(!$cgt)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    nlog("customer ".$searchResults->data[0]->id. " does not exist.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    $this->update_payment_methods->updateMethods($searchResults->data[0], $client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,7 +83,7 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
     * Initializes the Stripe API.
 | 
					     * Initializes the Stripe API.
 | 
				
			||||||
     * @return void
 | 
					     * @return void
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function init(): void
 | 
					    public function init()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if($this->stripe_connect)
 | 
					        if($this->stripe_connect)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -103,6 +103,8 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
            Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
 | 
					            Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function setPaymentMethod($payment_method_id)
 | 
					    public function setPaymentMethod($payment_method_id)
 | 
				
			||||||
@ -543,6 +545,11 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function importMatchedClients()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return (new ImportCustomers($this))->match();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function verifyConnect()
 | 
					    public function verifyConnect()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return (new Verify($this))->run();
 | 
					        return (new Verify($this))->run();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user