File tree Expand file tree Collapse file tree 4 files changed +24
-7
lines changed Expand file tree Collapse file tree 4 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,10 @@ namespace PayPalCheckoutSdk.Core
6
6
{
7
7
[ DataContract ]
8
8
public class AccessToken
9
- {
9
+ {
10
+ private DateTime _createDate ;
11
+ private int expiresIn ;
12
+
10
13
[ DataMember ( Name = "access_token" ) ]
11
14
[ JsonPropertyName ( "access_token" ) ]
12
15
public string ? Token { get ; set ; }
@@ -17,10 +20,24 @@ public class AccessToken
17
20
18
21
[ DataMember ( Name = "expires_in" ) ]
19
22
[ JsonPropertyName ( "expires_in" ) ]
20
- public int ExpiresIn { get ; set ; }
21
-
22
- private readonly DateTime _createDate ;
23
+ public int ExpiresIn
24
+ {
25
+ get => expiresIn ;
26
+ set
27
+ {
28
+ expiresIn = value ;
29
+ //Fixes a bug where an implicit cast does not set the _createdDate
30
+ if ( _createDate == DateTime . MinValue )
31
+ {
32
+ _createDate = DateTime . UtcNow ;
33
+ }
34
+ }
35
+ }
23
36
37
+ /// <summary>
38
+ /// This constructor sometimes does not set the _createdDate
39
+ /// because the HttpClient does an implicit cast for the result and does not create a new instance of this object
40
+ /// </summary>
24
41
public AccessToken ( )
25
42
{
26
43
_createDate = DateTime . UtcNow ;
Original file line number Diff line number Diff line change 3
3
<PropertyGroup >
4
4
<TargetFrameworks >net6.0;net7.0</TargetFrameworks >
5
5
<LangVersion >11.0</LangVersion >
6
- <Version >2.0.0 </Version >
6
+ <Version >2.0.1 </Version >
7
7
<Nullable >enable</Nullable >
8
8
<Owners >David Melendez</Owners >
9
9
<RepositoryType >git</RepositoryType >
Original file line number Diff line number Diff line change 3
3
<PropertyGroup >
4
4
<OutputType >Exe</OutputType >
5
5
<TargetFramework >net6.0</TargetFramework >
6
- <PackageVersion >2.0.0 </PackageVersion >
6
+ <PackageVersion >2.0.1 </PackageVersion >
7
7
</PropertyGroup >
8
8
9
9
<ItemGroup >
Original file line number Diff line number Diff line change 2
2
3
3
<PropertyGroup >
4
4
<TargetFrameworks >net6.0;net7.0</TargetFrameworks >
5
- <PackageVersion >2.0.0 </PackageVersion >
5
+ <PackageVersion >2.0.1 </PackageVersion >
6
6
<IsPackable >false</IsPackable >
7
7
<UserSecretsId >4dbe0d9e-0d79-4e71-b5dd-44b90dbe3ee9</UserSecretsId >
8
8
</PropertyGroup >
You can’t perform that action at this time.
0 commit comments