mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Minor fixeS
This commit is contained in:
parent
cb823ef8b5
commit
b1454d11ab
@ -110,7 +110,8 @@ class UpdateCompanyRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
$settings['email_style_custom'] = str_replace(['{{','}}'], ['',''], $settings['email_style_custom']);
|
||||
if(isset($settings['email_style_custom']))
|
||||
$settings['email_style_custom'] = str_replace(['{{','}}'], ['',''], $settings['email_style_custom']);
|
||||
|
||||
if (! $account->isFreeHostedClient()) {
|
||||
return $settings;
|
||||
|
@ -117,6 +117,11 @@ class Vendor extends BaseModel
|
||||
|
||||
}
|
||||
|
||||
public function timezone()
|
||||
{
|
||||
return $this->company->timezone();
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
|
@ -627,18 +627,16 @@ class StripePaymentDriver extends BaseDriver
|
||||
|
||||
public function processWebhookRequest(PaymentWebhookRequest $request)
|
||||
{
|
||||
// Allow app to catch up with webhook request.
|
||||
sleep(2);
|
||||
|
||||
//payment_intent.succeeded - this will confirm or cancel the payment
|
||||
if ($request->type === 'payment_intent.succeeded') {
|
||||
PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(rand(2, 10)));
|
||||
PaymentIntentWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(rand(5, 10)));
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
||||
if (in_array($request->type, ['payment_intent.payment_failed', 'charge.failed'])) {
|
||||
PaymentIntentFailureWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(rand(2, 10)));
|
||||
PaymentIntentFailureWebhook::dispatch($request->data, $request->company_key, $this->company_gateway->id)->delay(now()->addSeconds(rand(5, 10)));
|
||||
|
||||
return response()->json([], 200);
|
||||
}
|
||||
|
@ -129,12 +129,12 @@ class Helpers
|
||||
|
||||
if(!$string_hit)
|
||||
return $value;
|
||||
// 04-10-2022 Return Early if no reserved keywords are present, this is a very expensive process
|
||||
|
||||
// 04-10-2022 Return Early if no reserved keywords are present, this is a very expensive process
|
||||
Carbon::setLocale($entity->locale());
|
||||
|
||||
if (!$currentDateTime) {
|
||||
$currentDateTime = Carbon::now();
|
||||
$currentDateTime = Carbon::now()->timezone($entity->timezone()->name);
|
||||
}
|
||||
|
||||
$replacements = [
|
||||
|
@ -52,7 +52,7 @@ trait SettingsSaver
|
||||
continue;
|
||||
}
|
||||
/*Separate loop if it is a _id field which is an integer cast as a string*/
|
||||
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter' || ($key == 'payment_terms' && strlen($settings->{$key}) >= 1) || ($key == 'valid_until' && property_exists($settings, $key) && strlen($settings->{$key}) >= 1)) {
|
||||
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter' || ($key == 'payment_terms' && property_exists($settings, $key) && strlen($settings->{$key}) >= 1) || ($key == 'valid_until' && property_exists($settings, $key) && strlen($settings->{$key}) >= 1)) {
|
||||
$value = 'integer';
|
||||
|
||||
if($key == 'gmail_sending_user_id' || $key == 'besr_id')
|
||||
|
@ -70,4 +70,14 @@ class DatesTest extends TestCase
|
||||
|
||||
$this->assertFalse($date_in_future->gt(Carbon::parse($date_in_past)->addDays(14)));
|
||||
}
|
||||
|
||||
/*Test time travelling behaves as expected */
|
||||
public function testTimezoneShifts()
|
||||
{
|
||||
$this->travel(Carbon::parse('2022-12-20'));
|
||||
|
||||
$this->assertEquals('2022-12-20', now()->setTimeZone('Pacific/Midway')->format('Y-m-d'));
|
||||
|
||||
$this->travelBack();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user