-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3c8b657
Showing
7 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Lasse Rafn <[email protected]> | ||
|
||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
> THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "lasserafn/laravel-pipedrive-signup", | ||
"description": "", | ||
"keywords": ["laravel", "pipedrive", "signup"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Lasse Rafn", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0", | ||
"illuminate/support": "5.1.*|5.2.*|5.3.*", | ||
"guzzlehttp/guzzle": "^6.2" | ||
}, | ||
"require-dev": { | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"LasseRafn\\PipedriveSignup\\": "src" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Laravel Pipedrive Signup | ||
|
||
#Installation | ||
|
||
1. Require using composer | ||
```` | ||
composer require lasserafn/laravel-pipedrive-signup | ||
```` | ||
2. Add the PipedriveSignupServiceProvider to your ````config/app.php```` providers array. | ||
```` | ||
'providers' => [ | ||
\LasseRafn\PipedriveSignup\PipedriveSignupServiceProvider::class, | ||
] | ||
```` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php namespace LasseRafn\PipedriveSignup; | ||
|
||
use GuzzleHttp\Client; | ||
|
||
class PipedriveSignup | ||
{ | ||
protected $endpoint = 'https://secure.e-conomic.com'; | ||
private $referralKey; | ||
|
||
function __construct() | ||
{ | ||
$this->referralKey = config( 'pipedrive-signup.referral_key' ); | ||
|
||
$this->client = new Client( [ | ||
'base_uri' => $this->endpoint, | ||
'headers' => [ | ||
'Content-Type' => 'application/x-www-form-urlencoded' | ||
] | ||
] ); | ||
} | ||
|
||
public function signup( $userName, $userEmail, $companyName ) | ||
{ | ||
try | ||
{ | ||
$this->client->post( '/secure/signup/partnertrial/', [ | ||
'form_params' => [ | ||
'UserEmail' => $userEmail, | ||
'UserName' => $userName, | ||
'CompanyName' => $companyName, | ||
'PartnerAgreementNo' => $this->partnerAgreementNo, | ||
'PartnerKey' => $this->partnerKey | ||
], | ||
'Content-Type' => 'application/x-www-form-urlencoded' | ||
] ); | ||
|
||
// todo check if redirected to welcome page! | ||
|
||
return true; | ||
} catch ( \Exception $exception ) | ||
{ | ||
throw new \Exception( $exception->getMessage(), $exception->getCode(), $exception->getPrevious() ); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php namespace LasseRafn\PipedriveSignup; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class PipedriveSignupServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Indicates if loading of the provider is deferred. | ||
* | ||
* @var bool | ||
*/ | ||
protected $defer = true; | ||
|
||
/** | ||
* Boot | ||
*/ | ||
public function boot() | ||
{ | ||
$configPath = __DIR__ . '/config/pipedrive-signup.php'; | ||
$this->mergeConfigFrom($configPath, 'pipedrive-signup'); | ||
|
||
$configPath = __DIR__ . '/config/pipedrive-signup.php'; | ||
|
||
if (function_exists('config_path')) { | ||
$publishPath = config_path('pipedrive-signup.php'); | ||
} else { | ||
$publishPath = base_path('config/pipedrive-signup.php'); | ||
} | ||
|
||
$this->publishes([$configPath => $publishPath], 'config'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
return [ | ||
'referral_key' => '' // In case you want to referr people too | ||
]; |