Skip to content

Commit 0f9fd9d

Browse files
committed
1 parent 99dbe18 commit 0f9fd9d

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ sftp-config.json
55
/.idea
66
/coverage
77
/.split
8+
/composer.lock

src/Payment/Payment.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121
namespace EasyWeChat\Payment;
2222

23-
use EasyWeChat\Core\AccessToken;
23+
use Overtrue\Socialite\AccessTokenInterface;
2424
use EasyWeChat\Core\Exceptions\FaultException;
2525
use EasyWeChat\Support\Url as UrlHelper;
2626
use EasyWeChat\Support\XML;
@@ -164,13 +164,17 @@ public function configForAppPayment($prepayId)
164164
/**
165165
* Generate js config for share user address.
166166
*
167-
* @param string $accessToken
167+
* @param string|\Overtrue\Socialite\AccessTokenInterface $accessToken
168168
* @param bool $json
169169
*
170170
* @return string|array
171171
*/
172172
public function configForShareAddress($accessToken, $json = true)
173173
{
174+
if ($accessToken instanceof AccessTokenInterface) {
175+
$accessToken = $accessToken->getToken();
176+
}
177+
174178
$params = [
175179
'appId' => $this->merchant->app_id,
176180
'scope' => 'jsapi_address',
@@ -184,7 +188,7 @@ public function configForShareAddress($accessToken, $json = true)
184188
'url' => UrlHelper::current(),
185189
'timestamp' => $params['timeStamp'],
186190
'noncestr' => $params['nonceStr'],
187-
'accesstoken' => $accessToken,
191+
'accesstoken' => strval($accessToken),
188192
];
189193

190194
ksort($signParams);

0 commit comments

Comments
 (0)