1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Fixes for currency precision

This commit is contained in:
David Bomba 2020-06-15 21:42:46 +10:00
parent 70c5913f1d
commit fc40159d36
15 changed files with 97 additions and 83 deletions

View File

@ -43,6 +43,7 @@ MAIL_FROM_ADDRESS='user@example.com'
MAIL_FROM_NAME='Self Hosted User'
POSTMARK_API_TOKEN=
REQUIRE_HTTPS=true
GOOGLE_MAPS_API_KEY=
API_SECRET=superdoopersecrethere

View File

@ -91,7 +91,7 @@ class InvoiceItemSum
}
private function sumLineItem()
{
{ //todo need to support quantities less than the precision amount
$this->setLineTotal($this->formatValue($this->item->cost, $this->currency->precision) * $this->formatValue($this->item->quantity, $this->currency->precision));
return $this;
}

View File

@ -265,8 +265,8 @@ class BaseController extends Controller
'company.payments.paymentables',
'company.quotes.invitations.contact',
'company.quotes.invitations.company',
'company.credits',
'company.payment_terms',
'company.credits.invitations.company',
'company.payment_terms.company',
//'company.credits.invitations.contact',
//'company.credits.invitations.company',
'company.vendors.contacts',

View File

@ -120,7 +120,7 @@ class PaymentController extends Controller
return $gateway
->driver(auth()->user()->client)
->setPaymentMethod('App\\PaymentDrivers\\Stripe\\Alipay')
->setPaymentMethod($payment_method_id)
->processPaymentView($data);
}

View File

@ -50,8 +50,8 @@ class QueryLogging
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
// if($count > 50)
// Log::info($queries);
if($count > 50)
Log::info($queries);
}
}

View File

@ -44,8 +44,6 @@ class CheckDbStatus implements ShouldQueue
*/
public function handle()
{
info("checking db status");
DbStatus::dispatchNow('db-ninja-01', 'db.status.db-ninja-01');
DbStatus::dispatchNow('db-ninja-02', 'db.status.db-ninja-02');

View File

@ -25,7 +25,7 @@ class Currency extends StaticModel
'updated_at' => 'timestamp',
'created_at' => 'timestamp',
'deleted_at' => 'timestamp',
'precision' => 'string',
//'precision' => 'integer',
//'precision' => 'string',
'precision' => 'integer',
];
}

View File

@ -16,8 +16,8 @@ abstract class AbstractPaymentDriver
abstract public function authorize($payment_method);
abstract public function purchase();
abstract public function purchase($amount, $return_client_response = false);
abstract public function refund();
abstract public function refund($amount, $transaction_reference, $return_client_response = false);
}

View File

@ -94,9 +94,19 @@ class AuthorizePaymentDriver extends BaseDriver
return $this->authorizeView($payment_method);
}
public function processPaymentView($data)
{
}
public function processPaymentResponse($request)
{
}
public function purchase($amount, $return_client_response = false)
{
return ()
return false;
}
public function refund($amount, $transaction_reference, $return_client_response = false)

View File

@ -32,19 +32,21 @@ class BaseDriver extends AbstractPaymentDriver
public $company_gateway;
/* The Invitation */
protected $invitation;
public $invitation;
/* Gateway capabilities */
protected $refundable = false;
public $refundable = false;
/* Token billing */
protected $token_billing = false;
public $token_billing = false;
/* Authorise payment methods */
protected $can_authorise_credit_card = false;
public $can_authorise_credit_card = false;
/* The client */
protected $client;
public $client;
public $payment_method;
public function __construct(CompanyGateway $company_gateway, Client $client = null, $invitation = false)
{
@ -83,4 +85,24 @@ class BaseDriver extends AbstractPaymentDriver
*/
public function refund($amount, $transaction_reference, $return_client_response = false) {}
/**
* Set the inbound request payment method type for access.
*
* @param int $payment_method_id The Payment Method ID
*/
public function setPaymentMethod($payment_method_id)
{
$this->payment_method = $payment_method_id;
return $this;
}
/**
* Get the payment method ID
*
* @return int The payment method ID
*/
public function getPaymentMethod()
{
return $this->payment_method;
}
}

View File

@ -121,6 +121,7 @@ class CompanyTransformer extends EntityTransformer
'slack_webhook_url' => (string)$company->slack_webhook_url,
'google_analytics_url' => (string)$company->google_analytics_key, //@deprecate
'google_analytics_key' => (string)$company->google_analytics_key,
'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates
];
}

108
composer.lock generated
View File

@ -107,16 +107,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.142.0",
"version": "3.142.1",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "0d1c6f5cc98640af39c0ea77f329ada775b70fe6"
"reference": "ab92ec111132712417cc97be06275553b10a76ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0d1c6f5cc98640af39c0ea77f329ada775b70fe6",
"reference": "0d1c6f5cc98640af39c0ea77f329ada775b70fe6",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ab92ec111132712417cc97be06275553b10a76ab",
"reference": "ab92ec111132712417cc97be06275553b10a76ab",
"shasum": ""
},
"require": {
@ -188,7 +188,7 @@
"s3",
"sdk"
],
"time": "2020-06-11T18:12:15+00:00"
"time": "2020-06-12T18:16:31+00:00"
},
{
"name": "beganovich/omnipay-checkout",
@ -1077,20 +1077,6 @@
"sqlserver",
"sqlsrv"
],
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2020-04-20T17:19:26+00:00"
},
{
@ -4272,16 +4258,16 @@
},
{
"name": "php-http/discovery",
"version": "1.7.4",
"version": "1.8.0",
"source": {
"type": "git",
"url": "https://github.com/php-http/discovery.git",
"reference": "82dbef649ccffd8e4f22e1953c3a5265992b83c0"
"reference": "10d9019f393773345aedc0dc79e7fd678da874ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-http/discovery/zipball/82dbef649ccffd8e4f22e1953c3a5265992b83c0",
"reference": "82dbef649ccffd8e4f22e1953c3a5265992b83c0",
"url": "https://api.github.com/repos/php-http/discovery/zipball/10d9019f393773345aedc0dc79e7fd678da874ee",
"reference": "10d9019f393773345aedc0dc79e7fd678da874ee",
"shasum": ""
},
"require": {
@ -4333,7 +4319,7 @@
"message",
"psr7"
],
"time": "2020-01-03T11:25:47+00:00"
"time": "2020-06-14T10:44:12+00:00"
},
{
"name": "php-http/guzzle6-adapter",
@ -5870,12 +5856,6 @@
"screenshot",
"webpage"
],
"funding": [
{
"url": "https://www.patreon.com/spatie",
"type": "patreon"
}
],
"time": "2020-04-20T10:33:41+00:00"
},
{
@ -6192,7 +6172,7 @@
},
{
"name": "symfony/console",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
@ -6283,7 +6263,7 @@
},
{
"name": "symfony/css-selector",
"version": "v5.1.0",
"version": "v5.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@ -6350,7 +6330,7 @@
},
{
"name": "symfony/debug",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
@ -6481,7 +6461,7 @@
},
{
"name": "symfony/error-handler",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
@ -6552,7 +6532,7 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -6694,7 +6674,7 @@
},
{
"name": "symfony/filesystem",
"version": "v5.1.0",
"version": "v5.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@ -6758,7 +6738,7 @@
},
{
"name": "symfony/finder",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@ -6821,7 +6801,7 @@
},
{
"name": "symfony/http-foundation",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
@ -6890,16 +6870,16 @@
},
{
"name": "symfony/http-kernel",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "54526b598d7fc86a67850488b194a88a79ab8467"
"reference": "81d42148474e1852a333ed7a732f2a014af75430"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/54526b598d7fc86a67850488b194a88a79ab8467",
"reference": "54526b598d7fc86a67850488b194a88a79ab8467",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/81d42148474e1852a333ed7a732f2a014af75430",
"reference": "81d42148474e1852a333ed7a732f2a014af75430",
"shasum": ""
},
"require": {
@ -6991,20 +6971,20 @@
"type": "tidelift"
}
],
"time": "2020-05-31T05:25:51+00:00"
"time": "2020-06-12T11:15:37+00:00"
},
{
"name": "symfony/mime",
"version": "v5.1.0",
"version": "v5.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "56261f89385f9d13cf843a5101ac72131190bc91"
"reference": "c0c418f05e727606e85b482a8591519c4712cf45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/56261f89385f9d13cf843a5101ac72131190bc91",
"reference": "56261f89385f9d13cf843a5101ac72131190bc91",
"url": "https://api.github.com/repos/symfony/mime/zipball/c0c418f05e727606e85b482a8591519c4712cf45",
"reference": "c0c418f05e727606e85b482a8591519c4712cf45",
"shasum": ""
},
"require": {
@ -7068,11 +7048,11 @@
"type": "tidelift"
}
],
"time": "2020-05-25T12:33:44+00:00"
"time": "2020-06-09T15:07:35+00:00"
},
{
"name": "symfony/options-resolver",
"version": "v5.1.0",
"version": "v5.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@ -7726,7 +7706,7 @@
},
{
"name": "symfony/process",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
@ -7789,7 +7769,7 @@
},
{
"name": "symfony/routing",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
@ -7951,7 +7931,7 @@
},
{
"name": "symfony/translation",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
@ -8112,7 +8092,7 @@
},
{
"name": "symfony/var-dumper",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
@ -8989,16 +8969,16 @@
},
{
"name": "filp/whoops",
"version": "2.7.2",
"version": "2.7.3",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "17d0d3f266c8f925ebd035cd36f83cf802b47d4a"
"reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/17d0d3f266c8f925ebd035cd36f83cf802b47d4a",
"reference": "17d0d3f266c8f925ebd035cd36f83cf802b47d4a",
"url": "https://api.github.com/repos/filp/whoops/zipball/5d5fe9bb3d656b514d455645b3addc5f7ba7714d",
"reference": "5d5fe9bb3d656b514d455645b3addc5f7ba7714d",
"shasum": ""
},
"require": {
@ -9046,7 +9026,7 @@
"throwable",
"whoops"
],
"time": "2020-05-05T12:28:07+00:00"
"time": "2020-06-14T09:00:00+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -10752,16 +10732,16 @@
},
{
"name": "swagger-api/swagger-ui",
"version": "v3.26.1",
"version": "v3.26.2",
"source": {
"type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "9a0927b52cd1a561990122630b5aeed104798230"
"reference": "ae33deeaab47129844b89192d35762abf5cf80fb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/9a0927b52cd1a561990122630b5aeed104798230",
"reference": "9a0927b52cd1a561990122630b5aeed104798230",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/ae33deeaab47129844b89192d35762abf5cf80fb",
"reference": "ae33deeaab47129844b89192d35762abf5cf80fb",
"shasum": ""
},
"type": "library",
@ -10805,11 +10785,11 @@
"swagger",
"ui"
],
"time": "2020-06-11T21:31:19+00:00"
"time": "2020-06-12T13:09:03+00:00"
},
{
"name": "symfony/yaml",
"version": "v4.4.9",
"version": "v4.4.10",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",

View File

@ -9,6 +9,7 @@ return [
'version_url' => 'https://raw.githubusercontent.com/invoiceninja/invoiceninja/v2/VERSION.txt',
'app_name' => env('APP_NAME'),
'app_env' => env('APP_ENV', 'local'),
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => env('APP_URL', ''),
'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.0.4',

View File

@ -166,6 +166,7 @@ class CreateUsersTable extends Migration
$table->string('subdomain')->nullable();
$table->string('db')->nullable();
$table->unsignedInteger('size_id')->nullable();
$table->unsignedInteger('enabled_item_tax_rates')->nullable();
$table->string('first_day_of_week')->nullable();
$table->string('first_month_of_year')->nullable();
$table->string('portal_mode')->default('subdomain');

View File

@ -81,7 +81,7 @@
</dd>
</div>
<div class="bg-white px-4 py-5 flex justify-end">
<button type="button" id="card_button">{{ ctrans('texts.add_payment_method') }}</button>
<button type="primary" id="card_button">{{ ctrans('texts.add_payment_method') }}</button>
</div>
</dl>
</div>