Permalink
Browse files

Bugfix. close #359, #362, EasyWeChat/docs#23

  • Loading branch information...
1 parent 99dbe18 commit 0f9fd9dacf97661057475b60d6141ed73d458174 @overtrue committed Mar 26, 2016
Showing with 8 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +7 −3 src/Payment/Payment.php
View
@@ -5,3 +5,4 @@ sftp-config.json
/.idea
/coverage
/.split
+/composer.lock
@@ -20,7 +20,7 @@
*/
namespace EasyWeChat\Payment;
-use EasyWeChat\Core\AccessToken;
+use Overtrue\Socialite\AccessTokenInterface;
use EasyWeChat\Core\Exceptions\FaultException;
use EasyWeChat\Support\Url as UrlHelper;
use EasyWeChat\Support\XML;
@@ -164,13 +164,17 @@ public function configForAppPayment($prepayId)
/**
* Generate js config for share user address.
*
- * @param string $accessToken
+ * @param string|\Overtrue\Socialite\AccessTokenInterface $accessToken
* @param bool $json
*
* @return string|array
*/
public function configForShareAddress($accessToken, $json = true)
{
+ if ($accessToken instanceof AccessTokenInterface) {
+ $accessToken = $accessToken->getToken();
+ }
+
$params = [
'appId' => $this->merchant->app_id,
'scope' => 'jsapi_address',
@@ -184,7 +188,7 @@ public function configForShareAddress($accessToken, $json = true)
'url' => UrlHelper::current(),
'timestamp' => $params['timeStamp'],
'noncestr' => $params['nonceStr'],
- 'accesstoken' => $accessToken,
+ 'accesstoken' => strval($accessToken),
];
ksort($signParams);

0 comments on commit 0f9fd9d

Please sign in to comment.