@@ -38,7 +38,7 @@ class OAuthTokenCredential extends PayPalResourceModel
3838 *
3939 * @var string $clientId
4040 */
41- private $ clientId ;
41+ private $ clientId ;
4242
4343 /**
4444 * Client secret as obtained from the developer portal
@@ -76,7 +76,7 @@ class OAuthTokenCredential extends PayPalResourceModel
7676 private $ cipher ;
7777
7878 /**
79- * The encryted account number of the merchant on whose behalf the transaction is being done
79+ * The encrypted account number of the merchant on whose behalf the transaction is being done
8080 *
8181 * @var Subject
8282 */
@@ -140,8 +140,9 @@ public function getAccessToken($config)
140140 if ($ this ->accessToken && (time () - $ this ->tokenCreateTime ) < ($ this ->tokenExpiresIn - self ::$ expiryBufferTime )) {
141141 return $ this ->accessToken ;
142142 }
143+
143144 // Check for persisted data first
144- $ token = AuthorizationCache::pull ($ config , $ this ->clientId );
145+ $ token = AuthorizationCache::pull ($ config , $ this ->clientId , $ this -> subject );
145146 if ($ token ) {
146147 // We found it
147148 // This code block is for backward compatibility only.
@@ -154,7 +155,7 @@ public function getAccessToken($config)
154155
155156 // Case where we have an old unencrypted cache file
156157 if (!array_key_exists ('accessTokenEncrypted ' , $ token )) {
157- AuthorizationCache::push ($ config , $ this ->clientId , $ this ->encrypt ($ this ->accessToken ), $ this ->tokenCreateTime , $ this ->tokenExpiresIn );
158+ AuthorizationCache::push ($ config , $ this ->clientId , $ this ->encrypt ($ this ->accessToken ), $ this ->tokenCreateTime , $ this ->tokenExpiresIn , $ this -> subject );
158159 } else {
159160 $ this ->accessToken = $ this ->decrypt ($ token ['accessTokenEncrypted ' ]);
160161 }
@@ -177,7 +178,7 @@ public function getAccessToken($config)
177178 if ($ this ->accessToken == null ) {
178179 // Get a new one by making calls to API
179180 $ this ->updateAccessToken ($ config );
180- AuthorizationCache::push ($ config , $ this ->clientId , $ this ->encrypt ($ this ->accessToken ), $ this ->tokenCreateTime , $ this ->tokenExpiresIn );
181+ AuthorizationCache::push ($ config , $ this ->clientId , $ this ->encrypt ($ this ->accessToken ), $ this ->tokenCreateTime , $ this ->tokenExpiresIn , $ this -> subject );
181182 }
182183
183184 return $ this ->accessToken ;
@@ -287,7 +288,7 @@ private function generateAccessToken($config, $refreshToken = null)
287288 $ params ['refresh_token ' ] = $ refreshToken ;
288289 }
289290
290- if ($ this ->subject != null && $ refreshToken ! = null ) {
291+ if ($ this ->subject != null && $ refreshToken = = null ) {
291292 $ params ['target_subject ' ] = $ this ->subject ;
292293 }
293294
0 commit comments