File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/Picqer/Carriers/SendCloud Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ composer require picqer/sendcloud-php-client
1313```
1414
1515## Set-up connection
16- Prepare the client for connecting to SendCloud with your API key and secret
16+ Prepare the client for connecting to SendCloud with your API key, API secret and Sendcloud Partner id (optional)
1717``` php
18- $connection = new \Picqer\Carriers\SendCloud\Connection('apikey', 'apisecret');
18+ $connection = new \Picqer\Carriers\SendCloud\Connection('apikey', 'apisecret', 'partnerid' );
1919$sendCloud = new \Picqer\Carriers\SendCloud\SendCloud($connection);
2020```
2121
Original file line number Diff line number Diff line change @@ -31,6 +31,13 @@ class Connection
3131 */
3232 private $ apiSecret ;
3333
34+ /**
35+ * The Sendcloud Partner ID
36+ *
37+ * @var string
38+ */
39+ private $ partnerId ;
40+
3441 /**
3542 * Contains the HTTP client (Guzzle)
3643 * @var Client
@@ -48,10 +55,11 @@ class Connection
4855 * @param string $apiKey API key for SendCloud
4956 * @param string $apiSecret API secret for SendCloud
5057 */
51- public function __construct ($ apiKey , $ apiSecret )
58+ public function __construct ($ apiKey , $ apiSecret, $ partnerId = null )
5259 {
5360 $ this ->apiKey = $ apiKey ;
5461 $ this ->apiSecret = $ apiSecret ;
62+ $ this ->partnerId = $ partnerId ;
5563 }
5664
5765 /**
@@ -76,6 +84,10 @@ public function client()
7684 'handler ' => $ handlerStack
7785 ];
7886
87+ if (! is_null ($ this ->partnerId )) {
88+ $ clientConfig ['headers ' ]['Sendcloud-Partner-Id ' ] = $ this ->partnerId ;
89+ }
90+
7991 $ this ->client = new Client ($ clientConfig );
8092
8193 return $ this ->client ;
You can’t perform that action at this time.
0 commit comments