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

Fixes for importing customers into Stripe.

This commit is contained in:
David Bomba 2021-05-19 14:27:47 +10:00
parent 8c764a1716
commit 2e6896dd58
3 changed files with 9 additions and 6 deletions

View File

@ -22,8 +22,8 @@ class StripeController extends BaseController
{
if(auth()->user()->isAdmin())
{
StripeUpdatePaymentMethods::dispatch(auth()->user()->getCompany());
StripeUpdatePaymentMethods::dispatch(auth()->user()->company());
return response()->json(['message' => 'Processing'], 200);
@ -39,7 +39,7 @@ class StripeController extends BaseController
if(auth()->user()->isAdmin())
{
ImportStripeCustomers::dispatch(auth()->user()->getCompany());
ImportStripeCustomers::dispatch(auth()->user()->company());
return response()->json(['message' => 'Processing'], 200);

View File

@ -169,15 +169,17 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function getCompany()
{
if ($this->company) {
return $this->company;
}
if (request()->header('X-API-TOKEN')) {
$company_token = CompanyToken::with(['company'])->whereRaw('BINARY `token`= ?', [request()->header('X-API-TOKEN')])->first();
return $company_token->company;
}
elseif ($this->company){
return $this->company;
}
// return false;
throw new \Exception('No Company Found');

View File

@ -77,6 +77,7 @@ class ImportCustomers
nlog("inserting a customer");
nlog($customer);
$client = ClientFactory::create($this->stripe->company_gateway->company_id, $this->stripe->company_gateway->user_id);
if(property_exists($customer, 'address'))