Skip to content

Commit 8e2a1ed

Browse files
authored
jwtSubject renamed to jwtToken (unit-finance#163)
1 parent 3e64c6e commit 8e2a1ed

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

e2e_tests/customerToken_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ def test_create_token():
1313
response = client.customerTokens.create_token(request)
1414
assert response.data.type == "customerBearerToken"
1515

16+
1617
def test_create_jwt_token():
1718
account_id = create_individual_customer()
1819
request = CreateCustomerToken(account_id, "customers accounts",
19-
jwt_subject="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9fQ")
20+
jwt_token="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlZPV3VLR1R4eFlwRUNWSlAwdDRTNiJ9.eyJpc3MiOiJodHRwczovL2Rldi04NTRvbjk3dC51cy5hdXRoMC5jb20vIiwic3ViIjoiYkpjUkQ1SHo2eWRDWXlaTDVnTjE4MXo0OGxKamFOQURAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vZGV2LTg1NG9uOTd0LnVzLmF1dGgwLmNvbS9hcGkvdjIvIiwiaWF0IjoxNjQyOTMwNDA5LCJleHAiOjE2NDMwMTY4MDksImF6cCI6ImJKY1JENUh6NnlkQ1l5Wkw1Z04xODF6NDhsSmphTkFEIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.DCF_ODpiBPhn-fcr-FF3-Ayf6fq9g8UjSqTssfvdALNxZDQMGXaQeCIisy2NLrhF81PHAX3dZzcZbpeO93OlOAomXlaVzNomEd-pCLvjv1dQoQRc2BB3IMWUxbPBdGV7kztJzIfUwrOBTNV-DqSdB4SoGYROveFa3An4Mlj2FjArTXDXhnUytq15X5p_k4zLLNzznHVd-Tdcnd7hz9sA1vvtWXu")
2021
response = client.customerTokens.create_token(request)
2122
assert response.data.type == "customerBearerToken"
2223

24+
2325
def test_create_token_verification():
2426
account_id = create_individual_customer()
2527
request = CreateCustomerTokenVerification(account_id, "sms")

unit/models/customerToken.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unit.models import *
22

3+
34
class CustomerTokenDTO(object):
45
def __init__(self, token: str, expires_in: int):
56
self.type = "customerBearerToken"
@@ -9,6 +10,7 @@ def __init__(self, token: str, expires_in: int):
910
def from_json_api(_id, _type, attributes, relationships):
1011
return CustomerTokenDTO(attributes["token"], attributes["expiresIn"])
1112

13+
1214
class CustomerVerificationTokenDTO(object):
1315
def __init__(self, verification_token: str):
1416
self.type = "customerTokenVerification"
@@ -22,13 +24,13 @@ def from_json_api(_id, _type, attributes, relationships):
2224
class CreateCustomerToken(UnitRequest):
2325
def __init__(self, customer_id: str, scope: str, verification_token: Optional[str] = None,
2426
verification_code: Optional[str] = None, expires_in: Optional[int] = None,
25-
jwt_subject: Optional[str] = None):
27+
jwt_token: Optional[str] = None):
2628
self.customer_id = customer_id
2729
self.scope = scope
2830
self.verification_token = verification_token
2931
self.verification_code = verification_code
3032
self.expires_in = expires_in
31-
self.jwt_subject = jwt_subject
33+
self.jwt_token = jwt_token
3234

3335
def to_json_api(self) -> Dict:
3436
payload = {
@@ -49,8 +51,8 @@ def to_json_api(self) -> Dict:
4951
if self.verification_code:
5052
payload["data"]["attributes"]["verificationCode"] = self.verification_code
5153

52-
if self.jwt_subject:
53-
payload["data"]["attributes"]["jwtSubject"] = self.jwt_subject
54+
if self.jwt_token:
55+
payload["data"]["attributes"]["jwtToken"] = self.jwt_token
5456

5557
return payload
5658

0 commit comments

Comments
 (0)