]> _ Git - cubist_dsn.git/commitdiff
wip #7646 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Jul 2025 09:42:08 +0000 (11:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 17 Jul 2025 09:42:08 +0000 (11:42 +0200)
.gitignore [new file with mode: 0644]
composer.json [new file with mode: 0644]
src/Api.php [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..8925195
--- /dev/null
@@ -0,0 +1,3 @@
+.idea
+vendor
+composer.lock
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644 (file)
index 0000000..c13d78b
--- /dev/null
@@ -0,0 +1,43 @@
+{
+  "name": "cubist/dsn",
+  "description": "Implementation of DSN API",
+  "type": "library",
+  "license": "proprietary",
+  "minimum-stability": "dev",
+  "keywords": [
+    "cubist",
+    "dsn"
+  ],
+  "autoload": {
+    "psr-4": {
+      "Cubist\\DSN\\": "src"
+    }
+  },
+  "authors": [
+    {
+      "name": "Vincent Vanwaelscappel",
+      "email": "vincent@cubedesigners.com"
+    }
+  ],
+  "require": {
+    "php": ">=7.4",
+    "ext-json": "*",
+    "ext-dom": "*",
+    "ext-libxml": "*",
+    "laravel/framework": "~5.8|^6.0|^7.0|^8.0|^9.0|^10.0",
+    "cubist/util": "dev-master",
+    "guzzlehttp/guzzle": "7.9.x-dev"
+  },
+  "repositories": [
+    {
+      "type": "composer",
+      "url": "https:\/\/composer.cubedesigners.com\/"
+    }
+  ],
+  "extra": {
+    "laravel": {
+      "providers": [
+      ]
+    }
+  }
+}
diff --git a/src/Api.php b/src/Api.php
new file mode 100644 (file)
index 0000000..45fedfd
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+use GuzzleHttp\Client;
+
+class Api
+{
+    const AUTH_URL = 'https://net-entreprises.fr/authentifier/1.0/';
+    const USER_AGENT = 'Cubist DSN PHP API';
+
+    /**
+     * @var Client
+     */
+    protected $client;
+
+
+    public function _construct()
+    {
+
+    }
+
+    public function auth($siret, $name, $firstname, $password, $service = 25)
+    {
+        $this->client = new Client();
+        $response = $this->client->request('POST', self::AUTH_URL,
+            ['body' => $this->_authRequest($siret, $name, $firstname, $password, $service), 'headers' => ['Content-Type' => 'application/xml', 'User-Agent' => self::USER_AGENT]]
+        );
+        dddd($response);
+    }
+
+    protected function _authRequest($siret, $name, $firstname, $password, $service = 25)
+    {
+        return '<identifiants>
+<siret>' . $siret . '</siret>
+<nom>' . $name . '</nom>
+<prenom>' . $firstname . '</prenom>
+<motdepasse>' . $password . '</motdepasse>
+<service>' . $service . '</service>
+</identifiants>';
+    }
+}
\ No newline at end of file