Merge pull request #8037 from turbo124/v5-develop

v5.5.46
This commit is contained in:
David Bomba 2022-12-05 22:11:30 +11:00 committed by GitHub
commit 5580f3c924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 66 additions and 119 deletions

View File

@ -1 +1 @@
5.5.45 5.5.46

View File

@ -89,14 +89,14 @@ class TranslationsExport extends Command
*/ */
public function handle() public function handle()
{ {
Storage::makeDirectory(storage_path('lang')); Storage::disk('local')->makeDirectory('lang');
foreach ($this->langs as $lang) { foreach ($this->langs as $lang) {
Storage::makeDirectory(storage_path("lang/{$lang}")); Storage::disk('local')->makeDirectory("lang/{$lang}");
$translations = Lang::getLoader()->load($lang, 'texts'); $translations = Lang::getLoader()->load($lang, 'texts');
Storage::put(storage_path("lang/{$lang}/{$lang}.json"), json_encode(Arr::dot($translations), JSON_UNESCAPED_UNICODE)); Storage::disk('local')->put("lang/{$lang}/{$lang}.json", json_encode(Arr::dot($translations), JSON_UNESCAPED_UNICODE));
} }
} }
} }

View File

@ -182,8 +182,12 @@ class MatchBankTransactions implements ShouldQueue
$this->bt->ninja_category_id = $expense->category_id; $this->bt->ninja_category_id = $expense->category_id;
$this->bt->save(); $this->bt->save();
$this->bts->push($this->bt->id);
} }
return $this;
} }
private function linkPayment($input) private function linkPayment($input)
@ -206,8 +210,10 @@ class MatchBankTransactions implements ShouldQueue
$this->bt->invoice_ids = collect($payment->invoices)->pluck('hashed_id')->implode(','); $this->bt->invoice_ids = collect($payment->invoices)->pluck('hashed_id')->implode(',');
$this->bt->save(); $this->bt->save();
$this->bts->push($this->bt->id);
} }
return $this;
} }
private function matchInvoicePayment($input) :self private function matchInvoicePayment($input) :self
@ -225,9 +231,9 @@ class MatchBankTransactions implements ShouldQueue
$this->createPayment($_invoices, $amount); $this->createPayment($_invoices, $amount);
} $this->bts->push($this->bt->id);
$this->bts->push($this->bt->id); }
return $this; return $this;
} }

View File

@ -161,6 +161,11 @@ class SendRecurring implements ShouldQueue
*/ */
private function createRecurringInvitations($invoice) :Invoice private function createRecurringInvitations($invoice) :Invoice
{ {
if($this->recurring_invoice->invitations->count() == 0) {
$this->recurring_invoice = $this->recurring_invoice->service()->createInvitations()->save();
}
$this->recurring_invoice->invitations->each(function ($recurring_invitation) use ($invoice) { $this->recurring_invoice->invitations->each(function ($recurring_invitation) use ($invoice) {
$ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); $ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id);
$ii->key = $this->createDbHash($invoice->company->db); $ii->key = $this->createDbHash($invoice->company->db);

View File

@ -190,7 +190,7 @@ class Import implements ShouldQueue
public function middleware() public function middleware()
{ {
return [new WithoutOverlapping($this->company->company_key)]; return [new WithoutOverlapping("only_one_migration_at_a_time_ever")];
} }
/** /**

View File

@ -127,12 +127,7 @@ class InvoiceEmailEngine extends BaseEmailEngine
->setTextBody($text_body); ->setTextBody($text_body);
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) { if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
// if (Ninja::isHosted()) {
// $this->setAttachments([$this->invoice->pdf_file_path($this->invitation, 'url', true)]);
// } else {
// $this->setAttachments([$this->invoice->pdf_file_path($this->invitation)]);
// }
// $file = (new CreateRawPdf($invitation, $invitation->company->db))->handle();
$pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle()); $pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle());
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]); $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]);

View File

@ -118,50 +118,9 @@ class TemplateEmail extends Mailable
'logo' => $this->company->present()->logo($settings), 'logo' => $this->company->present()->logo($settings),
]); ]);
/*In the hosted platform we need to slow things down a little for Storage to catch up.*/
// if(Ninja::isHosted() && $this->invitation){
// $path = false;
// if($this->invitation->invoice)
// $path = $this->client->invoice_filepath($this->invitation).$this->invitation->invoice->numberFormatter().'.pdf';
// elseif($this->invitation->quote)
// $path = $this->client->quote_filepath($this->invitation).$this->invitation->quote->numberFormatter().'.pdf';
// elseif($this->invitation->credit)
// $path = $this->client->credit_filepath($this->invitation).$this->invitation->credit->numberFormatter().'.pdf';
// sleep(1);
// if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
// sleep(2);
// if(!Storage::disk(config('filesystems.default'))->exists($path)) {
// (new CreateEntityPdf($this->invitation))->handle();
// sleep(2);
// }
// }
// }
// $file = (new CreateRawPdf($invitation, $invitation->company->db))->handle();
//22-10-2022 - Performance - To improve the performance/reliability of sending emails, attaching as Data is much better, stubs in place //22-10-2022 - Performance - To improve the performance/reliability of sending emails, attaching as Data is much better, stubs in place
foreach ($this->build_email->getAttachments() as $file) { foreach ($this->build_email->getAttachments() as $file) {
// if (is_string($file)) {
// // nlog($file);
// // $file_data = file_get_contents($file);
// // $this->attachData($file_data, basename($file));
// $this->attach($file);
// } elseif (is_array($file)) {
// // nlog($file['path']);
// // $file_data = file_get_contents($file['path']);
// // $this->attachData($file_data, $file['name']);
// $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
// }
if(array_key_exists('file', $file)) if(array_key_exists('file', $file))
$this->attachData(base64_decode($file['file']), $file['name']); $this->attachData(base64_decode($file['file']), $file['name']);
else else

View File

@ -112,43 +112,13 @@ class VendorTemplateEmail extends Mailable
]); ]);
// if(Ninja::isHosted() && $this->invitation){
// $path = false;
// if($this->invitation->purchase_order)
// $path = $this->vendor->purchase_order_filepath($this->invitation).$this->invitation->purchase_order->numberFormatter().'.pdf';
// sleep(1);
// if($path && !Storage::disk(config('filesystems.default'))->exists($path)){
// sleep(2);
// if(!Storage::disk(config('filesystems.default'))->exists($path)) {
// (new CreatePurchaseOrderPdf($this->invitation))->handle();
// sleep(2);
// }
// }
// }
foreach ($this->build_email->getAttachments() as $file) { foreach ($this->build_email->getAttachments() as $file) {
// if (is_string($file)) {
// $this->attach($file);
// } elseif (is_array($file)) {
// $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
// }
// $this->attachData(base64_decode($file['file']), $file['name']);
if(array_key_exists('file', $file)) if(array_key_exists('file', $file))
$this->attachData(base64_decode($file['file']), $file['name']); $this->attachData(base64_decode($file['file']), $file['name']);
else else
$this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
} }
return $this; return $this;

View File

@ -69,7 +69,7 @@ class ACH
$customer = $this->stripe->findOrCreateCustomer(); $customer = $this->stripe->findOrCreateCustomer();
try { try {
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth); $source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
} catch (InvalidRequestException $e) { } catch (InvalidRequestException $e) {
throw new PaymentFailed($e->getMessage(), $e->getCode()); throw new PaymentFailed($e->getMessage(), $e->getCode());
} }

View File

@ -55,7 +55,7 @@ class ACSS
$customer = $this->stripe->findOrCreateCustomer(); $customer = $this->stripe->findOrCreateCustomer();
try { try {
$source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], $this->stripe->stripe_connect_auth); $source = Customer::createSource($customer->id, ['source' => $stripe_response->token->id], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
} catch (InvalidRequestException $e) { } catch (InvalidRequestException $e) {
throw new PaymentFailed($e->getMessage(), $e->getCode()); throw new PaymentFailed($e->getMessage(), $e->getCode());
} }

View File

@ -60,7 +60,7 @@ class BECS
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::BECS, 'gateway_type_id' => GatewayType::BECS,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -57,7 +57,7 @@ class Bancontact
'gateway_type_id' => GatewayType::BANCONTACT, 'gateway_type_id' => GatewayType::BANCONTACT,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -91,7 +91,12 @@ class Charge
$data['payment_method_types'] = ['sepa_debit']; $data['payment_method_types'] = ['sepa_debit'];
} }
$response = $this->stripe->createPaymentIntent($data, $this->stripe->stripe_connect_auth); /* Should improve token billing with client not present */
if (!auth()->guard('contact')->check()) {
$data['off_session'] = true;
}
$response = $this->stripe->createPaymentIntent($data, array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client, $this->stripe->client->company); SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client, $this->stripe->client->company);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -112,7 +112,7 @@ class CreditCard
$state['store_card'] = false; $state['store_card'] = false;
} }
$state['payment_intent'] = PaymentIntent::retrieve($state['server_response']->id, $this->stripe->stripe_connect_auth); $state['payment_intent'] = PaymentIntent::retrieve($state['server_response']->id, array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$state['customer'] = $state['payment_intent']->customer; $state['customer'] = $state['payment_intent']->customer;
$this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $state); $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $state);

View File

@ -56,7 +56,7 @@ class EPS
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::EPS, 'gateway_type_id' => GatewayType::EPS,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -57,7 +57,7 @@ class FPX
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::FPX, 'gateway_type_id' => GatewayType::FPX,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -56,7 +56,7 @@ class GIROPAY
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::GIROPAY, 'gateway_type_id' => GatewayType::GIROPAY,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -56,7 +56,7 @@ class PRZELEWY24
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::PRZELEWY24, 'gateway_type_id' => GatewayType::PRZELEWY24,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -67,7 +67,7 @@ class SEPA
], ],
]; ];
$intent = \Stripe\PaymentIntent::create($intent_data, $this->stripe->stripe_connect_auth); $intent = \Stripe\PaymentIntent::create($intent_data, array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -56,7 +56,7 @@ class SOFORT
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::SOFORT, 'gateway_type_id' => GatewayType::SOFORT,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -56,7 +56,7 @@ class iDeal
'payment_hash' => $this->stripe->payment_hash->hash, 'payment_hash' => $this->stripe->payment_hash->hash,
'gateway_type_id' => GatewayType::IDEAL, 'gateway_type_id' => GatewayType::IDEAL,
], ],
], $this->stripe->stripe_connect_auth); ], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -122,7 +122,7 @@ class StripePaymentDriver extends BaseDriver
); );
Stripe::setApiKey($this->company_gateway->getConfigField('apiKey')); Stripe::setApiKey($this->company_gateway->getConfigField('apiKey'));
// Stripe::setApiVersion('2022-11-15'); Stripe::setApiVersion('2022-11-15');
} }
@ -387,7 +387,7 @@ class StripePaymentDriver extends BaseDriver
$meta = $this->stripe_connect_auth; $meta = $this->stripe_connect_auth;
return PaymentIntent::create($data, $meta); return PaymentIntent::create($data, array_merge($meta, ['idempotency_key' => uniqid("st",true)]));
} }
/** /**
@ -404,7 +404,7 @@ class StripePaymentDriver extends BaseDriver
$params = ['usage' => 'off_session']; $params = ['usage' => 'off_session'];
$meta = $this->stripe_connect_auth; $meta = $this->stripe_connect_auth;
return SetupIntent::create($params, $meta); return SetupIntent::create($params, array_merge($meta, ['idempotency_key' => uniqid("st",true)]));
} }
/** /**
@ -481,7 +481,7 @@ class StripePaymentDriver extends BaseDriver
$data['address']['state'] = $this->client->state; $data['address']['state'] = $this->client->state;
$data['address']['country'] = $this->client->country ? $this->client->country->iso_3166_2 : ''; $data['address']['country'] = $this->client->country ? $this->client->country->iso_3166_2 : '';
$customer = Customer::create($data, $this->stripe_connect_auth); $customer = Customer::create($data, array_merge($this->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
if (! $customer) { if (! $customer) {
throw new Exception('Unable to create gateway customer'); throw new Exception('Unable to create gateway customer');

View File

@ -33,7 +33,16 @@ class BankMatchingService implements ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public int $company_id, private string $db){} protected $company_id;
protected $db;
public function __construct($company_id, $db)
{
$this->company_id = $company_id;
$this->db = $db;
$this->middleware_key = "bank_match_rate:{$this->company_id}";
}
public function handle() :void public function handle() :void
{ {
@ -53,8 +62,6 @@ class BankMatchingService implements ShouldQueue
public function middleware() public function middleware()
{ {
$middleware_key = "bank_match_rate:{$this->company_id}"; return [new WithoutOverlapping($this->middleware_key)];
return [new WithoutOverlapping($middleware_key)];
} }
} }

12
composer.lock generated
View File

@ -2164,16 +2164,16 @@
}, },
{ {
"name": "google/apiclient-services", "name": "google/apiclient-services",
"version": "v0.276.0", "version": "v0.277.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git", "url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "9a0bab5e4472d46bf979e06208da4bd03a5e6103" "reference": "72e0eacbd51131c954da05edf110d9774f0f5af0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/9a0bab5e4472d46bf979e06208da4bd03a5e6103", "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/72e0eacbd51131c954da05edf110d9774f0f5af0",
"reference": "9a0bab5e4472d46bf979e06208da4bd03a5e6103", "reference": "72e0eacbd51131c954da05edf110d9774f0f5af0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2202,9 +2202,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues", "issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.276.0" "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.277.0"
}, },
"time": "2022-11-25T01:16:27+00:00" "time": "2022-12-05T01:04:16+00:00"
}, },
{ {
"name": "google/auth", "name": "google/auth",

View File

@ -81,7 +81,7 @@ return [
| |
*/ */
'locale' => 'en', 'locale' => env('DEFAULT_LOCALE', 'en'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.45', 'app_version' => '5.5.46',
'app_tag' => '5.5.45', 'app_tag' => '5.5.46',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),

View File

@ -4566,9 +4566,9 @@ $LANG = array(
'invalid_time' => 'Invalid Time', 'invalid_time' => 'Invalid Time',
'signed_in_as' => 'Signed in as', 'signed_in_as' => 'Signed in as',
'total_results' => 'Total results', 'total_results' => 'Total results',
'restore_company_gateway' => 'Restore payment gateway', 'restore_company_gateway' => 'Restore gateway',
'archive_company_gateway' => 'Archive payment gateway', 'archive_company_gateway' => 'Archive gateway',
'delete_company_gateway' => 'Delete payment gateway', 'delete_company_gateway' => 'Delete gateway',
'exchange_currency' => 'Exchange currency', 'exchange_currency' => 'Exchange currency',
'tax_amount1' => 'Tax Amount 1', 'tax_amount1' => 'Tax Amount 1',
'tax_amount2' => 'Tax Amount 2', 'tax_amount2' => 'Tax Amount 2',