From 4739277b470f304a4146c5571c390a59263f0ed3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 12:42:32 +1100 Subject: [PATCH 01/11] Allow overriding the default locale in .env file --- app/Jobs/Util/Import.php | 2 +- config/app.php | 2 +- lang/en/texts.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 1ed28640e4cc..40305dc6eb20 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -190,7 +190,7 @@ class Import implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company->company_key)]; + return [new WithoutOverlapping("only_one_migration_at_a_time_ever")]; } /** diff --git a/config/app.php b/config/app.php index 445a57e65d66..40e80de7fa27 100644 --- a/config/app.php +++ b/config/app.php @@ -81,7 +81,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => env('DEFAULT_LOCALE', 'en'), /* |-------------------------------------------------------------------------- diff --git a/lang/en/texts.php b/lang/en/texts.php index d9c66e9fedca..c55a6ec412d3 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -4566,9 +4566,9 @@ $LANG = array( 'invalid_time' => 'Invalid Time', 'signed_in_as' => 'Signed in as', 'total_results' => 'Total results', - 'restore_company_gateway' => 'Restore payment gateway', - 'archive_company_gateway' => 'Archive payment gateway', - 'delete_company_gateway' => 'Delete payment gateway', + 'restore_company_gateway' => 'Restore gateway', + 'archive_company_gateway' => 'Archive gateway', + 'delete_company_gateway' => 'Delete gateway', 'exchange_currency' => 'Exchange currency', 'tax_amount1' => 'Tax Amount 1', 'tax_amount2' => 'Tax Amount 2', From b1b9b5d1201b029d1c46564191c2439b01a91383 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 13:00:40 +1100 Subject: [PATCH 02/11] Add Off Session to Stripe Auto Billing request --- app/PaymentDrivers/Stripe/Charge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 36fb40e9a104..2e8ecb0de396 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -79,7 +79,7 @@ class Charge 'payment_method' => $cgt->token, 'customer' => $cgt->gateway_customer_reference, 'confirm' => true, - // 'off_session' => true, + 'off_session' => true, 'description' => $description, 'metadata' => [ 'payment_hash' => $payment_hash->hash, From 252416a5b0b4ce944fd0e7d063ecd6a351e418f6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 13:19:36 +1100 Subject: [PATCH 03/11] improve off session token billing with stripe --- app/PaymentDrivers/Stripe/Charge.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 2e8ecb0de396..467a87fad651 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -79,7 +79,7 @@ class Charge 'payment_method' => $cgt->token, 'customer' => $cgt->gateway_customer_reference, 'confirm' => true, - 'off_session' => true, + // 'off_session' => true, 'description' => $description, 'metadata' => [ 'payment_hash' => $payment_hash->hash, @@ -91,6 +91,11 @@ class Charge $data['payment_method_types'] = ['sepa_debit']; } + /* Should improve token billing with client not present */ + if (!auth()->guard('contact')->check()) { + $data['off_session'] = true; + } + $response = $this->stripe->createPaymentIntent($data, $this->stripe->stripe_connect_auth); SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client, $this->stripe->client->company); From 3869dcccf97dbb38a0ca0e92e21cc662c70ee0a1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 13:27:33 +1100 Subject: [PATCH 04/11] Additional check to ensure recurring invoices have invitations --- app/Jobs/RecurringInvoice/SendRecurring.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index af12aeba7732..dbe8d78dc3fd 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -161,6 +161,11 @@ class SendRecurring implements ShouldQueue */ 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) { $ii = InvoiceInvitationFactory::create($invoice->company_id, $invoice->user_id); $ii->key = $this->createDbHash($invoice->company->db); From 46671e8fd54cf6eccfc047cb99e4ce186dcb5313 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 14:17:56 +1100 Subject: [PATCH 05/11] clean up for old email attachments --- app/Mail/Engine/InvoiceEmailEngine.php | 7 +---- app/Mail/TemplateEmail.php | 41 -------------------------- app/Mail/VendorTemplateEmail.php | 30 ------------------- 3 files changed, 1 insertion(+), 77 deletions(-) diff --git a/app/Mail/Engine/InvoiceEmailEngine.php b/app/Mail/Engine/InvoiceEmailEngine.php index 69810ba626ca..f19d156ebc01 100644 --- a/app/Mail/Engine/InvoiceEmailEngine.php +++ b/app/Mail/Engine/InvoiceEmailEngine.php @@ -127,12 +127,7 @@ class InvoiceEmailEngine extends BaseEmailEngine ->setTextBody($text_body); 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()); $this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]); diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index b5b443657f78..aad3ec35c48e 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -118,50 +118,9 @@ class TemplateEmail extends Mailable '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 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)) $this->attachData(base64_decode($file['file']), $file['name']); else diff --git a/app/Mail/VendorTemplateEmail.php b/app/Mail/VendorTemplateEmail.php index 1ed0ca78f279..0b9e8d1cc835 100644 --- a/app/Mail/VendorTemplateEmail.php +++ b/app/Mail/VendorTemplateEmail.php @@ -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) { - // 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)) $this->attachData(base64_decode($file['file']), $file['name']); else $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]); - } return $this; From 45fe5015978ffcea267642ba6ec998f949f2530e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 15:44:41 +1100 Subject: [PATCH 06/11] Fixes for bank matching serivce --- app/Services/Bank/BankMatchingService.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 02292fef432f..336c29ce9112 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -33,7 +33,11 @@ class BankMatchingService implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(public int $company_id, private string $db){} + public function __construct(protected int $company_id, protected string $db){ + $this->company_id = $company_id; + $this->db = $db; + $this->middleware_key = "bank_match_rate:{$this->company_id}"; + } public function handle() :void { @@ -53,8 +57,6 @@ class BankMatchingService implements ShouldQueue public function middleware() { - $middleware_key = "bank_match_rate:{$this->company_id}"; - - return [new WithoutOverlapping($middleware_key)]; + return [new WithoutOverlapping($this->middleware_key)]; } } From 83700a002d2afa0a80b86fd16c10ea91656fe5f4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 18:42:06 +1100 Subject: [PATCH 07/11] Fixes for linking payments/expenses --- app/Jobs/Bank/MatchBankTransactions.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Jobs/Bank/MatchBankTransactions.php b/app/Jobs/Bank/MatchBankTransactions.php index 183f18ad7245..e52cc7f39a02 100644 --- a/app/Jobs/Bank/MatchBankTransactions.php +++ b/app/Jobs/Bank/MatchBankTransactions.php @@ -182,8 +182,12 @@ class MatchBankTransactions implements ShouldQueue $this->bt->ninja_category_id = $expense->category_id; $this->bt->save(); + $this->bts->push($this->bt->id); + } - + + return $this; + } 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->save(); + $this->bts->push($this->bt->id); } - + + return $this; } private function matchInvoicePayment($input) :self @@ -225,9 +231,9 @@ class MatchBankTransactions implements ShouldQueue $this->createPayment($_invoices, $amount); - } + $this->bts->push($this->bt->id); - $this->bts->push($this->bt->id); + } return $this; } From 0c17e6014f65a6b17a32c4fdd24a5d520ab865e9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 21:26:51 +1100 Subject: [PATCH 08/11] Refactor language translations --- app/Console/Commands/TranslationsExport.php | 6 +++--- composer.lock | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/TranslationsExport.php b/app/Console/Commands/TranslationsExport.php index 5fcf588b0ff5..5021a65ae117 100644 --- a/app/Console/Commands/TranslationsExport.php +++ b/app/Console/Commands/TranslationsExport.php @@ -89,14 +89,14 @@ class TranslationsExport extends Command */ public function handle() { - Storage::makeDirectory(storage_path('lang')); + Storage::disk('local')->makeDirectory('lang'); foreach ($this->langs as $lang) { - Storage::makeDirectory(storage_path("lang/{$lang}")); + Storage::disk('local')->makeDirectory("lang/{$lang}"); $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)); } } } diff --git a/composer.lock b/composer.lock index 145ccaef8c24..f6f61dc1fef5 100644 --- a/composer.lock +++ b/composer.lock @@ -2164,16 +2164,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.276.0", + "version": "v0.277.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "9a0bab5e4472d46bf979e06208da4bd03a5e6103" + "reference": "72e0eacbd51131c954da05edf110d9774f0f5af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/9a0bab5e4472d46bf979e06208da4bd03a5e6103", - "reference": "9a0bab5e4472d46bf979e06208da4bd03a5e6103", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/72e0eacbd51131c954da05edf110d9774f0f5af0", + "reference": "72e0eacbd51131c954da05edf110d9774f0f5af0", "shasum": "" }, "require": { @@ -2202,9 +2202,9 @@ ], "support": { "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", From 7bde5690f4a33c144daf0eb7c09622526a10111e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 21:27:42 +1100 Subject: [PATCH 09/11] refactor bank matching service --- app/Services/Bank/BankMatchingService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index 336c29ce9112..8afb84ff6737 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -33,7 +33,12 @@ class BankMatchingService implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - public function __construct(protected int $company_id, protected 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}"; From fd4064f4e5eea13c48eb00472f6e999def696218 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 22:06:31 +1100 Subject: [PATCH 10/11] Update Stripe to latest API with idempotency keys --- app/PaymentDrivers/Stripe/ACH.php | 2 +- app/PaymentDrivers/Stripe/ACSS.php | 2 +- app/PaymentDrivers/Stripe/BECS.php | 2 +- app/PaymentDrivers/Stripe/Bancontact.php | 2 +- app/PaymentDrivers/Stripe/Charge.php | 2 +- app/PaymentDrivers/Stripe/CreditCard.php | 2 +- app/PaymentDrivers/Stripe/EPS.php | 2 +- app/PaymentDrivers/Stripe/FPX.php | 2 +- app/PaymentDrivers/Stripe/GIROPAY.php | 2 +- app/PaymentDrivers/Stripe/PRZELEWY24.php | 2 +- app/PaymentDrivers/Stripe/SEPA.php | 2 +- app/PaymentDrivers/Stripe/SOFORT.php | 2 +- app/PaymentDrivers/Stripe/iDeal.php | 2 +- app/PaymentDrivers/StripePaymentDriver.php | 8 ++++---- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index 517022afcb82..5a5d893dfeb0 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -69,7 +69,7 @@ class ACH $customer = $this->stripe->findOrCreateCustomer(); 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) { throw new PaymentFailed($e->getMessage(), $e->getCode()); } diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index e9255b3bbbae..ecbf7bee19cf 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -55,7 +55,7 @@ class ACSS $customer = $this->stripe->findOrCreateCustomer(); 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) { throw new PaymentFailed($e->getMessage(), $e->getCode()); } diff --git a/app/PaymentDrivers/Stripe/BECS.php b/app/PaymentDrivers/Stripe/BECS.php index 942135eca767..40d1864cfb31 100644 --- a/app/PaymentDrivers/Stripe/BECS.php +++ b/app/PaymentDrivers/Stripe/BECS.php @@ -60,7 +60,7 @@ class BECS 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/Bancontact.php b/app/PaymentDrivers/Stripe/Bancontact.php index ae58f1b504ed..7bf2504301ad 100644 --- a/app/PaymentDrivers/Stripe/Bancontact.php +++ b/app/PaymentDrivers/Stripe/Bancontact.php @@ -57,7 +57,7 @@ class 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; diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 467a87fad651..b0e5f1a17ce9 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -96,7 +96,7 @@ class Charge $data['off_session'] = true; } - $response = $this->stripe->createPaymentIntent($data, $this->stripe->stripe_connect_auth); + $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); } catch (\Exception $e) { diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index 64b9df528317..e9bba8bd26e9 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -112,7 +112,7 @@ class CreditCard $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; $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $state); diff --git a/app/PaymentDrivers/Stripe/EPS.php b/app/PaymentDrivers/Stripe/EPS.php index 6a9b6a56e2f8..d9abbc4567ac 100644 --- a/app/PaymentDrivers/Stripe/EPS.php +++ b/app/PaymentDrivers/Stripe/EPS.php @@ -56,7 +56,7 @@ class EPS 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/FPX.php b/app/PaymentDrivers/Stripe/FPX.php index 914442e1edd8..de1a31e12fbb 100644 --- a/app/PaymentDrivers/Stripe/FPX.php +++ b/app/PaymentDrivers/Stripe/FPX.php @@ -57,7 +57,7 @@ class FPX 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/GIROPAY.php b/app/PaymentDrivers/Stripe/GIROPAY.php index 8655eec5f2fe..f726ee3c91a8 100644 --- a/app/PaymentDrivers/Stripe/GIROPAY.php +++ b/app/PaymentDrivers/Stripe/GIROPAY.php @@ -56,7 +56,7 @@ class GIROPAY 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/PRZELEWY24.php b/app/PaymentDrivers/Stripe/PRZELEWY24.php index 71264afc58b9..ca15c1aa7a68 100644 --- a/app/PaymentDrivers/Stripe/PRZELEWY24.php +++ b/app/PaymentDrivers/Stripe/PRZELEWY24.php @@ -56,7 +56,7 @@ class PRZELEWY24 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/SEPA.php b/app/PaymentDrivers/Stripe/SEPA.php index 0b817b8146ae..53af6f9e582c 100644 --- a/app/PaymentDrivers/Stripe/SEPA.php +++ b/app/PaymentDrivers/Stripe/SEPA.php @@ -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; diff --git a/app/PaymentDrivers/Stripe/SOFORT.php b/app/PaymentDrivers/Stripe/SOFORT.php index 54ed593dcdd4..cb348ac8fb1f 100644 --- a/app/PaymentDrivers/Stripe/SOFORT.php +++ b/app/PaymentDrivers/Stripe/SOFORT.php @@ -56,7 +56,7 @@ class SOFORT 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/Stripe/iDeal.php b/app/PaymentDrivers/Stripe/iDeal.php index 3abed0380f42..61fb90540d05 100644 --- a/app/PaymentDrivers/Stripe/iDeal.php +++ b/app/PaymentDrivers/Stripe/iDeal.php @@ -56,7 +56,7 @@ class iDeal 'payment_hash' => $this->stripe->payment_hash->hash, '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; diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index b0d5751e539a..178ce44bbb59 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -122,7 +122,7 @@ class StripePaymentDriver extends BaseDriver ); 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; - 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']; $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']['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) { throw new Exception('Unable to create gateway customer'); From 50b70fca1d796f159562813fd09909730c18a055 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 5 Dec 2022 22:10:27 +1100 Subject: [PATCH 11/11] version bump --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 76e6614d19ce..fb0a65a36d57 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.5.45 \ No newline at end of file +5.5.46 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 86bf16e7f990..ac016b05b760 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.5.45', - 'app_tag' => '5.5.45', + 'app_version' => '5.5.46', + 'app_tag' => '5.5.46', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),