mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 19:04:36 -04:00
Fixes for importing customers into Stripe.
This commit is contained in:
parent
8c764a1716
commit
2e6896dd58
@ -23,7 +23,7 @@ class StripeController extends BaseController
|
|||||||
if(auth()->user()->isAdmin())
|
if(auth()->user()->isAdmin())
|
||||||
{
|
{
|
||||||
|
|
||||||
StripeUpdatePaymentMethods::dispatch(auth()->user()->getCompany());
|
StripeUpdatePaymentMethods::dispatch(auth()->user()->company());
|
||||||
|
|
||||||
return response()->json(['message' => 'Processing'], 200);
|
return response()->json(['message' => 'Processing'], 200);
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class StripeController extends BaseController
|
|||||||
if(auth()->user()->isAdmin())
|
if(auth()->user()->isAdmin())
|
||||||
{
|
{
|
||||||
|
|
||||||
ImportStripeCustomers::dispatch(auth()->user()->getCompany());
|
ImportStripeCustomers::dispatch(auth()->user()->company());
|
||||||
|
|
||||||
return response()->json(['message' => 'Processing'], 200);
|
return response()->json(['message' => 'Processing'], 200);
|
||||||
|
|
||||||
|
@ -169,15 +169,17 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
*/
|
*/
|
||||||
public function getCompany()
|
public function getCompany()
|
||||||
{
|
{
|
||||||
if ($this->company) {
|
|
||||||
return $this->company;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request()->header('X-API-TOKEN')) {
|
if (request()->header('X-API-TOKEN')) {
|
||||||
$company_token = CompanyToken::with(['company'])->whereRaw('BINARY `token`= ?', [request()->header('X-API-TOKEN')])->first();
|
$company_token = CompanyToken::with(['company'])->whereRaw('BINARY `token`= ?', [request()->header('X-API-TOKEN')])->first();
|
||||||
|
|
||||||
return $company_token->company;
|
return $company_token->company;
|
||||||
}
|
}
|
||||||
|
elseif ($this->company){
|
||||||
|
|
||||||
|
return $this->company;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// return false;
|
// return false;
|
||||||
throw new \Exception('No Company Found');
|
throw new \Exception('No Company Found');
|
||||||
|
@ -77,6 +77,7 @@ class ImportCustomers
|
|||||||
|
|
||||||
nlog("inserting a customer");
|
nlog("inserting a customer");
|
||||||
nlog($customer);
|
nlog($customer);
|
||||||
|
|
||||||
$client = ClientFactory::create($this->stripe->company_gateway->company_id, $this->stripe->company_gateway->user_id);
|
$client = ClientFactory::create($this->stripe->company_gateway->company_id, $this->stripe->company_gateway->user_id);
|
||||||
|
|
||||||
if(property_exists($customer, 'address'))
|
if(property_exists($customer, 'address'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user