diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef67001aca93..31e5e8a4e0b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,7 @@ jobs: php artisan key:generate php artisan optimize php artisan storage:link + php artisan livewire:publish sudo php artisan cache:clear sudo find ./vendor/bin/ -type f -exec chmod +x {} \; sudo find ./ -type d -exec chmod 755 {} \; diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index c6fed355f509..0368c71e98f9 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -31,8 +31,6 @@ class AccountController extends BaseController public function __construct() { parent::__construct(); - - //$this->middleware('guest'); } /** diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index f3f8155851aa..b4c35f59d866 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -598,7 +598,7 @@ class ClientController extends BaseController * * @OA\Put( * path="/api/v1/clients/{id}/purge", - * operationId="uploadClient", + * operationId="purgeClient", * tags={"clients"}, * summary="Purges a client from the system", * description="Handles purging a client", diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 42cd3598d1b4..53f643794582 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -163,7 +163,7 @@ class InvoiceController extends Controller //format data $invoices->map(function ($invoice) { - $invoice->service()->removeUnpaidGatewayFees()->save(); + $invoice->service()->removeUnpaidGatewayFees(); $invoice->balance = $invoice->balance > 0 ? Number::formatValue($invoice->balance, $invoice->client->currency()) : 0; $invoice->partial = $invoice->partial > 0 ? Number::formatValue($invoice->partial, $invoice->client->currency()) : 0; diff --git a/app/Http/Controllers/OpenAPI/ClientSchema.php b/app/Http/Controllers/OpenAPI/ClientSchema.php index 7198eb027f30..9a593d44623d 100644 --- a/app/Http/Controllers/OpenAPI/ClientSchema.php +++ b/app/Http/Controllers/OpenAPI/ClientSchema.php @@ -26,7 +26,7 @@ * @OA\Property(property="state", type="string", example="", description="________"), * @OA\Property(property="postal_code", type="string", example="", description="________"), * @OA\Property(property="phone", type="string", example="555-3434-3434", description="The client phone number"), - * @OA\Property(property="country_id", type="string", example="", description="________"), + * @OA\Property(property="country_id", type="number", format="integer", example="1", description="________"), * @OA\Property(property="custom_value1", type="string", example="", description="________"), * @OA\Property(property="custom_value2", type="string", example="", description="________"), * @OA\Property(property="custom_value3", type="string", example="", description="________"), @@ -39,7 +39,7 @@ * @OA\Property(property="shipping_city", type="string", example="", description="________"), * @OA\Property(property="shipping_state", type="string", example="", description="________"), * @OA\Property(property="shipping_postal_code", type="string", example="", description="________"), - * @OA\Property(property="shipping_country_id", type="string", example="", description="________"), + * @OA\Property(property="shipping_country_id", type="number", format="integer", example="", description="________"), * @OA\Property(property="is_deleted", type="boolean", example=true, description="________"), * @OA\Property(property="balance", type="number", format="float", example="10.00", description="________"), * @OA\Property(property="paid_to_date", type="number", format="float", example="10.00", description="________"), diff --git a/app/Http/Controllers/SubdomainController.php b/app/Http/Controllers/SubdomainController.php index 166d7402cce3..de0caaa2d477 100644 --- a/app/Http/Controllers/SubdomainController.php +++ b/app/Http/Controllers/SubdomainController.php @@ -33,6 +33,7 @@ class SubdomainController extends BaseController 'sandbox', 'stage', 'html', + 'lb', ]; public function __construct() diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index 651fd146a2b5..5b7c1ae7b94f 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -50,6 +50,8 @@ class StoreClientRequest extends Request if (isset($this->number)) { $rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id); } + + $rules['country_id'] = 'integer|nullable'; if(isset($this->currency_code)){ $rules['currency_code'] = 'sometimes|exists:currencies,code'; @@ -120,6 +122,10 @@ class StoreClientRequest extends Request $settings->currency_id = $this->getCurrencyCode($input['currency_code']); } + if (isset($input['language_code'])) { + $settings->language_id = $this->getLanguageId($input['language_code']); + } + $input['settings'] = $settings; if (isset($input['country_code'])) { @@ -147,6 +153,21 @@ class StoreClientRequest extends Request ]; } + private function getLanguageId($language_code) + { + $languages = Cache::get('languages'); + + $language = $languages->filter(function ($item) use ($language_code) { + return $item->locale == $language_code; + })->first(); + + if($language) + return (string) $language->id; + + return ""; + } + + private function getCountryCode($country_code) { $countries = Cache::get('countries'); diff --git a/app/Http/Requests/Client/UpdateClientRequest.php b/app/Http/Requests/Client/UpdateClientRequest.php index 2976c5baee38..c8d60ceeb5ec 100644 --- a/app/Http/Requests/Client/UpdateClientRequest.php +++ b/app/Http/Requests/Client/UpdateClientRequest.php @@ -16,6 +16,7 @@ use App\Http\Requests\Request; use App\Http\ValidationRules\ValidClientGroupSettingsRule; use App\Utils\Traits\ChecksEntityStatus; use App\Utils\Traits\MakesHash; +use Illuminate\Support\Facades\Cache; use Illuminate\Validation\Rule; class UpdateClientRequest extends Request @@ -103,6 +104,10 @@ class UpdateClientRequest extends Request $input['settings']['currency_id'] = (string) auth()->user()->company()->settings->currency_id; } + if (isset($input['language_code'])) { + $input['settings']['language_id'] = $this->getLanguageId($input['language_code']); + } + $input = $this->decodePrimaryKeys($input); if (array_key_exists('settings', $input)) { @@ -112,6 +117,22 @@ class UpdateClientRequest extends Request $this->replace($input); } + + private function getLanguageId($language_code) + { + $languages = Cache::get('languages'); + + $language = $languages->filter(function ($item) use ($language_code) { + return $item->locale == $language_code; + })->first(); + + if($language) + return (string) $language->id; + + return ""; + } + + /** * For the hosted platform, we restrict the feature settings. * diff --git a/app/Http/Requests/Statements/CreateStatementRequest.php b/app/Http/Requests/Statements/CreateStatementRequest.php index 804cd071dbfd..05d043b6a7c6 100644 --- a/app/Http/Requests/Statements/CreateStatementRequest.php +++ b/app/Http/Requests/Statements/CreateStatementRequest.php @@ -16,7 +16,10 @@ class CreateStatementRequest extends Request */ public function authorize(): bool { - return auth()->user()->isAdmin(); + // return auth()->user()->isAdmin(); + + return auth()->user()->can('view', $this->client()); + } /** @@ -52,7 +55,6 @@ class CreateStatementRequest extends Request public function client(): ?Client { - // return Client::without('gateway_tokens','documents','contacts.company',)->where('id', $this->client_id)->withTrashed()->first(); - return Client::without('company',)->where('id', $this->client_id)->withTrashed()->first(); + return Client::without('company')->where('id', $this->client_id)->withTrashed()->first(); } } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 5d7692913a6e..d30948bc3b87 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1477,6 +1477,9 @@ class Import implements ShouldQueue $modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']); } + if(!array_key_exists('accepted_credit_cards', $modified) || (array_key_exists('accepted_credit_cards', $modified) && empty($modified['accepted_credit_cards']))) + $modified['accepted_credit_cards'] = 0; + // /* On Hosted platform we need to advise Stripe users to connect with Stripe Connect */ if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){ @@ -1488,9 +1491,6 @@ class Import implements ShouldQueue NinjaMailerJob::dispatch($nmo, true); $modified['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34'; - - //why do we set this to a blank array? - //$modified['fees_and_limits'] = []; } diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 36f730224711..2841ebd1bfc2 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -349,7 +349,7 @@ class BaseDriver extends AbstractPaymentDriver $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->get(); $invoices->each(function ($invoice) { - $invoice->service()->removeUnpaidGatewayFees()->save(); + $invoice->service()->removeUnpaidGatewayFees(); }); } diff --git a/app/PaymentDrivers/Eway/CreditCard.php b/app/PaymentDrivers/Eway/CreditCard.php index 98982d534661..e1bc090ba3f6 100644 --- a/app/PaymentDrivers/Eway/CreditCard.php +++ b/app/PaymentDrivers/Eway/CreditCard.php @@ -160,6 +160,7 @@ class CreditCard 'TotalAmount' => $this->convertAmountForEway(), 'CurrencyCode' => $this->eway_driver->client->currency()->code, 'InvoiceNumber' => $invoice_numbers, + 'InvoiceDescription' => substr($invoice_numbers, 0, 63) ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, 'SecuredCardData' => $request->input('securefieldcode'), @@ -249,6 +250,7 @@ class CreditCard 'TotalAmount' => $this->convertAmountForEway($amount), 'CurrencyCode' => $this->eway_driver->client->currency()->code, 'InvoiceNumber' => $invoice_numbers, + 'InvoiceDescription' => substr($invoice_numbers, 0, 63) ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, ]; diff --git a/app/PaymentDrivers/Eway/Token.php b/app/PaymentDrivers/Eway/Token.php index 1d40f7cc01f0..1d5ea2422ba3 100644 --- a/app/PaymentDrivers/Eway/Token.php +++ b/app/PaymentDrivers/Eway/Token.php @@ -61,8 +61,7 @@ class Token 'TotalAmount' => $this->eway_driver->convertAmount($amount), 'CurrencyCode' => $this->eway_driver->client->currency()->code, 'InvoiceNumber' => $invoice_numbers, - 'InvoiceDescription' => $description, - 'InvoiceReference' => $description, + 'InvoiceDescription' => substr($description, 0,63), ], 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, ]; diff --git a/app/PaymentDrivers/Sample/PaymentDriver.php b/app/PaymentDrivers/Sample/PaymentDriver.php index 71cbb77e540d..ad827919bd5b 100644 --- a/app/PaymentDrivers/Sample/PaymentDriver.php +++ b/app/PaymentDrivers/Sample/PaymentDriver.php @@ -17,6 +17,7 @@ use App\Models\GatewayType; use App\Models\Payment; use App\Models\PaymentHash; use App\Models\SystemLog; +use App\PaymentDrivers\BaseDriver; use App\Utils\Traits\MakesHash; class PaymentDriver extends BaseDriver diff --git a/app/Services/ClientPortal/InstantPayment.php b/app/Services/ClientPortal/InstantPayment.php index c628c803f853..743f92fe58d4 100644 --- a/app/Services/ClientPortal/InstantPayment.php +++ b/app/Services/ClientPortal/InstantPayment.php @@ -72,8 +72,7 @@ class InstantPayment $invoices->each(function($invoice){ $invoice->service() ->markSent() - ->removeUnpaidGatewayFees() - ->save(); + ->removeUnpaidGatewayFees(); }); /* pop non payable invoice from the $payable_invoices array */ diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 761069a3b763..26ea686c077e 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -125,7 +125,7 @@ class AutoBillInvoice extends AbstractService } catch(\Exception $e){ nlog("payment NOT captured for ". $this->invoice->number . " with error " . $e->getMessage()); - $this->invoice->service()->removeUnpaidGatewayFees()->save(); + $this->invoice->service()->removeUnpaidGatewayFees(); } if($payment){ diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index f38e588fab3d..8ecc39274f44 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -324,7 +324,7 @@ class InvoiceService return $item; })->toArray(); - $this->deletePdf(); + $this->touchPdf(); return $this; } @@ -370,11 +370,14 @@ class InvoiceService })->toArray(); $this->invoice = $this->invoice->calc()->getInvoice(); - + /* 24-03-2022 */ $new_balance = $this->invoice->balance; - if($pre_count != count($this->invoice->line_items)) + $post_count = count($this->invoice->line_items); + nlog("pre count = {$pre_count} post count = {$post_count}"); + + if((int)$pre_count != (int)$post_count) { $adjustment = $balance - $new_balance; diff --git a/app/Services/Ledger/LedgerService.php b/app/Services/Ledger/LedgerService.php index 2724b43f86df..150a0b534d0f 100644 --- a/app/Services/Ledger/LedgerService.php +++ b/app/Services/Ledger/LedgerService.php @@ -48,7 +48,7 @@ class LedgerService $this->entity->company_ledger()->save($company_ledger); - }, 5); + }, 1); // \DB::connection(config('database.default'))->commit(); @@ -80,7 +80,7 @@ class LedgerService $this->entity->company_ledger()->save($company_ledger); - }, 5); + }, 1); // \DB::connection(config('database.default'))->commit(); @@ -111,7 +111,7 @@ class LedgerService $this->entity->company_ledger()->save($company_ledger); - }, 5); + }, 1); // \DB::connection(config('database.default'))->commit(); diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 64c2b2b5233d..a55f65fb703a 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -75,12 +75,16 @@ class UpdateInvoicePayment //caution what if we amount paid was less than partial - we wipe it! $invoice = $invoice->service() ->clearPartial() - ->updateBalance($paid_amount * -1) - ->updatePaidToDate($paid_amount) + // ->updateBalance($paid_amount * -1) + // ->updatePaidToDate($paid_amount) ->updateStatus() ->touchPdf() ->save(); + $invoice->balance -= $paid_amount; + $invoice->paid_to_date += $paid_amount; + $invoice->save(); + $invoice->service() ->workFlow() ->save(); diff --git a/app/Services/Quote/MarkSent.php b/app/Services/Quote/MarkSent.php index 31cb5b9ac5ed..0a05af6d8ad9 100644 --- a/app/Services/Quote/MarkSent.php +++ b/app/Services/Quote/MarkSent.php @@ -49,7 +49,7 @@ class MarkSent ->service() ->setStatus(Quote::STATUS_SENT) ->applyNumber() - ->deletePdf() + ->touchPdf() ->save(); event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index f04eb8444739..05816b5945ed 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -13,6 +13,7 @@ namespace App\Services\Quote; use App\Events\Quote\QuoteWasApproved; use App\Factory\InvoiceInvitationFactory; +use App\Jobs\Entity\CreateEntityPdf; use App\Jobs\Util\UnlinkFile; use App\Models\Invoice; use App\Models\Quote; @@ -116,7 +117,7 @@ class QuoteService $this->invoice ->service() ->markSent() - ->deletePdf() + ->touchPdf() ->save(); } @@ -126,6 +127,37 @@ class QuoteService return $this; } + /** + * Sometimes we need to refresh the + * PDF when it is updated etc. + * @return InvoiceService + */ + public function touchPdf($force = false) + { + try { + + if($force){ + + $this->quote->invitations->each(function ($invitation) { + CreateEntityPdf::dispatchNow($invitation); + }); + + return $this; + } + + $this->quote->invitations->each(function ($invitation) { + CreateEntityPdf::dispatch($invitation); + }); + + } + catch(\Exception $e){ + + nlog("failed creating invoices in Touch PDF"); + + } + + return $this; + } public function approveWithNoCoversion($contact = null) :self { diff --git a/app/Utils/Traits/ClientGroupSettingsSaver.php b/app/Utils/Traits/ClientGroupSettingsSaver.php index c4cce0e598dd..2172469f19e2 100644 --- a/app/Utils/Traits/ClientGroupSettingsSaver.php +++ b/app/Utils/Traits/ClientGroupSettingsSaver.php @@ -64,13 +64,13 @@ trait ClientGroupSettingsSaver } //this pass will handle any null values that are in the translations - foreach ($settings->translations as $key => $value) { - if (is_null($settings->translations[$key])) { - $settings->translations[$key] = ''; - } - } + // foreach ($settings->translations as $key => $value) { + // if (is_null($settings->translations[$key])) { + // $settings->translations[$key] = ''; + // } + // } - $entity_settings->translations = $settings->translations; + // $entity_settings->translations = $settings->translations; $entity->settings = $entity_settings; $entity->save(); @@ -94,6 +94,9 @@ trait ClientGroupSettingsSaver ksort($casts); + if(property_exists($settings, 'translations')) + unset($settings->translations); + foreach ($settings as $key => $value) { if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { unset($settings->{$key}); diff --git a/composer.json b/composer.json index 1dc05e2364e5..936fc0c378b6 100644 --- a/composer.json +++ b/composer.json @@ -89,7 +89,7 @@ "anahkiasen/former": "^4.2", "barryvdh/laravel-debugbar": "^3.4", "brianium/paratest": "^6.1", - "darkaonline/l5-swagger": "^8.0", + "darkaonline/l5-swagger": "8.1.0", "facade/ignition": "^2.3.6", "fakerphp/faker": "^1.14", "filp/whoops": "^2.7", diff --git a/composer.lock b/composer.lock index eda820989f3f..44e010550665 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "132170f65edf4d1f4ab102171903e7d0", + "content-hash": "9bc9b45c0c0864b0f16869ba0870fde5", "packages": [ { "name": "afosto/yaac", @@ -434,16 +434,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.216.2", + "version": "3.218.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "9e09386c3a5b313eeb324490beff4eb843ed339d" + "reference": "714ed40bc2e60d4af907eb2d41fbfb75f980d2e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9e09386c3a5b313eeb324490beff4eb843ed339d", - "reference": "9e09386c3a5b313eeb324490beff4eb843ed339d", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/714ed40bc2e60d4af907eb2d41fbfb75f980d2e2", + "reference": "714ed40bc2e60d4af907eb2d41fbfb75f980d2e2", "shasum": "" }, "require": { @@ -519,9 +519,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.216.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.218.0" }, - "time": "2022-03-25T18:17:03+00:00" + "time": "2022-03-31T18:20:58+00:00" }, { "name": "bacon/bacon-qr-code", @@ -2287,16 +2287,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.240.0", + "version": "v0.241.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "c6d39cda24d7ada02ecf8c464a1c8adb02607ba7" + "reference": "b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/c6d39cda24d7ada02ecf8c464a1c8adb02607ba7", - "reference": "c6d39cda24d7ada02ecf8c464a1c8adb02607ba7", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf", + "reference": "b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf", "shasum": "" }, "require": { @@ -2325,9 +2325,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.240.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.241.0" }, - "time": "2022-03-21T01:20:11+00:00" + "time": "2022-03-28T00:56:15+00:00" }, { "name": "google/auth", @@ -3325,16 +3325,16 @@ }, { "name": "laravel/framework", - "version": "v8.83.5", + "version": "v8.83.6", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95" + "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/33b1b981266e3a19fbc826b60c4a6847e311ac95", - "reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95", + "url": "https://api.github.com/repos/laravel/framework/zipball/dffcec0cb686eafaa3b8f33db11da2cd9d69af1c", + "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c", "shasum": "" }, "require": { @@ -3494,7 +3494,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-03-15T13:37:44+00:00" + "time": "2022-03-29T14:41:02+00:00" }, { "name": "laravel/serializable-closure", @@ -3687,16 +3687,16 @@ }, { "name": "laravel/tinker", - "version": "v2.7.1", + "version": "v2.7.2", "source": { "type": "git", "url": "https://github.com/laravel/tinker.git", - "reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4" + "reference": "dff39b661e827dae6e092412f976658df82dbac5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/tinker/zipball/1e2d500585a4e546346fadd3adc6f9c1a97e15f4", - "reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4", + "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5", + "reference": "dff39b661e827dae6e092412f976658df82dbac5", "shasum": "" }, "require": { @@ -3749,9 +3749,9 @@ ], "support": { "issues": "https://github.com/laravel/tinker/issues", - "source": "https://github.com/laravel/tinker/tree/v2.7.1" + "source": "https://github.com/laravel/tinker/tree/v2.7.2" }, - "time": "2022-03-15T15:25:01+00:00" + "time": "2022-03-23T12:38:24+00:00" }, { "name": "laravel/ui", @@ -7890,16 +7890,16 @@ }, { "name": "stripe/stripe-php", - "version": "v7.119.0", + "version": "v7.121.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "a454dde82f5698cc4bcc5016c5328f533f516690" + "reference": "e36e7afb71ae5511aae23b52dca712a0ef06d981" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/a454dde82f5698cc4bcc5016c5328f533f516690", - "reference": "a454dde82f5698cc4bcc5016c5328f533f516690", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/e36e7afb71ae5511aae23b52dca712a0ef06d981", + "reference": "e36e7afb71ae5511aae23b52dca712a0ef06d981", "shasum": "" }, "require": { @@ -7944,9 +7944,9 @@ ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v7.119.0" + "source": "https://github.com/stripe/stripe-php/tree/v7.121.0" }, - "time": "2022-03-25T20:09:27+00:00" + "time": "2022-03-30T15:51:23+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -11154,7 +11154,7 @@ "issues": "https://github.com/webpatser/laravel-countries/issues", "source": "https://github.com/webpatser/laravel-countries" }, - "time": "2019-07-12T14:06:05+00:00" + "time": "2022-03-29T15:40:48+00:00" }, { "name": "wepay/php-sdk", @@ -11464,16 +11464,16 @@ }, { "name": "brianium/paratest", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "5123a31dbf0b5deeaec17b00c0c5f31732c14483" + "reference": "589cdb23728b2a19872945580b95d8aa2c6619da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/5123a31dbf0b5deeaec17b00c0c5f31732c14483", - "reference": "5123a31dbf0b5deeaec17b00c0c5f31732c14483", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/589cdb23728b2a19872945580b95d8aa2c6619da", + "reference": "589cdb23728b2a19872945580b95d8aa2c6619da", "shasum": "" }, "require": { @@ -11536,7 +11536,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.4.3" + "source": "https://github.com/paratestphp/paratest/tree/v6.4.4" }, "funding": [ { @@ -11548,7 +11548,7 @@ "type": "paypal" } ], - "time": "2022-02-18T13:23:47+00:00" + "time": "2022-03-28T07:55:11+00:00" }, { "name": "composer/pcre", @@ -11770,31 +11770,31 @@ }, { "name": "darkaonline/l5-swagger", - "version": "8.3.0", + "version": "8.1.0", "source": { "type": "git", "url": "https://github.com/DarkaOnLine/L5-Swagger.git", - "reference": "b2e7885df13b0c43b48a8a1028d77428126228da" + "reference": "aab46bf494ba52dcdd7d259ce178ad33d0327d04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/b2e7885df13b0c43b48a8a1028d77428126228da", - "reference": "b2e7885df13b0c43b48a8a1028d77428126228da", + "url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/aab46bf494ba52dcdd7d259ce178ad33d0327d04", + "reference": "aab46bf494ba52dcdd7d259ce178ad33d0327d04", "shasum": "" }, "require": { "ext-json": "*", - "laravel/framework": "^9.0 || >=8.40.0 || ^7.0", + "laravel/framework": ">=8.40.0 || ^7.0", "php": "^7.2 || ^8.0", - "swagger-api/swagger-ui": "^3.0 || ^4.0", + "swagger-api/swagger-ui": "^3.0", "symfony/yaml": "^5.0", - "zircote/swagger-php": "^3.2 || ^4.0" + "zircote/swagger-php": "3.*" }, "require-dev": { "mockery/mockery": "1.*", "orchestra/testbench": "6.* || 5.*", "php-coveralls/php-coveralls": "^2.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "9.*" }, "type": "library", "extra": { @@ -11837,7 +11837,7 @@ ], "support": { "issues": "https://github.com/DarkaOnLine/L5-Swagger/issues", - "source": "https://github.com/DarkaOnLine/L5-Swagger/tree/8.3.0" + "source": "https://github.com/DarkaOnLine/L5-Swagger/tree/8.1.0" }, "funding": [ { @@ -11845,7 +11845,7 @@ "type": "github" } ], - "time": "2022-02-14T07:30:01+00:00" + "time": "2022-01-07T09:08:44+00:00" }, { "name": "doctrine/annotations", @@ -12418,16 +12418,16 @@ }, { "name": "laravel/dusk", - "version": "v6.22.1", + "version": "v6.22.2", "source": { "type": "git", "url": "https://github.com/laravel/dusk.git", - "reference": "bc9fd27ea167746ba0616a7661e6b5bd4a80c472" + "reference": "f62afe10fd37c96b1e1e9afe17174961cc2b0f0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/dusk/zipball/bc9fd27ea167746ba0616a7661e6b5bd4a80c472", - "reference": "bc9fd27ea167746ba0616a7661e6b5bd4a80c472", + "url": "https://api.github.com/repos/laravel/dusk/zipball/f62afe10fd37c96b1e1e9afe17174961cc2b0f0a", + "reference": "f62afe10fd37c96b1e1e9afe17174961cc2b0f0a", "shasum": "" }, "require": { @@ -12485,9 +12485,9 @@ ], "support": { "issues": "https://github.com/laravel/dusk/issues", - "source": "https://github.com/laravel/dusk/tree/v6.22.1" + "source": "https://github.com/laravel/dusk/tree/v6.22.2" }, - "time": "2022-02-12T17:43:36+00:00" + "time": "2022-03-24T14:57:29+00:00" }, { "name": "maximebf/debugbar", @@ -13116,16 +13116,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -13160,9 +13160,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2022-01-04T19:58:01+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "phpspec/prophecy", @@ -14618,16 +14618,16 @@ }, { "name": "swagger-api/swagger-ui", - "version": "v4.9.1", + "version": "v3.52.5", "source": { "type": "git", "url": "https://github.com/swagger-api/swagger-ui.git", - "reference": "56fe8a1c279be6b55cd9aef7ce5e06e0ec364880" + "reference": "f1ad60dc92e7edb0898583e16c3e66fe3e9eada2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/56fe8a1c279be6b55cd9aef7ce5e06e0ec364880", - "reference": "56fe8a1c279be6b55cd9aef7ce5e06e0ec364880", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/f1ad60dc92e7edb0898583e16c3e66fe3e9eada2", + "reference": "f1ad60dc92e7edb0898583e16c3e66fe3e9eada2", "shasum": "" }, "type": "library", @@ -14673,9 +14673,9 @@ ], "support": { "issues": "https://github.com/swagger-api/swagger-ui/issues", - "source": "https://github.com/swagger-api/swagger-ui/tree/v4.9.1" + "source": "https://github.com/swagger-api/swagger-ui/tree/v3.52.5" }, - "time": "2022-03-25T18:33:52+00:00" + "time": "2021-10-14T14:25:14+00:00" }, { "name": "symfony/debug", @@ -15002,41 +15002,39 @@ }, { "name": "zircote/swagger-php", - "version": "4.2.13", + "version": "3.3.4", "source": { "type": "git", "url": "https://github.com/zircote/swagger-php.git", - "reference": "8888655d7dc21eda6ec71e521f71a757605f48fe" + "reference": "7313ff7d1991d00e52d0e852087693d4482df631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zircote/swagger-php/zipball/8888655d7dc21eda6ec71e521f71a757605f48fe", - "reference": "8888655d7dc21eda6ec71e521f71a757605f48fe", + "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7313ff7d1991d00e52d0e852087693d4482df631", + "reference": "7313ff7d1991d00e52d0e852087693d4482df631", "shasum": "" }, "require": { "doctrine/annotations": "^1.7", "ext-json": "*", "php": ">=7.2", - "psr/log": "^1.1 || ^2.0 || 3.0", + "psr/log": "^1.1 || ^2.0 || ^3.0", "symfony/finder": ">=2.2", "symfony/yaml": ">=3.3" }, "require-dev": { - "composer/package-versions-deprecated": "^1.11", + "composer/package-versions-deprecated": "1.11.99.2", "friendsofphp/php-cs-fixer": "^2.17 || ^3.0", - "phpunit/phpunit": ">=8" + "phpunit/phpunit": ">=8.5.14" }, "bin": [ "bin/openapi" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, "autoload": { + "files": [ + "src/functions.php" + ], "psr-4": { "OpenApi\\": "src" } @@ -15071,9 +15069,9 @@ ], "support": { "issues": "https://github.com/zircote/swagger-php/issues", - "source": "https://github.com/zircote/swagger-php/tree/4.2.13" + "source": "https://github.com/zircote/swagger-php/tree/3.3.4" }, - "time": "2022-03-23T08:54:27+00:00" + "time": "2022-02-22T21:09:06+00:00" } ], "aliases": [], diff --git a/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php b/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php index 5ccaa8f6d644..509eb42065f0 100644 --- a/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php +++ b/database/migrations/2022_03_29_014025_reverse_apple_domain_for_hosted.php @@ -1,6 +1,7 @@ update(['markdown_email_enabled' => true]); }); + $chf = Currency::find(17); + + if($chf) + { + $chf->symbol = 'CHF'; + $chf->save(); + } + + if(Ninja::isSelfHost()) + { + + $gateway = Gateway::find(20); + + if($gateway) + { + $gateway->fields = '{"publishableKey":"","apiKey":"","appleDomainVerification":""}'; + $gateway->save(); + } + + } } /** diff --git a/database/seeders/CurrenciesSeeder.php b/database/seeders/CurrenciesSeeder.php index f0901e49276c..76815dfb9524 100644 --- a/database/seeders/CurrenciesSeeder.php +++ b/database/seeders/CurrenciesSeeder.php @@ -38,7 +38,7 @@ class CurrenciesSeeder extends Seeder ['id' => 14, 'name' => 'Norske Kroner', 'code' => 'NOK', 'symbol' => 'kr', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ',', 'swap_currency_symbol' => true], ['id' => 15, 'name' => 'New Zealand Dollar', 'code' => 'NZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 16, 'name' => 'Vietnamese Dong', 'code' => 'VND', 'symbol' => '', 'precision' => '0', 'thousand_separator' => '.', 'decimal_separator' => ','], - ['id' => 17, 'name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => '', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'], + ['id' => 17, 'name' => 'Swiss Franc', 'code' => 'CHF', 'symbol' => 'CHF', 'precision' => '2', 'thousand_separator' => '\'', 'decimal_separator' => '.'], ['id' => 18, 'name' => 'Guatemalan Quetzal', 'code' => 'GTQ', 'symbol' => 'Q', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 19, 'name' => 'Malaysian Ringgit', 'code' => 'MYR', 'symbol' => 'RM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], ['id' => 20, 'name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','], diff --git a/database/seeders/PaymentLibrariesSeeder.php b/database/seeders/PaymentLibrariesSeeder.php index fac849bf7398..e602fab0f08f 100644 --- a/database/seeders/PaymentLibrariesSeeder.php +++ b/database/seeders/PaymentLibrariesSeeder.php @@ -98,7 +98,7 @@ class PaymentLibrariesSeeder extends Seeder Gateway::query()->update(['visible' => 0]); - Gateway::whereIn('id', [1,7,11,15,20,39,46,55,50,57,52,58])->update(['visible' => 1]); + Gateway::whereIn('id', [1,3,7,11,15,20,39,46,55,50,57,52,58])->update(['visible' => 1]); if (Ninja::isHosted()) { Gateway::whereIn('id', [20])->update(['visible' => 0]); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 83d1876a814a..e4db031e75a8 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1985,38 +1985,6 @@ $LANG = array( 'authorization' => 'Authorization', 'signed' => 'Signed', - // BlueVine - 'bluevine_promo' => 'Get flexible business lines of credit and invoice factoring using BlueVine.', - 'bluevine_modal_label' => 'Sign up with BlueVine', - 'bluevine_modal_text' => '

Fast funding for your business. No paperwork.

-', - 'bluevine_create_account' => 'Create an account', - 'quote_types' => 'Get a quote for', - 'invoice_factoring' => 'Invoice factoring', - 'line_of_credit' => 'Line of credit', - 'fico_score' => 'Your FICO score', - 'business_inception' => 'Business Inception Date', - 'average_bank_balance' => 'Average bank account balance', - 'annual_revenue' => 'Annual revenue', - 'desired_credit_limit_factoring' => 'Desired invoice factoring limit', - 'desired_credit_limit_loc' => 'Desired line of credit limit', - 'desired_credit_limit' => 'Desired credit limit', - 'bluevine_credit_line_type_required' => 'You must choose at least one', - 'bluevine_field_required' => 'This field is required', - 'bluevine_unexpected_error' => 'An unexpected error occurred.', - 'bluevine_no_conditional_offer' => 'More information is required before getting a quote. Click continue below.', - 'bluevine_invoice_factoring' => 'Invoice Factoring', - 'bluevine_conditional_offer' => 'Conditional Offer', - 'bluevine_credit_line_amount' => 'Credit Line', - 'bluevine_advance_rate' => 'Advance Rate', - 'bluevine_weekly_discount_rate' => 'Weekly Discount Rate', - 'bluevine_minimum_fee_rate' => 'Minimum Fee', - 'bluevine_line_of_credit' => 'Line of Credit', - 'bluevine_interest_rate' => 'Interest Rate', - 'bluevine_weekly_draw_rate' => 'Weekly Draw Rate', - 'bluevine_continue' => 'Continue to BlueVine', - 'bluevine_completed' => 'BlueVine signup completed', - 'vendor_name' => 'Vendor', 'entity_state' => 'State', 'client_created_at' => 'Date Created', @@ -4572,6 +4540,9 @@ $LANG = array( 'reminder_message' => 'Reminder for invoice :number for :balance', 'gmail_credentials_invalid_subject' => 'Send with GMail invalid credentials', 'gmail_credentials_invalid_body' => 'Your GMail credentials are not correct, please log into the administrator portal and navigate to Settings > User Details and disconnect and reconnect your GMail account. We will send you this notification daily until this issue is resolved', + 'notification_invoice_sent' => 'Invoice Sent', + 'total_columns' => 'Total Fields', + ); return $LANG; diff --git a/tests/Feature/ClientApiTest.php b/tests/Feature/ClientApiTest.php index 0e67928252a4..de2b642f960c 100644 --- a/tests/Feature/ClientApiTest.php +++ b/tests/Feature/ClientApiTest.php @@ -42,6 +42,98 @@ class ClientApiTest extends TestCase Model::reguard(); } + public function testIllegalPropertiesInClientSettings() + { + $settings = [ + 'currency_id' => "1", + 'translations' => [ + 'email' => 'legal@eagle.com' + ], + ]; + + $data = [ + 'name' => $this->faker->firstName, + 'settings' => $settings, + ]; + + $response = false; + + try{ + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/clients/', $data); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + nlog($message); + } + + $response->assertStatus(200); + $arr = $response->json(); + $this->assertFalse(array_key_exists('translations', $arr['data']['settings'])); + + } + + public function testClientLanguageCodeIllegal() + { + + $data = [ + 'name' => $this->faker->firstName, + 'id_number' => 'Coolio', + 'language_code' => 'not_really_a_VALID-locale' + ]; + + $response = false; + + try{ + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/clients/', $data); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + nlog($message); + } + + $response->assertStatus(200); + + $arr = $response->json(); + + $this->assertFalse(array_key_exists('language_id', $arr['data']['settings'])); + + } + + + public function testClientLanguageCodeValidationTrue() + { + + $data = [ + 'name' => $this->faker->firstName, + 'id_number' => 'Coolio', + 'language_code' => 'de' + ]; + + $response = false; + + try{ + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/clients/', $data); + } catch (ValidationException $e) { + $message = json_decode($e->validator->getMessageBag(), 1); + nlog($message); + } + + $response->assertStatus(200); + + $arr = $response->json(); + + $this->assertEquals("3", $arr['data']['settings']['language_id']); + + } + + public function testClientCountryCodeValidationTrue() {