diff --git a/composer.json b/composer.json
index 91aeafb7..19197188 100644
--- a/composer.json
+++ b/composer.json
@@ -30,6 +30,8 @@
"php": "^8.1",
"ext-curl": "*",
"guzzlehttp/guzzle": "~7.0",
+ "illuminate/console": "~6.0|~7.0|~8.0|~9.0|^10.0|^11.0",
+ "illuminate/process": "~6.0|~7.0|~8.0|~9.0|^10.0|^11.0",
"illuminate/support": "~6.0|~7.0|~8.0|~9.0|^10.0|^11.0",
"nesbot/carbon": "~2.0|^3.0"
},
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 139dd0a3..5bff6011 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -23,6 +23,7 @@
src/PayPalFacadeAccessor.php
src/Traits/PayPalVerifyIPN.php
src/Services/Str.php
+ src/Commands/
src/Facades/
src/Providers/
diff --git a/phpunit.xml.dist.php72 b/phpunit.xml.dist.php72
deleted file mode 100644
index 69b5cd67..00000000
--- a/phpunit.xml.dist.php72
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- tests
-
-
-
-
- src/
-
- src/PayPalFacadeAccessor.php
- src/Traits/PayPalVerifyIPN.php
- src/Services/Str.php
- src/Facades/
- src/Providers/
-
-
-
-
-
-
-
-
-
-
diff --git a/phpunit.xml.dist.php8 b/phpunit.xml.dist.php8
deleted file mode 100644
index 0748be70..00000000
--- a/phpunit.xml.dist.php8
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
- src/
-
-
- src/PayPalFacadeAccessor.php
- src/Traits/PayPalVerifyIPN.php
- src/Services/Str.php
- src/Facades/
- src/Providers/
-
-
-
-
-
-
-
-
-
- tests
-
-
-
-
-
-
diff --git a/src/Commands/PublishAssetsCommand.php b/src/Commands/PublishAssetsCommand.php
new file mode 100644
index 00000000..fcc62d36
--- /dev/null
+++ b/src/Commands/PublishAssetsCommand.php
@@ -0,0 +1,40 @@
+comment("Installing the PayPal JS SDK through npm");
+
+ $result = Process::run("npm install --save @paypal/paypal-js");
+ if ($result->successful()) {
+ echo $result->output();
+ $this->comment("Installed the PayPal JS SDK.");
+ } else {
+ echo $result->errorOutput();
+ $this->error("Unable to install the PayPal JS SDK.");
+ }
+ }
+}
diff --git a/src/Providers/PayPalServiceProvider.php b/src/Providers/PayPalServiceProvider.php
index ac11e663..0fcfccbe 100644
--- a/src/Providers/PayPalServiceProvider.php
+++ b/src/Providers/PayPalServiceProvider.php
@@ -8,6 +8,7 @@
*/
use Illuminate\Support\ServiceProvider;
+use Srmklive\PayPal\Commands\PublishAssetsCommand;
use Srmklive\PayPal\Services\PayPal as PayPalClient;
class PayPalServiceProvider extends ServiceProvider
@@ -33,6 +34,9 @@ public function boot(): void
// Publish Lang Files
$this->loadTranslationsFrom(__DIR__.'/../../lang', 'paypal');
+
+ // Register artisan commands.
+ $this->registerCommands();
}
/**
@@ -71,4 +75,16 @@ private function mergeConfig(): void
'paypal'
);
}
+
+ /**
+ * Register the console .
+ *
+ * @return void
+ */
+ private function registerCommands(): void
+ {
+ $this->commands([
+ PublishAssetsCommand::class
+ ]);
+ }
}