diff --git a/.env.example b/.env.example index a9c2da28c840..2d5ec6c28f81 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/app/Helpers/Invoice/InvoiceItemSum.php b/app/Helpers/Invoice/InvoiceItemSum.php index 693cc4b4d722..b3f3312ae049 100644 --- a/app/Helpers/Invoice/InvoiceItemSum.php +++ b/app/Helpers/Invoice/InvoiceItemSum.php @@ -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; } diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 6dc1c981a3ba..e25d0a24c6de 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -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', diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 497f96d0c487..315157b8c1b9 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -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); } diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 93d49b446a26..ead6379ced75 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -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); } } diff --git a/app/Jobs/Ninja/CheckDbStatus.php b/app/Jobs/Ninja/CheckDbStatus.php index 30fc46527ea5..fb51c56bac76 100644 --- a/app/Jobs/Ninja/CheckDbStatus.php +++ b/app/Jobs/Ninja/CheckDbStatus.php @@ -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'); diff --git a/app/Models/Currency.php b/app/Models/Currency.php index 3fe1729308cf..0f5e931e56c3 100644 --- a/app/Models/Currency.php +++ b/app/Models/Currency.php @@ -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', ]; } diff --git a/app/PaymentDrivers/AbstractPaymentDriver.php b/app/PaymentDrivers/AbstractPaymentDriver.php index 432b50af9de6..fa9393843ae1 100644 --- a/app/PaymentDrivers/AbstractPaymentDriver.php +++ b/app/PaymentDrivers/AbstractPaymentDriver.php @@ -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); } \ No newline at end of file diff --git a/app/PaymentDrivers/AuthorizePaymentDriver.php b/app/PaymentDrivers/AuthorizePaymentDriver.php index 5cc9abb4c9f4..62560e07804d 100644 --- a/app/PaymentDrivers/AuthorizePaymentDriver.php +++ b/app/PaymentDrivers/AuthorizePaymentDriver.php @@ -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) diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index e488d5798964..4c003978742b 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -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; + } } diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index ab72a3b0bdd6..96e7d2be7038 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -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 ]; } diff --git a/composer.lock b/composer.lock index 7ab89226bbae..34bb1de41415 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/config/ninja.php b/config/ninja.php index 62122a5c2730..d2a5bed810ff 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -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', diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 35e22822d1c1..f01254ba61b4 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -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'); diff --git a/resources/views/portal/ninja2020/gateways/authorize/add_credit_card.blade.php b/resources/views/portal/ninja2020/gateways/authorize/add_credit_card.blade.php index 804b3b68528d..aaeba35c1aaf 100644 --- a/resources/views/portal/ninja2020/gateways/authorize/add_credit_card.blade.php +++ b/resources/views/portal/ninja2020/gateways/authorize/add_credit_card.blade.php @@ -81,7 +81,7 @@