Fixes for creating an account using OAuth

This commit is contained in:
David Bomba 2021-05-26 16:14:47 +10:00
parent fb17dd7e0b
commit e76567f337
3 changed files with 2 additions and 66 deletions

View File

@ -65,7 +65,7 @@ class CheckData extends Command
/**
* @var string
*/
protected $signature = 'ninja:check-data {--database=} {--fix=}';
protected $signature = 'ninja:check-data {--database=} {--fix=} {--client_id=}';
/**
* @var string

View File

@ -449,7 +449,7 @@ class LoginController extends BaseController
MultiDB::setDefaultDatabase();
$account = CreateAccount::dispatchNow($new_account);
$account = CreateAccount::dispatchNow($new_account, request()->getClientIp());
Auth::login($account->default_company->owner(), true);

View File

@ -347,68 +347,4 @@ class AutoBillInvoice extends AbstractService
return $this;
}
/**
* Removes any existing unpaid gateway fees
* due to previous payment failure.
*
* @return $this
*/
// private function purgeStaleGatewayFees()
// {
// $starting_amount = $this->invoice->amount;
// $line_items = $this->invoice->line_items;
// $new_items = [];
// foreach($line_items as $item)
// {
// if($item->type_id != 3)
// $new_items[] = $item;
// }
// $this->invoice->line_items = $new_items;
// $this->invoice->save();
// $this->invoice = $this->invoice->calc()->getInvoice();
// if($starting_amount != $this->invoice->amount && $this->invoice->status_id != Invoice::STATUS_DRAFT){
// $this->invoice->client->service()->updateBalance($this->invoice->amount - $starting_amount)->save();
// $this->invoice->ledger()->updateInvoiceBalance($this->invoice->amount - $starting_amount, 'Invoice balance updated after stale gateway fee removed')->save();
// }
// return $this;
// }
// /**
// * Checks whether a given gateway token is able
// * to process the payment after passing through the
// * fees and limits check.
// *
// * @param CompanyGateway $cg The CompanyGateway instance
// * @param float $amount The amount to be paid
// * @return bool
// */
// public function validGatewayLimits($cg, $amount) : bool
// {
// if (isset($cg->fees_and_limits)) {
// $fees_and_limits = $cg->fees_and_limits->{'1'};
// } else {
// return true;
// }
// if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) {
// info("amount {$amount} less than ".$fees_and_limits->min_limit);
// $passes = false;
// } elseif ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit) {
// info("amount {$amount} greater than ".$fees_and_limits->max_limit);
// $passes = false;
// } else {
// $passes = true;
// }
// return $passes;
// }
}