Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33534a1

Browse files
author
clousale
authored
Merge pull request clousale#11 from kartman5/master
SellerApi return Request error solve
2 parents f0c8e67 + e711ea4 commit 33534a1

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

lib/Api/SellersApi.php

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* SellersApi
45
* PHP version 5
@@ -147,7 +148,7 @@ public function getMarketplaceParticipationsWithHttpInfo()
147148
$content = $responseBody; //stream goes to serializer
148149
} else {
149150
$content = $responseBody->getContents();
150-
if (!in_array($returnType, ['string','integer','bool'])) {
151+
if (!in_array($returnType, ['string', 'integer', 'bool'])) {
151152
$content = json_decode($content);
152153
}
153154
}
@@ -157,7 +158,6 @@ public function getMarketplaceParticipationsWithHttpInfo()
157158
$response->getStatusCode(),
158159
$response->getHeaders()
159160
];
160-
161161
} catch (ApiException $e) {
162162
switch ($e->getCode()) {
163163
case 200:
@@ -359,10 +359,8 @@ protected function getMarketplaceParticipationsRequest()
359359
}
360360
// for HTTP post (form)
361361
$httpBody = new MultipartStream($multipartContents);
362-
363362
} elseif ($headers['Content-Type'] === 'application/json') {
364363
$httpBody = \GuzzleHttp\json_encode($formParams);
365-
366364
} else {
367365
// for HTTP post (form)
368366
$httpBody = \GuzzleHttp\Psr7\build_query($formParams);
@@ -372,16 +370,30 @@ protected function getMarketplaceParticipationsRequest()
372370
$query = \GuzzleHttp\Psr7\build_query($queryParams);
373371

374372
$sign = new SignatureSellingPartner();
375-
$headersX = $sign->calculateSignature($this->config->getApiKey("accessKey"),
376-
$this->config->getApiKey("secretKey"), $this->config->getApiKey("region"),
377-
$this->config->getAccessToken(), $this->config->getUserAgent(), str_replace("https://", "", $this->config->getHost()),
378-
'GET', $resourcePath, $query);
373+
$headersX = $sign->calculateSignature(
374+
$this->config->getApiKey("accessKey"),
375+
$this->config->getApiKey("secretKey"),
376+
$this->config->getApiKey("region"),
377+
$this->config->getAccessToken(),
378+
$this->config->getUserAgent(),
379+
str_replace("https://", "", $this->config->getHost()),
380+
'GET',
381+
$resourcePath,
382+
$query
383+
);
379384

380385
$headers = array_merge(
381386
$headerParams,
382387
$headers,
383388
$headersX
384389
);
390+
391+
return new Request(
392+
'GET',
393+
$this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
394+
$headers,
395+
$httpBody
396+
);
385397
}
386398

387399
/**

0 commit comments

Comments
 (0)