From b6b36c89fdd138bb42a249ba6a6845b42c455d73 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 15 Sep 2022 17:43:33 +1000 Subject: [PATCH] Add webhook functionality to credits --- app/Models/Webhook.php | 9 ++ app/Observers/CreditObserver.php | 21 +++ composer.json | 4 +- composer.lock | 177 ++++++++++++------------ tests/Feature/CompanyGatewayApiTest.php | 2 +- 5 files changed, 125 insertions(+), 88 deletions(-) diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index fb0bb4b731..da8c142367 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -70,6 +70,12 @@ class Webhook extends BaseModel const EVENT_PROJECT_UPDATE = 26; + const EVENT_CREATE_CREDIT = 27; + + const EVENT_UPDATE_CREDIT = 28; + + const EVENT_DELETE_CREDIT = 29; + public static $valid_events = [ self::EVENT_CREATE_CLIENT, self::EVENT_CREATE_INVOICE, @@ -97,6 +103,9 @@ class Webhook extends BaseModel self::EVENT_REMIND_INVOICE, self::EVENT_PROJECT_CREATE, self::EVENT_PROJECT_UPDATE, + self::EVENT_CREATE_CREDIT, + self::EVENT_UPDATE_CREDIT, + self::EVENT_DELETE_CREDIT, ]; protected $fillable = [ diff --git a/app/Observers/CreditObserver.php b/app/Observers/CreditObserver.php index 497e32e6dc..a60e5f02eb 100644 --- a/app/Observers/CreditObserver.php +++ b/app/Observers/CreditObserver.php @@ -27,6 +27,13 @@ class CreditObserver */ public function created(Credit $credit) { + $subscriptions = Webhook::where('company_id', $credit->company->id) + ->where('event_id', Webhook::EVENT_CREATE_CREDIT) + ->exists(); + + if ($subscriptions) { + WebhookHandler::dispatch(Webhook::EVENT_CREATE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(2)); + } } /** @@ -37,6 +44,13 @@ class CreditObserver */ public function updated(Credit $credit) { + $subscriptions = Webhook::where('company_id', $credit->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_CREDIT) + ->exists(); + + if ($subscriptions) { + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(2)); + } } /** @@ -47,6 +61,13 @@ class CreditObserver */ public function deleted(Credit $credit) { + $subscriptions = Webhook::where('company_id', $credit->company->id) + ->where('event_id', Webhook::EVENT_DELETE_CREDIT) + ->exists(); + + if ($subscriptions) { + WebhookHandler::dispatch(Webhook::EVENT_DELETE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(2)); + } } /** diff --git a/composer.json b/composer.json index da1207a62b..db974d3876 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "authorizenet/authorizenet": "^2.0", "awobaz/compoships": "^2.1", "bacon/bacon-qr-code": "^2.0", - "beganovich/snappdf": "^2", + "beganovich/snappdf": "^3", "braintree/braintree_php": "^6.0", "checkout/checkout-sdk-php": "^2.5", "cleverit/ubl_invoice": "^1.3", @@ -57,7 +57,7 @@ "intervention/image": "^2.5", "invoiceninja/inspector": "^1.0", "laracasts/presenter": "^0.2.1", - "laravel/framework": "^9.17", + "laravel/framework": "^9.3", "laravel/slack-notification-channel": "^2.2", "laravel/socialite": "^5", "laravel/tinker": "^2.7", diff --git a/composer.lock b/composer.lock index add2c282c3..2a1246227d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8d9b065d1cf3f4fd42565e77e63c53fc", + "content-hash": "9dc581f41118f9f990e06f938c842839", "packages": [ { "name": "afosto/yaac", @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.235.5", + "version": "3.235.8", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e" + "reference": "cc33d53d735a3835adff212598f2a20ee9ac9531" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3b002b92369dbcb8d86f32546cb324eabcd19a4e", - "reference": "3b002b92369dbcb8d86f32546cb324eabcd19a4e", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cc33d53d735a3835adff212598f2a20ee9ac9531", + "reference": "cc33d53d735a3835adff212598f2a20ee9ac9531", "shasum": "" }, "require": { @@ -406,6 +406,7 @@ "aws/aws-php-sns-message-validator": "~1.0", "behat/behat": "~3.0", "composer/composer": "^1.10.22", + "dms/phpunit-arraysubset-asserts": "^0.4.0", "doctrine/cache": "~1.4", "ext-dom": "*", "ext-openssl": "*", @@ -413,10 +414,11 @@ "ext-sockets": "*", "nette/neon": "^2.3", "paragonie/random_compat": ">= 2", - "phpunit/phpunit": "^4.8.35 || ^5.6.3", + "phpunit/phpunit": "^4.8.35 || ^5.6.3 || ^9.5", "psr/cache": "^1.0", "psr/simple-cache": "^1.0", - "sebastian/comparator": "^1.2.3" + "sebastian/comparator": "^1.2.3 || ^4.0", + "yoast/phpunit-polyfills": "^1.0" }, "suggest": { "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", @@ -464,9 +466,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.235.5" + "source": "https://github.com/aws/aws-sdk-php/tree/3.235.8" }, - "time": "2022-09-09T18:19:38+00:00" + "time": "2022-09-14T18:18:31+00:00" }, { "name": "bacon/bacon-qr-code", @@ -524,16 +526,16 @@ }, { "name": "beganovich/snappdf", - "version": "v2.2.0", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/beganovich/snappdf.git", - "reference": "7964d03c091f3a30513fb6c44ea353c575ba523a" + "reference": "b2656c2c67be086b535cd13a704e27caaf5a7570" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beganovich/snappdf/zipball/7964d03c091f3a30513fb6c44ea353c575ba523a", - "reference": "7964d03c091f3a30513fb6c44ea353c575ba523a", + "url": "https://api.github.com/repos/beganovich/snappdf/zipball/b2656c2c67be086b535cd13a704e27caaf5a7570", + "reference": "b2656c2c67be086b535cd13a704e27caaf5a7570", "shasum": "" }, "require": { @@ -570,9 +572,9 @@ "description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.", "support": { "issues": "https://github.com/beganovich/snappdf/issues", - "source": "https://github.com/beganovich/snappdf/tree/v2.2.0" + "source": "https://github.com/beganovich/snappdf/tree/v3.1.0" }, - "time": "2022-06-29T13:08:15+00:00" + "time": "2022-09-14T10:35:47+00:00" }, { "name": "braintree/braintree_php", @@ -2162,16 +2164,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.265.0", + "version": "v0.266.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "a23754daa452e26a8dd31a7848863c67a2e3d67e" + "reference": "27ead5edc8ba4a17ddd211ad03216c313a57411f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/a23754daa452e26a8dd31a7848863c67a2e3d67e", - "reference": "a23754daa452e26a8dd31a7848863c67a2e3d67e", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/27ead5edc8ba4a17ddd211ad03216c313a57411f", + "reference": "27ead5edc8ba4a17ddd211ad03216c313a57411f", "shasum": "" }, "require": { @@ -2200,9 +2202,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.265.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.266.0" }, - "time": "2022-09-04T00:58:12+00:00" + "time": "2022-09-12T01:28:14+00:00" }, { "name": "google/auth", @@ -3481,16 +3483,16 @@ }, { "name": "laravel/framework", - "version": "v9.29.0", + "version": "v9.30.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb" + "reference": "2ca2b168a3e995a8ec6ea2805906379095d20080" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/585da0913e907fd54941260860ae3d7d4be8e8cb", - "reference": "585da0913e907fd54941260860ae3d7d4be8e8cb", + "url": "https://api.github.com/repos/laravel/framework/zipball/2ca2b168a3e995a8ec6ea2805906379095d20080", + "reference": "2ca2b168a3e995a8ec6ea2805906379095d20080", "shasum": "" }, "require": { @@ -3567,12 +3569,15 @@ "illuminate/view": "self.version" }, "require-dev": { + "ably/ably-php": "^1.0", "aws/aws-sdk-php": "^3.198.1", "doctrine/dbal": "^2.13.3|^3.1.4", "fakerphp/faker": "^1.9.2", "guzzlehttp/guzzle": "^7.2", "league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-ftp": "^3.0", + "league/flysystem-path-prefixing": "^3.3", + "league/flysystem-read-only": "^3.3", "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.4.4", "orchestra/testbench-core": "^7.1", @@ -3600,6 +3605,8 @@ "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.0).", "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.0).", + "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.3).", + "league/flysystem-read-only": "Required to use read-only disks (^3.3)", "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.0).", "mockery/mockery": "Required to use mocking (^1.4.4).", "nyholm/psr7": "Required to use PSR-7 bridging features (^1.2).", @@ -3657,7 +3664,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-09-09T18:21:21+00:00" + "time": "2022-09-13T14:06:14+00:00" }, { "name": "laravel/serializable-closure", @@ -5578,20 +5585,20 @@ }, { "name": "nette/utils", - "version": "v3.2.7", + "version": "v3.2.8", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/0af4e3de4df9f1543534beab255ccf459e7a2c99", - "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", + "url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", + "reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", "shasum": "" }, "require": { - "php": ">=7.2 <8.2" + "php": ">=7.2 <8.3" }, "conflict": { "nette/di": "<3.0.6" @@ -5657,9 +5664,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v3.2.7" + "source": "https://github.com/nette/utils/tree/v3.2.8" }, - "time": "2022-01-24T11:29:14+00:00" + "time": "2022-09-12T23:36:20+00:00" }, { "name": "nikic/php-parser", @@ -7653,20 +7660,20 @@ }, { "name": "ramsey/uuid", - "version": "4.4.0", + "version": "4.5.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a" + "reference": "ef842484ba57f163c6d465ab744bfecb872a11d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/373f7bacfcf3de038778ff27dcce5672ddbf4c8a", - "reference": "373f7bacfcf3de038778ff27dcce5672ddbf4c8a", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/ef842484ba57f163c6d465ab744bfecb872a11d4", + "reference": "ef842484ba57f163c6d465ab744bfecb872a11d4", "shasum": "" }, "require": { - "brick/math": "^0.8 || ^0.9 || ^0.10", + "brick/math": "^0.8.8 || ^0.9 || ^0.10", "ext-ctype": "*", "ext-json": "*", "php": "^8.0", @@ -7687,12 +7694,13 @@ "php-mock/php-mock-mockery": "^1.3", "php-parallel-lint/php-parallel-lint": "^1.1", "phpbench/phpbench": "^1.0", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-mockery": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-phpunit": "^1.1", "phpunit/phpunit": "^8.5 || ^9", - "slevomat/coding-standard": "^7.0", + "ramsey/composer-repl": "^1.4", + "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.5", "vimeo/psalm": "^4.9" }, @@ -7730,7 +7738,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.4.0" + "source": "https://github.com/ramsey/uuid/tree/4.5.0" }, "funding": [ { @@ -7742,7 +7750,7 @@ "type": "tidelift" } ], - "time": "2022-08-05T17:58:37+00:00" + "time": "2022-09-15T01:44:53+00:00" }, { "name": "razorpay/razorpay", @@ -11936,16 +11944,16 @@ }, { "name": "tijsverkoyen/css-to-inline-styles", - "version": "2.2.4", + "version": "2.2.5", "source": { "type": "git", "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c" + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/da444caae6aca7a19c0c140f68c6182e337d5b1c", - "reference": "da444caae6aca7a19c0c140f68c6182e337d5b1c", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/4348a3a06651827a27d989ad1d13efec6bb49b19", + "reference": "4348a3a06651827a27d989ad1d13efec6bb49b19", "shasum": "" }, "require": { @@ -11983,9 +11991,9 @@ "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", "support": { "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", - "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.4" + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.5" }, - "time": "2021-12-08T09:12:39+00:00" + "time": "2022-09-12T13:28:28+00:00" }, { "name": "turbo124/beacon", @@ -12742,16 +12750,16 @@ }, { "name": "brianium/paratest", - "version": "v6.6.3", + "version": "v6.6.4", "source": { "type": "git", "url": "https://github.com/paratestphp/paratest.git", - "reference": "f2d781bb9136cda2f5e73ee778049e80ba681cf6" + "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paratestphp/paratest/zipball/f2d781bb9136cda2f5e73ee778049e80ba681cf6", - "reference": "f2d781bb9136cda2f5e73ee778049e80ba681cf6", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/4ce800dc32fd0292a4f05c00f347142dce1ecdda", + "reference": "4ce800dc32fd0292a4f05c00f347142dce1ecdda", "shasum": "" }, "require": { @@ -12761,24 +12769,23 @@ "ext-simplexml": "*", "jean85/pretty-package-versions": "^2.0.5", "php": "^7.3 || ^8.0", - "phpunit/php-code-coverage": "^9.2.16", + "phpunit/php-code-coverage": "^9.2.17", "phpunit/php-file-iterator": "^3.0.6", "phpunit/php-timer": "^5.0.3", - "phpunit/phpunit": "^9.5.23", + "phpunit/phpunit": "^9.5.24", "sebastian/environment": "^5.1.4", - "symfony/console": "^5.4.9 || ^6.1.2", - "symfony/polyfill-php80": "^v1.26.0", - "symfony/process": "^5.4.8 || ^6.1.0" + "symfony/console": "^5.4.12 || ^6.1.4", + "symfony/process": "^5.4.11 || ^6.1.3" }, "require-dev": { - "doctrine/coding-standard": "^9.0.0", + "doctrine/coding-standard": "^10.0.0", "ext-pcov": "*", "ext-posix": "*", - "infection/infection": "^0.26.13", + "infection/infection": "^0.26.14", "malukenho/mcbumpface": "^1.1.5", "squizlabs/php_codesniffer": "^3.7.1", - "symfony/filesystem": "^5.4.9 || ^6.1.0", - "vimeo/psalm": "^4.26.0" + "symfony/filesystem": "^5.4.12 || ^6.1.4", + "vimeo/psalm": "^4.27.0" }, "bin": [ "bin/paratest", @@ -12819,7 +12826,7 @@ ], "support": { "issues": "https://github.com/paratestphp/paratest/issues", - "source": "https://github.com/paratestphp/paratest/tree/v6.6.3" + "source": "https://github.com/paratestphp/paratest/tree/v6.6.4" }, "funding": [ { @@ -12831,7 +12838,7 @@ "type": "paypal" } ], - "time": "2022-08-25T05:44:14+00:00" + "time": "2022-09-13T10:47:01+00:00" }, { "name": "composer/package-versions-deprecated", @@ -14989,16 +14996,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -15051,7 +15058,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -15059,7 +15066,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -15249,16 +15256,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -15314,7 +15321,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -15322,7 +15329,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -15677,16 +15684,16 @@ }, { "name": "sebastian/type", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb44e1cc6e557418387ad815780360057e40753e" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", - "reference": "fb44e1cc6e557418387ad815780360057e40753e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -15698,7 +15705,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -15721,7 +15728,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -15729,7 +15736,7 @@ "type": "github" } ], - "time": "2022-08-29T06:55:37+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", diff --git a/tests/Feature/CompanyGatewayApiTest.php b/tests/Feature/CompanyGatewayApiTest.php index 5b6bbf9e4b..b036dd35c8 100644 --- a/tests/Feature/CompanyGatewayApiTest.php +++ b/tests/Feature/CompanyGatewayApiTest.php @@ -512,6 +512,6 @@ class CompanyGatewayApiTest extends TestCase $company_gateway = CompanyGateway::find($id); - $this->assertEquals(1.2, $company_gateway->calcGatewayFee(10, GatewayType::CREDIT_CARD, true)); + $this->assertEquals(1.2, round($company_gateway->calcGatewayFee(10, GatewayType::CREDIT_CARD, true),1)); } }