Merge pull request #7351 from turbo124/v5-develop

Minor fixes
This commit is contained in:
David Bomba 2022-04-03 13:04:28 +10:00 committed by GitHub
commit 1ce2f789d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 317 additions and 148 deletions

View File

@ -35,6 +35,7 @@ jobs:
php artisan key:generate php artisan key:generate
php artisan optimize php artisan optimize
php artisan storage:link php artisan storage:link
php artisan livewire:publish
sudo php artisan cache:clear sudo php artisan cache:clear
sudo find ./vendor/bin/ -type f -exec chmod +x {} \; sudo find ./vendor/bin/ -type f -exec chmod +x {} \;
sudo find ./ -type d -exec chmod 755 {} \; sudo find ./ -type d -exec chmod 755 {} \;

View File

@ -31,8 +31,6 @@ class AccountController extends BaseController
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
//$this->middleware('guest');
} }
/** /**

View File

@ -598,7 +598,7 @@ class ClientController extends BaseController
* *
* @OA\Put( * @OA\Put(
* path="/api/v1/clients/{id}/purge", * path="/api/v1/clients/{id}/purge",
* operationId="uploadClient", * operationId="purgeClient",
* tags={"clients"}, * tags={"clients"},
* summary="Purges a client from the system", * summary="Purges a client from the system",
* description="Handles purging a client", * description="Handles purging a client",

View File

@ -163,7 +163,7 @@ class InvoiceController extends Controller
//format data //format data
$invoices->map(function ($invoice) { $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->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; $invoice->partial = $invoice->partial > 0 ? Number::formatValue($invoice->partial, $invoice->client->currency()) : 0;

View File

@ -26,7 +26,7 @@
* @OA\Property(property="state", type="string", example="", description="________"), * @OA\Property(property="state", type="string", example="", description="________"),
* @OA\Property(property="postal_code", 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="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_value1", type="string", example="", description="________"),
* @OA\Property(property="custom_value2", type="string", example="", description="________"), * @OA\Property(property="custom_value2", type="string", example="", description="________"),
* @OA\Property(property="custom_value3", 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_city", type="string", example="", description="________"),
* @OA\Property(property="shipping_state", 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_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="is_deleted", type="boolean", example=true, description="________"),
* @OA\Property(property="balance", type="number", format="float", example="10.00", 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="________"), * @OA\Property(property="paid_to_date", type="number", format="float", example="10.00", description="________"),

View File

@ -33,6 +33,7 @@ class SubdomainController extends BaseController
'sandbox', 'sandbox',
'stage', 'stage',
'html', 'html',
'lb',
]; ];
public function __construct() public function __construct()

View File

@ -51,6 +51,8 @@ class StoreClientRequest extends Request
$rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id); $rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id);
} }
$rules['country_id'] = 'integer|nullable';
if(isset($this->currency_code)){ if(isset($this->currency_code)){
$rules['currency_code'] = 'sometimes|exists:currencies,code'; $rules['currency_code'] = 'sometimes|exists:currencies,code';
} }
@ -120,6 +122,10 @@ class StoreClientRequest extends Request
$settings->currency_id = $this->getCurrencyCode($input['currency_code']); $settings->currency_id = $this->getCurrencyCode($input['currency_code']);
} }
if (isset($input['language_code'])) {
$settings->language_id = $this->getLanguageId($input['language_code']);
}
$input['settings'] = $settings; $input['settings'] = $settings;
if (isset($input['country_code'])) { 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) private function getCountryCode($country_code)
{ {
$countries = Cache::get('countries'); $countries = Cache::get('countries');

View File

@ -16,6 +16,7 @@ use App\Http\Requests\Request;
use App\Http\ValidationRules\ValidClientGroupSettingsRule; use App\Http\ValidationRules\ValidClientGroupSettingsRule;
use App\Utils\Traits\ChecksEntityStatus; use App\Utils\Traits\ChecksEntityStatus;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Illuminate\Support\Facades\Cache;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
class UpdateClientRequest extends Request class UpdateClientRequest extends Request
@ -103,6 +104,10 @@ class UpdateClientRequest extends Request
$input['settings']['currency_id'] = (string) auth()->user()->company()->settings->currency_id; $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); $input = $this->decodePrimaryKeys($input);
if (array_key_exists('settings', $input)) { if (array_key_exists('settings', $input)) {
@ -112,6 +117,22 @@ class UpdateClientRequest extends Request
$this->replace($input); $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. * For the hosted platform, we restrict the feature settings.
* *

View File

@ -16,7 +16,10 @@ class CreateStatementRequest extends Request
*/ */
public function authorize(): bool 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 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();
} }
} }

View File

@ -1477,6 +1477,9 @@ class Import implements ShouldQueue
$modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']); $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 */ // /* On Hosted platform we need to advise Stripe users to connect with Stripe Connect */
if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){ if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){
@ -1489,9 +1492,6 @@ class Import implements ShouldQueue
$modified['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34'; $modified['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34';
//why do we set this to a blank array?
//$modified['fees_and_limits'] = [];
} }
if(Ninja::isSelfHost() && $modified['gateway_key'] == 'd14dd26a47cecc30fdd65700bfb67b34'){ if(Ninja::isSelfHost() && $modified['gateway_key'] == 'd14dd26a47cecc30fdd65700bfb67b34'){

View File

@ -349,7 +349,7 @@ class BaseDriver extends AbstractPaymentDriver
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->get(); $invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
$invoices->each(function ($invoice) { $invoices->each(function ($invoice) {
$invoice->service()->removeUnpaidGatewayFees()->save(); $invoice->service()->removeUnpaidGatewayFees();
}); });
} }

View File

@ -160,6 +160,7 @@ class CreditCard
'TotalAmount' => $this->convertAmountForEway(), 'TotalAmount' => $this->convertAmountForEway(),
'CurrencyCode' => $this->eway_driver->client->currency()->code, 'CurrencyCode' => $this->eway_driver->client->currency()->code,
'InvoiceNumber' => $invoice_numbers, 'InvoiceNumber' => $invoice_numbers,
'InvoiceDescription' => substr($invoice_numbers, 0, 63)
], ],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'SecuredCardData' => $request->input('securefieldcode'), 'SecuredCardData' => $request->input('securefieldcode'),
@ -249,6 +250,7 @@ class CreditCard
'TotalAmount' => $this->convertAmountForEway($amount), 'TotalAmount' => $this->convertAmountForEway($amount),
'CurrencyCode' => $this->eway_driver->client->currency()->code, 'CurrencyCode' => $this->eway_driver->client->currency()->code,
'InvoiceNumber' => $invoice_numbers, 'InvoiceNumber' => $invoice_numbers,
'InvoiceDescription' => substr($invoice_numbers, 0, 63)
], ],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING,
]; ];

View File

@ -61,8 +61,7 @@ class Token
'TotalAmount' => $this->eway_driver->convertAmount($amount), 'TotalAmount' => $this->eway_driver->convertAmount($amount),
'CurrencyCode' => $this->eway_driver->client->currency()->code, 'CurrencyCode' => $this->eway_driver->client->currency()->code,
'InvoiceNumber' => $invoice_numbers, 'InvoiceNumber' => $invoice_numbers,
'InvoiceDescription' => $description, 'InvoiceDescription' => substr($description, 0,63),
'InvoiceReference' => $description,
], ],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING,
]; ];

View File

@ -17,6 +17,7 @@ use App\Models\GatewayType;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\PaymentDrivers\BaseDriver;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
class PaymentDriver extends BaseDriver class PaymentDriver extends BaseDriver

View File

@ -72,8 +72,7 @@ class InstantPayment
$invoices->each(function($invoice){ $invoices->each(function($invoice){
$invoice->service() $invoice->service()
->markSent() ->markSent()
->removeUnpaidGatewayFees() ->removeUnpaidGatewayFees();
->save();
}); });
/* pop non payable invoice from the $payable_invoices array */ /* pop non payable invoice from the $payable_invoices array */

View File

@ -125,7 +125,7 @@ class AutoBillInvoice extends AbstractService
} }
catch(\Exception $e){ catch(\Exception $e){
nlog("payment NOT captured for ". $this->invoice->number . " with error " . $e->getMessage()); nlog("payment NOT captured for ". $this->invoice->number . " with error " . $e->getMessage());
$this->invoice->service()->removeUnpaidGatewayFees()->save(); $this->invoice->service()->removeUnpaidGatewayFees();
} }
if($payment){ if($payment){

View File

@ -324,7 +324,7 @@ class InvoiceService
return $item; return $item;
})->toArray(); })->toArray();
$this->deletePdf(); $this->touchPdf();
return $this; return $this;
} }
@ -374,7 +374,10 @@ class InvoiceService
/* 24-03-2022 */ /* 24-03-2022 */
$new_balance = $this->invoice->balance; $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; $adjustment = $balance - $new_balance;

View File

@ -48,7 +48,7 @@ class LedgerService
$this->entity->company_ledger()->save($company_ledger); $this->entity->company_ledger()->save($company_ledger);
}, 5); }, 1);
// \DB::connection(config('database.default'))->commit(); // \DB::connection(config('database.default'))->commit();
@ -80,7 +80,7 @@ class LedgerService
$this->entity->company_ledger()->save($company_ledger); $this->entity->company_ledger()->save($company_ledger);
}, 5); }, 1);
// \DB::connection(config('database.default'))->commit(); // \DB::connection(config('database.default'))->commit();
@ -111,7 +111,7 @@ class LedgerService
$this->entity->company_ledger()->save($company_ledger); $this->entity->company_ledger()->save($company_ledger);
}, 5); }, 1);
// \DB::connection(config('database.default'))->commit(); // \DB::connection(config('database.default'))->commit();

View File

@ -75,12 +75,16 @@ class UpdateInvoicePayment
//caution what if we amount paid was less than partial - we wipe it! //caution what if we amount paid was less than partial - we wipe it!
$invoice = $invoice->service() $invoice = $invoice->service()
->clearPartial() ->clearPartial()
->updateBalance($paid_amount * -1) // ->updateBalance($paid_amount * -1)
->updatePaidToDate($paid_amount) // ->updatePaidToDate($paid_amount)
->updateStatus() ->updateStatus()
->touchPdf() ->touchPdf()
->save(); ->save();
$invoice->balance -= $paid_amount;
$invoice->paid_to_date += $paid_amount;
$invoice->save();
$invoice->service() $invoice->service()
->workFlow() ->workFlow()
->save(); ->save();

View File

@ -49,7 +49,7 @@ class MarkSent
->service() ->service()
->setStatus(Quote::STATUS_SENT) ->setStatus(Quote::STATUS_SENT)
->applyNumber() ->applyNumber()
->deletePdf() ->touchPdf()
->save(); ->save();
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -13,6 +13,7 @@ namespace App\Services\Quote;
use App\Events\Quote\QuoteWasApproved; use App\Events\Quote\QuoteWasApproved;
use App\Factory\InvoiceInvitationFactory; use App\Factory\InvoiceInvitationFactory;
use App\Jobs\Entity\CreateEntityPdf;
use App\Jobs\Util\UnlinkFile; use App\Jobs\Util\UnlinkFile;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Quote; use App\Models\Quote;
@ -116,7 +117,7 @@ class QuoteService
$this->invoice $this->invoice
->service() ->service()
->markSent() ->markSent()
->deletePdf() ->touchPdf()
->save(); ->save();
} }
@ -126,6 +127,37 @@ class QuoteService
return $this; 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 public function approveWithNoCoversion($contact = null) :self
{ {

View File

@ -64,13 +64,13 @@ trait ClientGroupSettingsSaver
} }
//this pass will handle any null values that are in the translations //this pass will handle any null values that are in the translations
foreach ($settings->translations as $key => $value) { // foreach ($settings->translations as $key => $value) {
if (is_null($settings->translations[$key])) { // if (is_null($settings->translations[$key])) {
$settings->translations[$key] = ''; // $settings->translations[$key] = '';
} // }
} // }
$entity_settings->translations = $settings->translations; // $entity_settings->translations = $settings->translations;
$entity->settings = $entity_settings; $entity->settings = $entity_settings;
$entity->save(); $entity->save();
@ -94,6 +94,9 @@ trait ClientGroupSettingsSaver
ksort($casts); ksort($casts);
if(property_exists($settings, 'translations'))
unset($settings->translations);
foreach ($settings as $key => $value) { foreach ($settings as $key => $value) {
if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) {
unset($settings->{$key}); unset($settings->{$key});

View File

@ -89,7 +89,7 @@
"anahkiasen/former": "^4.2", "anahkiasen/former": "^4.2",
"barryvdh/laravel-debugbar": "^3.4", "barryvdh/laravel-debugbar": "^3.4",
"brianium/paratest": "^6.1", "brianium/paratest": "^6.1",
"darkaonline/l5-swagger": "^8.0", "darkaonline/l5-swagger": "8.1.0",
"facade/ignition": "^2.3.6", "facade/ignition": "^2.3.6",
"fakerphp/faker": "^1.14", "fakerphp/faker": "^1.14",
"filp/whoops": "^2.7", "filp/whoops": "^2.7",

156
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "132170f65edf4d1f4ab102171903e7d0", "content-hash": "9bc9b45c0c0864b0f16869ba0870fde5",
"packages": [ "packages": [
{ {
"name": "afosto/yaac", "name": "afosto/yaac",
@ -434,16 +434,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.216.2", "version": "3.218.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "9e09386c3a5b313eeb324490beff4eb843ed339d" "reference": "714ed40bc2e60d4af907eb2d41fbfb75f980d2e2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9e09386c3a5b313eeb324490beff4eb843ed339d", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/714ed40bc2e60d4af907eb2d41fbfb75f980d2e2",
"reference": "9e09386c3a5b313eeb324490beff4eb843ed339d", "reference": "714ed40bc2e60d4af907eb2d41fbfb75f980d2e2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -519,9 +519,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "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", "name": "bacon/bacon-qr-code",
@ -2287,16 +2287,16 @@
}, },
{ {
"name": "google/apiclient-services", "name": "google/apiclient-services",
"version": "v0.240.0", "version": "v0.241.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": "c6d39cda24d7ada02ecf8c464a1c8adb02607ba7" "reference": "b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/c6d39cda24d7ada02ecf8c464a1c8adb02607ba7", "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf",
"reference": "c6d39cda24d7ada02ecf8c464a1c8adb02607ba7", "reference": "b4ba0dbcffa9ae30cf09ad3f8597f1374098acbf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2325,9 +2325,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.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", "name": "google/auth",
@ -3325,16 +3325,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v8.83.5", "version": "v8.83.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95" "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/33b1b981266e3a19fbc826b60c4a6847e311ac95", "url": "https://api.github.com/repos/laravel/framework/zipball/dffcec0cb686eafaa3b8f33db11da2cd9d69af1c",
"reference": "33b1b981266e3a19fbc826b60c4a6847e311ac95", "reference": "dffcec0cb686eafaa3b8f33db11da2cd9d69af1c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3494,7 +3494,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "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", "name": "laravel/serializable-closure",
@ -3687,16 +3687,16 @@
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
"version": "v2.7.1", "version": "v2.7.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/tinker.git", "url": "https://github.com/laravel/tinker.git",
"reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4" "reference": "dff39b661e827dae6e092412f976658df82dbac5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/1e2d500585a4e546346fadd3adc6f9c1a97e15f4", "url": "https://api.github.com/repos/laravel/tinker/zipball/dff39b661e827dae6e092412f976658df82dbac5",
"reference": "1e2d500585a4e546346fadd3adc6f9c1a97e15f4", "reference": "dff39b661e827dae6e092412f976658df82dbac5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3749,9 +3749,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/tinker/issues", "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", "name": "laravel/ui",
@ -7890,16 +7890,16 @@
}, },
{ {
"name": "stripe/stripe-php", "name": "stripe/stripe-php",
"version": "v7.119.0", "version": "v7.121.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/stripe/stripe-php.git", "url": "https://github.com/stripe/stripe-php.git",
"reference": "a454dde82f5698cc4bcc5016c5328f533f516690" "reference": "e36e7afb71ae5511aae23b52dca712a0ef06d981"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/a454dde82f5698cc4bcc5016c5328f533f516690", "url": "https://api.github.com/repos/stripe/stripe-php/zipball/e36e7afb71ae5511aae23b52dca712a0ef06d981",
"reference": "a454dde82f5698cc4bcc5016c5328f533f516690", "reference": "e36e7afb71ae5511aae23b52dca712a0ef06d981",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7944,9 +7944,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/stripe/stripe-php/issues", "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", "name": "swiftmailer/swiftmailer",
@ -11154,7 +11154,7 @@
"issues": "https://github.com/webpatser/laravel-countries/issues", "issues": "https://github.com/webpatser/laravel-countries/issues",
"source": "https://github.com/webpatser/laravel-countries" "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", "name": "wepay/php-sdk",
@ -11464,16 +11464,16 @@
}, },
{ {
"name": "brianium/paratest", "name": "brianium/paratest",
"version": "v6.4.3", "version": "v6.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/paratestphp/paratest.git", "url": "https://github.com/paratestphp/paratest.git",
"reference": "5123a31dbf0b5deeaec17b00c0c5f31732c14483" "reference": "589cdb23728b2a19872945580b95d8aa2c6619da"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/paratestphp/paratest/zipball/5123a31dbf0b5deeaec17b00c0c5f31732c14483", "url": "https://api.github.com/repos/paratestphp/paratest/zipball/589cdb23728b2a19872945580b95d8aa2c6619da",
"reference": "5123a31dbf0b5deeaec17b00c0c5f31732c14483", "reference": "589cdb23728b2a19872945580b95d8aa2c6619da",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -11536,7 +11536,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/paratestphp/paratest/issues", "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": [ "funding": [
{ {
@ -11548,7 +11548,7 @@
"type": "paypal" "type": "paypal"
} }
], ],
"time": "2022-02-18T13:23:47+00:00" "time": "2022-03-28T07:55:11+00:00"
}, },
{ {
"name": "composer/pcre", "name": "composer/pcre",
@ -11770,31 +11770,31 @@
}, },
{ {
"name": "darkaonline/l5-swagger", "name": "darkaonline/l5-swagger",
"version": "8.3.0", "version": "8.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/DarkaOnLine/L5-Swagger.git", "url": "https://github.com/DarkaOnLine/L5-Swagger.git",
"reference": "b2e7885df13b0c43b48a8a1028d77428126228da" "reference": "aab46bf494ba52dcdd7d259ce178ad33d0327d04"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/b2e7885df13b0c43b48a8a1028d77428126228da", "url": "https://api.github.com/repos/DarkaOnLine/L5-Swagger/zipball/aab46bf494ba52dcdd7d259ce178ad33d0327d04",
"reference": "b2e7885df13b0c43b48a8a1028d77428126228da", "reference": "aab46bf494ba52dcdd7d259ce178ad33d0327d04",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"laravel/framework": "^9.0 || >=8.40.0 || ^7.0", "laravel/framework": ">=8.40.0 || ^7.0",
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"swagger-api/swagger-ui": "^3.0 || ^4.0", "swagger-api/swagger-ui": "^3.0",
"symfony/yaml": "^5.0", "symfony/yaml": "^5.0",
"zircote/swagger-php": "^3.2 || ^4.0" "zircote/swagger-php": "3.*"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "1.*", "mockery/mockery": "1.*",
"orchestra/testbench": "6.* || 5.*", "orchestra/testbench": "6.* || 5.*",
"php-coveralls/php-coveralls": "^2.0", "php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^9.5" "phpunit/phpunit": "9.*"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -11837,7 +11837,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/DarkaOnLine/L5-Swagger/issues", "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": [ "funding": [
{ {
@ -11845,7 +11845,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-02-14T07:30:01+00:00" "time": "2022-01-07T09:08:44+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@ -12418,16 +12418,16 @@
}, },
{ {
"name": "laravel/dusk", "name": "laravel/dusk",
"version": "v6.22.1", "version": "v6.22.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/dusk.git", "url": "https://github.com/laravel/dusk.git",
"reference": "bc9fd27ea167746ba0616a7661e6b5bd4a80c472" "reference": "f62afe10fd37c96b1e1e9afe17174961cc2b0f0a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/dusk/zipball/bc9fd27ea167746ba0616a7661e6b5bd4a80c472", "url": "https://api.github.com/repos/laravel/dusk/zipball/f62afe10fd37c96b1e1e9afe17174961cc2b0f0a",
"reference": "bc9fd27ea167746ba0616a7661e6b5bd4a80c472", "reference": "f62afe10fd37c96b1e1e9afe17174961cc2b0f0a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -12485,9 +12485,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/dusk/issues", "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", "name": "maximebf/debugbar",
@ -13116,16 +13116,16 @@
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
"version": "1.6.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git", "url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" "reference": "77a32518733312af16a44300404e945338981de3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "reference": "77a32518733312af16a44300404e945338981de3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -13160,9 +13160,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": { "support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues", "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", "name": "phpspec/prophecy",
@ -14618,16 +14618,16 @@
}, },
{ {
"name": "swagger-api/swagger-ui", "name": "swagger-api/swagger-ui",
"version": "v4.9.1", "version": "v3.52.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git", "url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "56fe8a1c279be6b55cd9aef7ce5e06e0ec364880" "reference": "f1ad60dc92e7edb0898583e16c3e66fe3e9eada2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/56fe8a1c279be6b55cd9aef7ce5e06e0ec364880", "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/f1ad60dc92e7edb0898583e16c3e66fe3e9eada2",
"reference": "56fe8a1c279be6b55cd9aef7ce5e06e0ec364880", "reference": "f1ad60dc92e7edb0898583e16c3e66fe3e9eada2",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -14673,9 +14673,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/swagger-api/swagger-ui/issues", "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", "name": "symfony/debug",
@ -15002,41 +15002,39 @@
}, },
{ {
"name": "zircote/swagger-php", "name": "zircote/swagger-php",
"version": "4.2.13", "version": "3.3.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zircote/swagger-php.git", "url": "https://github.com/zircote/swagger-php.git",
"reference": "8888655d7dc21eda6ec71e521f71a757605f48fe" "reference": "7313ff7d1991d00e52d0e852087693d4482df631"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/8888655d7dc21eda6ec71e521f71a757605f48fe", "url": "https://api.github.com/repos/zircote/swagger-php/zipball/7313ff7d1991d00e52d0e852087693d4482df631",
"reference": "8888655d7dc21eda6ec71e521f71a757605f48fe", "reference": "7313ff7d1991d00e52d0e852087693d4482df631",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/annotations": "^1.7", "doctrine/annotations": "^1.7",
"ext-json": "*", "ext-json": "*",
"php": ">=7.2", "php": ">=7.2",
"psr/log": "^1.1 || ^2.0 || 3.0", "psr/log": "^1.1 || ^2.0 || ^3.0",
"symfony/finder": ">=2.2", "symfony/finder": ">=2.2",
"symfony/yaml": ">=3.3" "symfony/yaml": ">=3.3"
}, },
"require-dev": { "require-dev": {
"composer/package-versions-deprecated": "^1.11", "composer/package-versions-deprecated": "1.11.99.2",
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0", "friendsofphp/php-cs-fixer": "^2.17 || ^3.0",
"phpunit/phpunit": ">=8" "phpunit/phpunit": ">=8.5.14"
}, },
"bin": [ "bin": [
"bin/openapi" "bin/openapi"
], ],
"type": "library", "type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.x-dev"
}
},
"autoload": { "autoload": {
"files": [
"src/functions.php"
],
"psr-4": { "psr-4": {
"OpenApi\\": "src" "OpenApi\\": "src"
} }
@ -15071,9 +15069,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/zircote/swagger-php/issues", "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": [], "aliases": [],

View File

@ -1,6 +1,7 @@
<?php <?php
use App\Models\Company; use App\Models\Company;
use App\Models\Currency;
use App\Models\Gateway; use App\Models\Gateway;
use App\Utils\Ninja; use App\Utils\Ninja;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
@ -32,6 +33,26 @@ class ReverseAppleDomainForHosted extends Migration
$company->update(['markdown_email_enabled' => true]); $company->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();
}
}
} }
/** /**

View File

@ -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' => 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' => 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' => 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' => 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' => 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' => ','], ['id' => 20, 'name' => 'Brazilian Real', 'code' => 'BRL', 'symbol' => 'R$', 'precision' => '2', 'thousand_separator' => '.', 'decimal_separator' => ','],

View File

@ -98,7 +98,7 @@ class PaymentLibrariesSeeder extends Seeder
Gateway::query()->update(['visible' => 0]); 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()) { if (Ninja::isHosted()) {
Gateway::whereIn('id', [20])->update(['visible' => 0]); Gateway::whereIn('id', [20])->update(['visible' => 0]);

View File

@ -1985,38 +1985,6 @@ $LANG = array(
'authorization' => 'Authorization', 'authorization' => 'Authorization',
'signed' => 'Signed', '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' => '<h3>Fast funding for your business. No paperwork.</h3>
<ul><li>Flexible business lines of credit and invoice factoring.</li></ul>',
'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', 'vendor_name' => 'Vendor',
'entity_state' => 'State', 'entity_state' => 'State',
'client_created_at' => 'Date Created', 'client_created_at' => 'Date Created',
@ -4572,6 +4540,9 @@ $LANG = array(
'reminder_message' => 'Reminder for invoice :number for :balance', 'reminder_message' => 'Reminder for invoice :number for :balance',
'gmail_credentials_invalid_subject' => 'Send with GMail invalid credentials', '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', '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; return $LANG;

View File

@ -42,6 +42,98 @@ class ClientApiTest extends TestCase
Model::reguard(); 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() public function testClientCountryCodeValidationTrue()
{ {