Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2023-03-11 09:20:04 +11:00
commit 7317f7d6ab
9 changed files with 254 additions and 100 deletions

View File

@ -299,11 +299,14 @@ class Payment extends BaseModel
public function translatedType() public function translatedType()
{ {
if (! $this->type) { if (! $this->type_id) {
return ''; return '';
} }
return ctrans('texts.payment_type_'.$this->type->name); $pt = new PaymentType();
return $pt->name($this->type_id);
} }
public function gateway_type() public function gateway_type()

View File

@ -74,6 +74,48 @@ class PaymentType extends StaticModel
const KLARNA = 47; const KLARNA = 47;
const Interac_E_Transfer = 48; const Interac_E_Transfer = 48;
public array $type_names = [
self::CREDIT => 'payment_type_Credit',
self::ACH => 'payment_type_ACH',
self::VISA => 'payment_type_Visa Card',
self::MASTERCARD => 'payment_type_MasterCard',
self::AMERICAN_EXPRESS => 'payment_type_American Express',
self::DISCOVER => 'payment_type_Discover Card',
self::DINERS => 'payment_type_Diners Card',
self::EUROCARD => 'payment_type_EuroCard',
self::NOVA => 'payment_type_Nova',
self::CREDIT_CARD_OTHER => 'payment_type_Credit Card Other',
self::PAYPAL => 'payment_type_PayPal',
self::CHECK => 'payment_type_Check',
self::CARTE_BLANCHE => 'payment_type_Carte Blanche',
self::UNIONPAY => 'payment_type_UnionPay',
self::JCB => 'payment_type_JCB',
self::LASER => 'payment_type_Laser',
self::MAESTRO => 'payment_type_Maestro',
self::SOLO => 'payment_type_Solo',
self::SWITCH => 'payment_type_Switch',
self::ALIPAY => 'payment_type_Alipay',
self::SOFORT => 'payment_type_Sofort',
self::SEPA => 'payment_type_SEPA',
self::GOCARDLESS => 'payment_type_GoCardless',
self::CRYPTO => 'payment_type_Crypto',
self::MOLLIE_BANK_TRANSFER => 'payment_type_Mollie Bank Transfer',
self::KBC => 'payment_type_KBC/CBC',
self::BANCONTACT => 'payment_type_Bancontact',
self::IDEAL => 'payment_type_iDEAL',
self::HOSTED_PAGE => 'payment_type_Hosted Page',
self::GIROPAY => 'payment_type_GiroPay',
self::PRZELEWY24 => 'payment_type_Przelewy24',
self::EPS => 'payment_type_EPS',
self::DIRECT_DEBIT => 'payment_type_Direct Debit',
self::BECS => 'payment_type_BECS',
self::ACSS => 'payment_type_ACSS',
self::INSTANT_BANK_PAY => 'payment_type_Instant Bank Pay',
self::FPX => 'fpx',
self::KLARNA => 'payment_type_Klarna',
self::Interac_E_Transfer => 'payment_type_Interac E Transfer',
];
public static function parseCardType($cardName) public static function parseCardType($cardName)
{ {
$cardTypes = [ $cardTypes = [
@ -106,4 +148,12 @@ class PaymentType extends StaticModel
return self::CREDIT_CARD_OTHER; return self::CREDIT_CARD_OTHER;
} }
} }
public function name($id)
{
if(isset($this->type_names[$id]))
return ctrans("texts.".$this->type_names[$id]);
return ctrans('texts.manual_entry');
}
} }

View File

@ -244,7 +244,7 @@ class PdfBuilder
$element['elements'][] = ['element' => 'td', 'content' => $invoice->number]; $element['elements'][] = ['element' => 'td', 'content' => $invoice->number];
$element['elements'][] = ['element' => 'td', 'content' => $this->translateDate($payment->date, $this->service->config->date_format, $this->service->config->locale) ?: ' ']; $element['elements'][] = ['element' => 'td', 'content' => $this->translateDate($payment->date, $this->service->config->date_format, $this->service->config->locale) ?: ' '];
$element['elements'][] = ['element' => 'td', 'content' => $payment->type ? $payment->type->name : ctrans('texts.manual_entry')]; $element['elements'][] = ['element' => 'td', 'content' => $payment->translatedType()];
$element['elements'][] = ['element' => 'td', 'content' => $this->service->config->formatMoney($payment->pivot->amount) ?: ' ']; $element['elements'][] = ['element' => 'td', 'content' => $this->service->config->formatMoney($payment->pivot->amount) ?: ' '];
$tbody[] = $element; $tbody[] = $element;
@ -279,7 +279,7 @@ class PdfBuilder
return [ return [
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), $this->service->config->formatMoney($this->payment_amount_total))], ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.amount_paid'), $this->service->config->formatMoney($this->payment_amount_total))],
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.payment_method'), $payment->type ? $payment->type->name : ctrans('texts.manual_entry'))], ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.payment_method'), $payment->translatedType())],
['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.payment_date'), $this->translateDate($payment->date, $this->service->config->date_format, $this->service->config->locale) ?: ' ')], ['element' => 'p', 'content' => \sprintf('%s: %s', ctrans('texts.payment_date'), $this->translateDate($payment->date, $this->service->config->date_format, $this->service->config->locale) ?: ' ')],
]; ];
} }

View File

@ -601,7 +601,7 @@ class Design extends BaseDesign
$element['elements'][] = ['element' => 'td', 'content' => $invoice->number]; $element['elements'][] = ['element' => 'td', 'content' => $invoice->number];
$element['elements'][] = ['element' => 'td', 'content' => $this->translateDate($payment->date, $this->client->date_format(), $this->client->locale()) ?: ' ']; $element['elements'][] = ['element' => 'td', 'content' => $this->translateDate($payment->date, $this->client->date_format(), $this->client->locale()) ?: ' '];
$element['elements'][] = ['element' => 'td', 'content' => $payment->type ? $payment->type->name : ctrans('texts.manual_entry')]; $element['elements'][] = ['element' => 'td', 'content' => $payment->translatedType()];
$element['elements'][] = ['element' => 'td', 'content' => Number::formatMoney($payment->pivot->amount, $this->client) ?: ' ']; $element['elements'][] = ['element' => 'td', 'content' => Number::formatMoney($payment->pivot->amount, $this->client) ?: ' '];
$tbody[] = $element; $tbody[] = $element;

76
composer.lock generated
View File

@ -380,16 +380,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.261.6", "version": "3.261.8",
"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": "63b03ec821473861af58439f1a35173e904d0f8c" "reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/63b03ec821473861af58439f1a35173e904d0f8c", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9c38c82b7d3fb2b15957e71cae3957450e131ed8",
"reference": "63b03ec821473861af58439f1a35173e904d0f8c", "reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -468,9 +468,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.261.6" "source": "https://github.com/aws/aws-sdk-php/tree/3.261.8"
}, },
"time": "2023-03-07T19:21:12+00:00" "time": "2023-03-09T19:23:27+00:00"
}, },
{ {
"name": "bacon/bacon-qr-code", "name": "bacon/bacon-qr-code",
@ -2171,16 +2171,16 @@
}, },
{ {
"name": "google/apiclient-services", "name": "google/apiclient-services",
"version": "v0.289.1", "version": "v0.289.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": "df7e6cbab08f60509b3f360d8286c194ad2930e2" "reference": "937f83a927db2d09db7eebb69ce2ac4114559bd7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/df7e6cbab08f60509b3f360d8286c194ad2930e2", "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/937f83a927db2d09db7eebb69ce2ac4114559bd7",
"reference": "df7e6cbab08f60509b3f360d8286c194ad2930e2", "reference": "937f83a927db2d09db7eebb69ce2ac4114559bd7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2209,9 +2209,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.289.1" "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.289.0"
}, },
"time": "2023-03-01T17:20:18+00:00" "time": "2023-02-26T01:10:11+00:00"
}, },
{ {
"name": "google/auth", "name": "google/auth",
@ -2605,16 +2605,16 @@
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "67c26b443f348a51926030c83481b85718457d3d" "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/67c26b443f348a51926030c83481b85718457d3d", "url": "https://api.github.com/repos/guzzle/psr7/zipball/3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"reference": "67c26b443f348a51926030c83481b85718457d3d", "reference": "3cf1b6d4f0c820a2cf8bcaec39fc698f3443b5cf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2704,7 +2704,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.4.3" "source": "https://github.com/guzzle/psr7/tree/2.4.4"
}, },
"funding": [ "funding": [
{ {
@ -2720,7 +2720,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-10-26T14:07:24+00:00" "time": "2023-03-09T13:19:02+00:00"
}, },
{ {
"name": "guzzlehttp/uri-template", "name": "guzzlehttp/uri-template",
@ -14427,16 +14427,16 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.11.0", "version": "1.11.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -14474,7 +14474,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/myclabs/DeepCopy/issues", "issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
}, },
"funding": [ "funding": [
{ {
@ -14482,7 +14482,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-03-03T13:19:32+00:00" "time": "2023-03-08T13:26:56+00:00"
}, },
{ {
"name": "netresearch/jsonmapper", "name": "netresearch/jsonmapper",
@ -15020,16 +15020,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.5", "version": "1.10.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e" "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a",
"reference": "1fb6f494d82455151ecf15c5c191923f5d84324e", "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15059,7 +15059,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.10.5" "source": "https://github.com/phpstan/phpstan/tree/1.10.6"
}, },
"funding": [ "funding": [
{ {
@ -15075,7 +15075,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-03-07T16:48:45+00:00" "time": "2023-03-09T16:55:12+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -15397,16 +15397,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.6.4", "version": "9.6.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5",
"reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -15439,8 +15439,8 @@
"sebastian/version": "^3.0.2" "sebastian/version": "^3.0.2"
}, },
"suggest": { "suggest": {
"ext-soap": "*", "ext-soap": "To be able to generate mocks based on WSDL files",
"ext-xdebug": "*" "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
}, },
"bin": [ "bin": [
"phpunit" "phpunit"
@ -15479,7 +15479,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5"
}, },
"funding": [ "funding": [
{ {
@ -15495,7 +15495,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-27T13:06:37+00:00" "time": "2023-03-09T06:34:10+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",

View File

@ -11,37 +11,41 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\DataMapper\ClientSettings; use App\Models\User;
use App\DataMapper\CompanySettings; use App\Utils\Ninja;
use App\Events\Payment\PaymentWasCreated; use App\Models\Quote;
use App\Helpers\Invoice\InvoiceSum;
use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Models\Account;
use App\Models\Client; use App\Models\Client;
use App\Models\ClientContact;
use App\Models\Company;
use App\Models\CompanyGateway;
use App\Models\CompanyToken;
use App\Models\Credit; use App\Models\Credit;
use App\Models\GroupSetting; use App\Models\Vendor;
use App\Models\Account;
use App\Models\Company;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Models\Product;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\PaymentType;
use App\Models\Product;
use App\Models\Quote;
use App\Models\RecurringInvoice;
use App\Models\User;
use App\Repositories\CreditRepository;
use App\Repositories\InvoiceRepository;
use App\Repositories\QuoteRepository;
use App\Utils\Ninja;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use App\Models\CompanyToken;
use App\Models\GroupSetting;
use App\Models\ClientContact;
use App\Models\VendorContact;
use App\Models\CompanyGateway;
use Illuminate\Database\Seeder;
use App\Models\RecurringInvoice;
use App\DataMapper\ClientSettings;
use App\DataMapper\CompanySettings;
use App\Helpers\Invoice\InvoiceSum;
use Illuminate\Support\Facades\Hash;
use App\Repositories\QuoteRepository;
use Illuminate\Support\Facades\Cache;
use App\Repositories\CreditRepository;
use Illuminate\Support\Facades\Schema;
use App\Repositories\InvoiceRepository;
use Illuminate\Database\Eloquent\Model;
use App\Events\Payment\PaymentWasCreated;
use App\Helpers\Invoice\InvoiceSumInclusive;
use App\Models\BankIntegration;
use App\Models\BankTransaction;
class RandomDataSeeder extends Seeder class RandomDataSeeder extends Seeder
{ {
@ -117,6 +121,57 @@ class RandomDataSeeder extends Seeder
'settings' => null, 'settings' => null,
]); ]);
$permission_users = [
'permissions',
'products',
'invoices',
'quotes',
'clients',
'vendors',
'tasks',
'expenses',
'projects',
'credits',
'payments',
'bank_transactions',
'purchase_orders',
];
foreach ($permission_users as $p_user) {
$user = User::firstOrNew([
'email' => "{$p_user}@example.com",
]);
$user->first_name = ucfirst($p_user);
$user->last_name = 'Example';
$user->password = Hash::make('password');
$user->account_id = $account->id;
$user->email_verified_at = now();
$user->save();
$company_token = CompanyToken::create([
'user_id' => $user->id,
'company_id' => $company->id,
'account_id' => $account->id,
'name' => 'test token',
'token' => \Illuminate\Support\Str::random(64),
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 0,
'is_admin' => 0,
'is_locked' => 0,
'notifications' => CompanySettings::notificationDefaults(),
'permissions' => '',
'settings' => null,
]);
$user = null;
}
$user = User::firstOrNew([ $user = User::firstOrNew([
'email' => 'user@example.com', 'email' => 'user@example.com',
]); ]);
@ -147,35 +202,6 @@ class RandomDataSeeder extends Seeder
]); ]);
$user = User::firstOrNew([
'email' => 'permissions@example.com',
]);
$user->first_name = 'Permissions';
$user->last_name = 'Example';
$user->password = Hash::make('password');
$user->account_id = $account->id;
$user->email_verified_at = now();
$user->save();
$company_token = CompanyToken::create([
'user_id' => $user->id,
'company_id' => $company->id,
'account_id' => $account->id,
'name' => 'test token',
'token' => \Illuminate\Support\Str::random(64),
]);
$user->companies()->attach($company->id, [
'account_id' => $account->id,
'is_owner' => 0,
'is_admin' => 0,
'is_locked' => 0,
'notifications' => CompanySettings::notificationDefaults(),
'permissions' => '',
'settings' => null,
]);
$client = Client::factory()->create([ $client = Client::factory()->create([
'user_id' => $user->id, 'user_id' => $user->id,
@ -195,6 +221,28 @@ class RandomDataSeeder extends Seeder
'password' => Hash::make('password'), 'password' => Hash::make('password'),
]); ]);
$vendor = Vendor::factory()->create([
'user_id' => $user->id,
'company_id' => $company->id,
'name' => 'cypress'
]);
$vendor->number = $vendor->getNextVendorNumber($vendor);
$vendor->save();
VendorContact::factory()->create([
'user_id' => $user->id,
'vendor_id' => $vendor->id,
'company_id' => $company->id,
'is_primary' => 1,
'email' => 'cypress_vendor@example.com',
'password' => Hash::make('password'),
]);
/* Product Factory */ /* Product Factory */
Product::factory()->count(2)->create(['user_id' => $user->id, 'company_id' => $company->id]); Product::factory()->count(2)->create(['user_id' => $user->id, 'company_id' => $company->id]);
@ -304,6 +352,18 @@ class RandomDataSeeder extends Seeder
'name' => 'Default Client Settings', 'name' => 'Default Client Settings',
]); ]);
$bi = BankIntegration::factory()->create([
'account_id' => $account->id,
'user_id' => $user->id,
'company_id' => $company->id,
]);
BankTransaction::factory()->create([
'bank_integration_id' => $bi->id,
'user_id' => $user->id,
'company_id' => $company->id,
]);
if (config('ninja.testvars.stripe')) { if (config('ninja.testvars.stripe')) {
$cg = new CompanyGateway; $cg = new CompanyGateway;
$cg->company_id = $company->id; $cg->company_id = $company->id;

View File

@ -4852,7 +4852,6 @@ $LANG = array(
'cash_vs_accrual_help' => 'Turn on for accrual reporting, turn off for cash basis reporting.', 'cash_vs_accrual_help' => 'Turn on for accrual reporting, turn off for cash basis reporting.',
'expense_paid_report' => 'Expensed reporting', 'expense_paid_report' => 'Expensed reporting',
'expense_paid_report_help' => 'Turn on for reporting all expenses, turn off for reporting only paid expenses', 'expense_paid_report_help' => 'Turn on for reporting all expenses, turn off for reporting only paid expenses',
'payment_type_Klarna' => 'Klarna',
'online_payment_email_help' => 'Send an email when an online payment is made', 'online_payment_email_help' => 'Send an email when an online payment is made',
'manual_payment_email_help' => 'Send an email when manually entering a payment', 'manual_payment_email_help' => 'Send an email when manually entering a payment',
'mark_paid_payment_email_help' => 'Send an email when marking an invoice as paid', 'mark_paid_payment_email_help' => 'Send an email when marking an invoice as paid',
@ -5015,6 +5014,8 @@ $LANG = array(
'authorization_failure' => 'Insufficient permissions to perform this action', 'authorization_failure' => 'Insufficient permissions to perform this action',
'authorization_sms_failure' => 'Please verify your account to send emails.', 'authorization_sms_failure' => 'Please verify your account to send emails.',
'white_label_body' => 'Thank you for purchasing a white label license. <br><br> Your license key is: <br><br> :license_key', 'white_label_body' => 'Thank you for purchasing a white label license. <br><br> Your license key is: <br><br> :license_key',
'payment_type_Klarna' => 'Klarna',
'payment_type_Interac E Transfer' => 'Interac E Transfer',
); );

View File

@ -49,16 +49,16 @@
</div> </div>
@endif @endif
@if(!empty($payment->type?->name) && !is_null($payment->type?->name))
<div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
<dt class="text-sm font-medium leading-5 text-gray-500"> <dt class="text-sm font-medium leading-5 text-gray-500">
{{ ctrans('texts.method') }} {{ ctrans('texts.method') }}
</dt> </dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $payment->type?->name }} {{ $payment->translatedType() }}
</dd> </dd>
</div> </div>
@endif
@if(!empty($payment->formattedAmount()) && !is_null($payment->formattedAmount())) @if(!empty($payment->formattedAmount()) && !is_null($payment->formattedAmount()))
<div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">

View File

@ -0,0 +1,40 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace Tests\Unit;
use Tests\TestCase;
use App\Models\PaymentType;
use Illuminate\Support\Facades\Lang;
/**
* @test
* @covers App\Models\PaymentType
*/
class PaymentTypeTest extends TestCase
{
protected function setUp() :void
{
parent::setUp();
}
public function testTranslationsExist()
{
$payment_type_class = new PaymentType;
foreach($payment_type_class->type_names as $type)
{nlog($type);
$this->assertTrue(Lang::has("texts.{$type}"));
}
}
}