Fixes for checkout reference lengths

This commit is contained in:
David Bomba 2022-12-23 21:45:33 +11:00
parent 6400ece913
commit 22b2a50526
2 changed files with 17 additions and 16 deletions

View File

@ -119,7 +119,8 @@ class CheckData extends Command
$this->checkDuplicateRecurringInvoices();
$this->checkOauthSanity();
$this->checkVendorSettings();
$this->checkClientSettings();
if(Ninja::isHosted()){
$this->checkAccountStatuses();
$this->checkNinjaPortalUrls();
@ -952,24 +953,24 @@ class CheckData extends Command
if ($this->option('fix') == 'true') {
Client::query()->whereNull('settings->currency_id')->cursor()->each(function ($client){
// Client::query()->whereNull('settings->currency_id')->cursor()->each(function ($client){
if(is_array($client->settings) && count($client->settings) == 0)
{
$settings = ClientSettings::defaults();
$settings->currency_id = $client->company->settings->currency_id;
}
else {
$settings = $client->settings;
$settings->currency_id = $client->company->settings->currency_id;
}
// if(is_array($client->settings) && count($client->settings) == 0)
// {
// $settings = ClientSettings::defaults();
// $settings->currency_id = $client->company->settings->currency_id;
// }
// else {
// $settings = $client->settings;
// $settings->currency_id = $client->company->settings->currency_id;
// }
$client->settings = $settings;
$client->save();
// $client->settings = $settings;
// $client->save();
$this->logMessage("Fixing currency for # {$client->id}");
// $this->logMessage("Fixing currency for # {$client->id}");
});
// });
Client::query()->whereNull('country_id')->cursor()->each(function ($client){

View File

@ -230,7 +230,7 @@ class CreditCard implements MethodInterface
private function completePayment($paymentRequest, PaymentResponseRequest $request)
{
$paymentRequest->amount = $this->checkout->payment_hash->data->value;
$paymentRequest->reference = $this->checkout->getDescription();
$paymentRequest->reference = substr($this->checkout->getDescription(),0 , 49);
$paymentRequest->customer = $this->checkout->getCustomer();
$paymentRequest->metadata = ['udf1' => 'Invoice Ninja'];
$paymentRequest->currency = $this->checkout->client->getCurrencyCode();