mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 14:44:34 -04:00
Static Analysis
This commit is contained in:
parent
97049f36a9
commit
c163f3c1a4
@ -717,7 +717,7 @@ class PurchaseOrderController extends BaseController
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400);
|
return response()->json(['message' => ctrans('texts.action_unavailable', ['action' => $action])], 400);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,9 +129,9 @@ class StorePaymentRequest extends Request
|
|||||||
$input['date'] = now()->addSeconds($user->company()->utc_offset())->format('Y-m-d');
|
$input['date'] = now()->addSeconds($user->company()->utc_offset())->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! isset($input['idempotency_key'])) {
|
// if (! isset($input['idempotency_key'])) {
|
||||||
$input['idempotency_key'] = substr(sha1(json_encode($input)).time()."{$input['date']}{$input['amount']}{$user->id}", 0, 64);
|
$input['idempotency_key'] = substr(time()."{$input['date']}{$input['amount']}{$credits_total}{$this->client_id}{$user->company()->company_key}", 0, 64);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->replace($input);
|
$this->replace($input);
|
||||||
}
|
}
|
||||||
|
@ -653,11 +653,11 @@ class BaseTransformer
|
|||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
*
|
*
|
||||||
* @return int|null
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getExpenseCategoryId($name)
|
public function getExpenseCategoryId($name)
|
||||||
{
|
{
|
||||||
/** @var \App\Models\ExpenseCategory $ec */
|
/** @var ?\App\Models\ExpenseCategory $ec */
|
||||||
$ec = ExpenseCategory::query()->where('company_id', $this->company->id)
|
$ec = ExpenseCategory::query()->where('company_id', $this->company->id)
|
||||||
->where('is_deleted', false)
|
->where('is_deleted', false)
|
||||||
->whereRaw("LOWER(REPLACE(`name`, ' ' ,'')) = ?", [
|
->whereRaw("LOWER(REPLACE(`name`, ' ' ,'')) = ?", [
|
||||||
@ -673,7 +673,7 @@ class BaseTransformer
|
|||||||
$ec->name = $name;
|
$ec->name = $name;
|
||||||
$ec->save();
|
$ec->save();
|
||||||
|
|
||||||
return $ec ? $ec->id : null;
|
return $ec->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrCreateExpenseCategry($name)
|
public function getOrCreateExpenseCategry($name)
|
||||||
|
@ -264,6 +264,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
|||||||
{
|
{
|
||||||
$truth = app()->make(TruthSource::class);
|
$truth = app()->make(TruthSource::class);
|
||||||
|
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
if ($this->company) {
|
if ($this->company) {
|
||||||
return $this->company;
|
return $this->company;
|
||||||
} elseif ($truth->getCompany()) {
|
} elseif ($truth->getCompany()) {
|
||||||
|
@ -194,7 +194,7 @@ class PayPalBasePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
|
|
||||||
/** @var \App\Models\ClientGatewayToken $cgt */
|
/** @var ?\App\Models\ClientGatewayToken $cgt */
|
||||||
$cgt = ClientGatewayToken::where('company_gateway_id', $this->company_gateway->id)
|
$cgt = ClientGatewayToken::where('company_gateway_id', $this->company_gateway->id)
|
||||||
->where('client_id', $this->client->id)
|
->where('client_id', $this->client->id)
|
||||||
->first();
|
->first();
|
||||||
|
@ -344,8 +344,6 @@ class ACH
|
|||||||
|
|
||||||
return redirect()->route('client.payment_methods.verification', ['payment_method' => $cgt->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
|
return redirect()->route('client.payment_methods.verification', ['payment_method' => $cgt->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
|
||||||
|
|
||||||
$data['message'] = 'Invalid parameters were supplied to Stripe\'s API';
|
|
||||||
break;
|
|
||||||
case $e instanceof AuthenticationException:
|
case $e instanceof AuthenticationException:
|
||||||
$data['message'] = 'Authentication with Stripe\'s API failed';
|
$data['message'] = 'Authentication with Stripe\'s API failed';
|
||||||
break;
|
break;
|
||||||
|
@ -489,11 +489,7 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
$customer = Customer::retrieve($customer_id, $this->stripe_connect_auth);
|
$customer = Customer::retrieve($customer_id, $this->stripe_connect_auth);
|
||||||
|
|
||||||
if ($customer) {
|
return $customer ?? null;
|
||||||
return $customer;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ class WePayPaymentDriver extends BaseDriver
|
|||||||
throw new \Exception("Gateway no longer supported", 500);
|
throw new \Exception("Gateway no longer supported", 500);
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
// return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +117,7 @@ class PaymentLinkService
|
|||||||
|
|
||||||
/* 06-04-2022 */
|
/* 06-04-2022 */
|
||||||
/* We may not be in a state where the user is present */
|
/* We may not be in a state where the user is present */
|
||||||
if (auth()->guard('contact')) {
|
if (auth()->guard('contact')->user()) {
|
||||||
return $this->handleRedirect('/client/invoices/' . $this->encodePrimaryKey($payment_hash->fee_invoice_id));
|
return $this->handleRedirect('/client/invoices/' . $this->encodePrimaryKey($payment_hash->fee_invoice_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class TaxProvider
|
|||||||
|
|
||||||
// $this->provider = EuTax::class;
|
// $this->provider = EuTax::class;
|
||||||
|
|
||||||
return $this;
|
// return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
<script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script>
|
<script type="text/javascript" src="https://c.paypal.com/da/r/fb.js"></script>
|
||||||
|
|
||||||
@if(isset($merchantId))
|
@if(isset($merchantId))
|
||||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchantId={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&merchant-id={!! $merchantId !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||||
@else
|
@else
|
||||||
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
<script src="https://www.paypal.com/sdk/js?client-id={!! $client_id !!}&components=card-fields" data-partner-attribution-id="invoiceninja_SP_PPCP"></script>
|
||||||
@endif
|
@endif
|
||||||
|
@ -62,6 +62,38 @@ class PaymentTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testIdempotencyTrigger()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'amount' => 5,
|
||||||
|
'client_id' => $this->client->hashed_id,
|
||||||
|
'invoices' => [
|
||||||
|
[
|
||||||
|
'invoice_id' => $this->invoice->hashed_id,
|
||||||
|
'amount' => 5,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'date' => '2020/12/11',
|
||||||
|
];
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(200);
|
||||||
|
|
||||||
|
$response = $this->withHeaders([
|
||||||
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
|
'X-API-TOKEN' => $this->token,
|
||||||
|
])->postJson('/api/v1/payments/', $data);
|
||||||
|
|
||||||
|
$response->assertStatus(422);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function testInvoicesValidationProp()
|
public function testInvoicesValidationProp()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user