diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 375b9ca38b13..2e7c6da78441 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -179,9 +179,9 @@ class PreviewController extends BaseController public function design(DesignPreviewRequest $request) { - if (Ninja::isHosted() && !in_array($request->getHost(), ['preview.invoicing.co','staging.invoicing.co'])) { - return response()->json(['message' => 'This server cannot handle this request.'], 400); - } + // if (Ninja::isHosted() && !in_array($request->getHost(), ['preview.invoicing.co','staging.invoicing.co'])) { + // return response()->json(['message' => 'This server cannot handle this request.'], 400); + // } $pdf = (new PdfMock($request->all(), auth()->user()->company()))->build()->getPdf(); diff --git a/composer.json b/composer.json index c85baeeb4327..3e043346cd64 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "halaxa/json-machine": "^0.7.0", "hashids/hashids": "^4.0", "hedii/laravel-gelf-logger": "^7.0", - "imdhemy/laravel-purchases": "^1.7", + "imdhemy/laravel-purchases": "^0.10.3", "intervention/image": "^2.5", "invoiceninja/inspector": "^1.0", "laracasts/presenter": "^0.2.1", diff --git a/composer.lock b/composer.lock index c450d418938f..ebd8bf9d2236 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": "5aa22a61531e67324395d207a7c94e27", + "content-hash": "1d0b16310de636e662f09a655f374f83", "packages": [ { "name": "afosto/yaac", @@ -380,16 +380,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.261.8", + "version": "3.261.9", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8" + "reference": "d91e6f89a6c41e8df859b0d313150386cfee6f6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9c38c82b7d3fb2b15957e71cae3957450e131ed8", - "reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d91e6f89a6c41e8df859b0d313150386cfee6f6a", + "reference": "d91e6f89a6c41e8df859b0d313150386cfee6f6a", "shasum": "" }, "require": { @@ -468,9 +468,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.261.8" + "source": "https://github.com/aws/aws-sdk-php/tree/3.261.9" }, - "time": "2023-03-09T19:23:27+00:00" + "time": "2023-03-10T19:25:08+00:00" }, { "name": "bacon/bacon-qr-code", @@ -3045,34 +3045,29 @@ }, { "name": "imdhemy/appstore-iap", - "version": "1.5.4", + "version": "0.3.11", "source": { "type": "git", "url": "https://github.com/imdhemy/appstore-iap.git", - "reference": "319253eecb8844fef07848917383d9b4aa9ba2c6" + "reference": "f1400b7df2e003f8be0ef2f3fa267f7fbb2b69a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/319253eecb8844fef07848917383d9b4aa9ba2c6", - "reference": "319253eecb8844fef07848917383d9b4aa9ba2c6", + "url": "https://api.github.com/repos/imdhemy/appstore-iap/zipball/f1400b7df2e003f8be0ef2f3fa267f7fbb2b69a5", + "reference": "f1400b7df2e003f8be0ef2f3fa267f7fbb2b69a5", "shasum": "" }, "require": { "ext-json": "*", - "ext-openssl": "*", - "ext-sodium": "*", - "guzzlehttp/guzzle": "^6.5|^7.4", - "lcobucci/jwt": "^4.2", - "nesbot/carbon": "^2.64", - "php": ">=7.4" + "guzzlehttp/guzzle": "^6.0|^7.0", + "nesbot/carbon": "^2.41" }, "require-dev": { - "fakerphp/faker": "^1.15", - "friendsofphp/php-cs-fixer": "^3.0", - "phpunit/phpunit": "^9.5", - "roave/security-advisories": "dev-latest", - "symfony/var-dumper": "^5.3", - "vimeo/psalm": "^5.1" + "fakerphp/faker": "^1.14", + "friendsofphp/php-cs-fixer": "^2.16", + "phpunit/phpunit": "^8.5", + "symfony/var-dumper": "^5.1", + "vimeo/psalm": "^3.17" }, "type": "library", "autoload": { @@ -3082,7 +3077,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { @@ -3093,38 +3088,37 @@ "description": "PHP Appstore In-App Purchase implementation", "support": { "issues": "https://github.com/imdhemy/appstore-iap/issues", - "source": "https://github.com/imdhemy/appstore-iap/tree/1.5.4" + "source": "https://github.com/imdhemy/appstore-iap/tree/0.3.11" }, - "time": "2022-12-11T10:53:59+00:00" + "time": "2021-05-15T06:44:10+00:00" }, { "name": "imdhemy/google-play-billing", - "version": "1.3.1", + "version": "0.6.4", "source": { "type": "git", "url": "https://github.com/imdhemy/google-play-billing.git", - "reference": "803b3357dfa31f89d062dbe757e10a482e262a35" + "reference": "957ec1a17db844ee74b1ad71252d2fbd489ab033" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/google-play-billing/zipball/803b3357dfa31f89d062dbe757e10a482e262a35", - "reference": "803b3357dfa31f89d062dbe757e10a482e262a35", + "url": "https://api.github.com/repos/imdhemy/google-play-billing/zipball/957ec1a17db844ee74b1ad71252d2fbd489ab033", + "reference": "957ec1a17db844ee74b1ad71252d2fbd489ab033", "shasum": "" }, "require": { "ext-json": "*", "google/auth": "^1.15", - "guzzlehttp/guzzle": "^6.5|^7.4", + "guzzlehttp/guzzle": "^6.0|^7.0", "nesbot/carbon": "^2.41", - "php": ">=7.4" + "php": ">=7.1" }, "require-dev": { - "fakerphp/faker": "^1.16", - "friendsofphp/php-cs-fixer": "^3.2", - "phpunit/phpunit": "^9.5", - "roave/security-advisories": "dev-latest", - "symfony/var-dumper": "^5.3", - "vimeo/psalm": "^4.12" + "friendsofphp/php-cs-fixer": "^2.16", + "fzaninotto/faker": "^1.9", + "phpunit/phpunit": "^8.5", + "symfony/var-dumper": "^5.1", + "vimeo/psalm": "^3.17" }, "type": "library", "autoload": { @@ -3133,9 +3127,6 @@ } }, "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], "authors": [ { "name": "imdhemy", @@ -3145,44 +3136,43 @@ "description": "Google Play Billing", "support": { "issues": "https://github.com/imdhemy/google-play-billing/issues", - "source": "https://github.com/imdhemy/google-play-billing/tree/1.3.1" + "source": "https://github.com/imdhemy/google-play-billing/tree/0.6.4" }, - "time": "2022-12-09T09:08:03+00:00" + "time": "2021-10-16T09:50:02+00:00" }, { "name": "imdhemy/laravel-purchases", - "version": "1.7.2", + "version": "0.10.4", "source": { "type": "git", "url": "https://github.com/imdhemy/laravel-in-app-purchases.git", - "reference": "bc70dfdec89f000c4048ef3fb3527d2d2eee9cb3" + "reference": "eb9a4d248a626cb6b7a59c9626726fd8534aec78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/laravel-in-app-purchases/zipball/bc70dfdec89f000c4048ef3fb3527d2d2eee9cb3", - "reference": "bc70dfdec89f000c4048ef3fb3527d2d2eee9cb3", + "url": "https://api.github.com/repos/imdhemy/laravel-in-app-purchases/zipball/eb9a4d248a626cb6b7a59c9626726fd8534aec78", + "reference": "eb9a4d248a626cb6b7a59c9626726fd8534aec78", "shasum": "" }, "require": { "ext-json": "*", - "ext-openssl": "*", - "imdhemy/appstore-iap": "^1.5", - "imdhemy/google-play-billing": "^1.2", - "laravel/framework": ">=8.0", - "php": ">=7.4" + "imdhemy/appstore-iap": "^0.3", + "imdhemy/google-play-billing": "^0.6", + "nesbot/carbon": "^2.41", + "php": ">=7.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.14", - "orchestra/testbench": "^6.24", - "psalm/plugin-laravel": "^1.5", - "roave/security-advisories": "dev-latest", - "vimeo/psalm": "^4.30" + "friendsofphp/php-cs-fixer": "^2.17", + "orchestra/testbench": "^5.0", + "phpunit/phpunit": "^8.5", + "psalm/plugin-laravel": "^1.2", + "vimeo/psalm": "^4.3" }, "type": "library", "extra": { "laravel": { "providers": [ - "Imdhemy\\Purchases\\ServiceProviders\\LiapServiceProvider" + "Imdhemy\\Purchases\\PurchaseServiceProvider" ], "aliases": { "Product": "\\Imdhemy\\Purchases\\Facades\\Product", @@ -3202,13 +3192,14 @@ "authors": [ { "name": "imdhemy", - "email": "imdhemy@gmail.com" + "email": "imdhemy@gmail.com", + "homepage": "http://dhemy.studio", + "role": "Developer" } ], - "description": "The top-notch Laravel receipt validator.", - "homepage": "https://imdhemy.com/laravel-iap-docs", + "description": "Laravel receipt validator for Google Play", + "homepage": "https://github.com/imdhemy/laravel-in-app-purchases", "keywords": [ - "app_store", "google_play", "in_app_purchases", "laravel", @@ -3216,7 +3207,7 @@ ], "support": { "issues": "https://github.com/imdhemy/laravel-in-app-purchases/issues", - "source": "https://github.com/imdhemy/laravel-in-app-purchases/tree/1.7.2" + "source": "https://github.com/imdhemy/laravel-in-app-purchases/tree/0.10.4" }, "funding": [ { @@ -3224,7 +3215,7 @@ "type": "github" } ], - "time": "2023-03-06T15:16:39+00:00" + "time": "2022-08-20T04:59:54+00:00" }, { "name": "intervention/image", @@ -4432,34 +4423,37 @@ }, { "name": "league/csv", - "version": "9.8.0", + "version": "9.9.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47" + "reference": "b4418ede47fbd88facc34e40a16c8ce9153b961b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/9d2e0265c5d90f5dd601bc65ff717e05cec19b47", - "reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/b4418ede47fbd88facc34e40a16c8ce9153b961b", + "reference": "b4418ede47fbd88facc34e40a16c8ce9153b961b", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", - "php": "^7.4 || ^8.0" + "php": "^8.1.2" }, "require-dev": { - "ext-curl": "*", + "doctrine/collections": "^2.1.2", "ext-dom": "*", - "friendsofphp/php-cs-fixer": "^v3.4.0", - "phpstan/phpstan": "^1.3.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.11" + "ext-xdebug": "*", + "friendsofphp/php-cs-fixer": "^v3.14.3", + "phpbench/phpbench": "^1.2.8", + "phpstan/phpstan": "^1.10.4", + "phpstan/phpstan-deprecation-rules": "^1.1.2", + "phpstan/phpstan-phpunit": "^1.3.10", + "phpstan/phpstan-strict-rules": "^1.5.0", + "phpunit/phpunit": "^10.0.14" }, "suggest": { - "ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes", + "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters" }, "type": "library", @@ -4512,7 +4506,7 @@ "type": "github" } ], - "time": "2022-01-04T00:13:07+00:00" + "time": "2023-03-11T15:57:12+00:00" }, { "name": "league/flysystem", @@ -5064,16 +5058,16 @@ }, { "name": "mollie/mollie-api-php", - "version": "v2.50.0", + "version": "v2.50.1", "source": { "type": "git", "url": "https://github.com/mollie/mollie-api-php.git", - "reference": "2291b114ec636392e3e48b73d33199b3b4a790d5" + "reference": "b2739c31a8a037d6fa1bf204e071c9dd4f465f38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/2291b114ec636392e3e48b73d33199b3b4a790d5", - "reference": "2291b114ec636392e3e48b73d33199b3b4a790d5", + "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/b2739c31a8a037d6fa1bf204e071c9dd4f465f38", + "reference": "b2739c31a8a037d6fa1bf204e071c9dd4f465f38", "shasum": "" }, "require": { @@ -5150,9 +5144,9 @@ ], "support": { "issues": "https://github.com/mollie/mollie-api-php/issues", - "source": "https://github.com/mollie/mollie-api-php/tree/v2.50.0" + "source": "https://github.com/mollie/mollie-api-php/tree/v2.50.1" }, - "time": "2023-01-02T08:49:24+00:00" + "time": "2023-03-10T12:15:10+00:00" }, { "name": "moneyphp/money", diff --git a/config/purchase.php b/config/purchase.php new file mode 100644 index 000000000000..6501dc836aaa --- /dev/null +++ b/config/purchase.php @@ -0,0 +1,74 @@ + [], + + 'google_play_package_name' => env('GOOGLE_PLAY_PACKAGE_NAME', 'com.invoiceninja.app'), + + 'appstore_password' => env('APPSTORE_PASSWORD', ''), + + 'eventListeners' => [ + /** + * -------------------------------------------------------- + * Google Play Events + * -------------------------------------------------------- + */ + SubscriptionPurchased::class => [], + SubscriptionRenewed::class => [PlayStoreRenewSubscription::class], + SubscriptionInGracePeriod::class => [], + SubscriptionExpired::class => [], + SubscriptionCanceled::class => [], + SubscriptionPaused::class => [], + SubscriptionRestarted::class => [], + SubscriptionDeferred::class => [], + SubscriptionRevoked::class => [], + SubscriptionOnHold::class => [], + SubscriptionRecovered::class => [], + SubscriptionPauseScheduleChanged::class => [], + SubscriptionPriceChangeConfirmed::class => [], + + /** + * -------------------------------------------------------- + * Appstore Events + * -------------------------------------------------------- + */ + Cancel::class => [], + DidChangeRenewalPref::class => [], + DidChangeRenewalStatus::class => [], + DidFailToRenew::class => [], + DidRecover::class => [], + DidRenew::class => [AppStoreRenewSubscription::class], + InitialBuy::class => [], + InteractiveRenewal::class => [], + PriceIncreaseConsent::class => [], + Refund::class => [], + Revoke::class => [], + ], +]; \ No newline at end of file