|
26 | 26 | from appstoreserverlibrary.models.OrderLookupStatus import OrderLookupStatus |
27 | 27 | from appstoreserverlibrary.models.Platform import Platform |
28 | 28 | from appstoreserverlibrary.models.PlayTime import PlayTime |
29 | | -from appstoreserverlibrary.models.PriceIncreaseStatus import PriceIncreaseStatus |
30 | 29 | from appstoreserverlibrary.models.RefundPreference import RefundPreference |
31 | | -from appstoreserverlibrary.models.RevocationReason import RevocationReason |
32 | 30 | from appstoreserverlibrary.models.SendAttemptItem import SendAttemptItem |
33 | 31 | from appstoreserverlibrary.models.SendAttemptResult import SendAttemptResult |
34 | 32 | from appstoreserverlibrary.models.Status import Status |
35 | 33 | from appstoreserverlibrary.models.SubscriptionGroupIdentifierItem import SubscriptionGroupIdentifierItem |
36 | 34 | from appstoreserverlibrary.models.Subtype import Subtype |
37 | 35 | from appstoreserverlibrary.models.TransactionHistoryRequest import Order, ProductType, TransactionHistoryRequest |
38 | | -from appstoreserverlibrary.models.TransactionReason import TransactionReason |
39 | | -from appstoreserverlibrary.models.Type import Type |
| 36 | +from appstoreserverlibrary.models.UpdateAppAccountTokenRequest import UpdateAppAccountTokenRequest |
40 | 37 | from appstoreserverlibrary.models.UserStatus import UserStatus |
41 | 38 |
|
42 | 39 | from tests.util import decode_json_from_signed_date, read_data_from_binary_file, read_data_from_file |
@@ -495,6 +492,75 @@ def test_get_transaction_history_with_malformed_app_apple_id(self): |
495 | 492 |
|
496 | 493 | self.assertFalse(True) |
497 | 494 |
|
| 495 | + def test_set_app_account_token(self): |
| 496 | + client = self.get_client_with_body(b'', |
| 497 | + 'PUT', |
| 498 | + 'https://local-testing-base-url/inApps/v1/transactions/49571273/appAccountToken', |
| 499 | + {}, |
| 500 | + { |
| 501 | + 'appAccountToken': '7389a31a-fb6d-4569-a2a6-db7d85d84813' |
| 502 | + }) |
| 503 | + update_app_account_token_request = UpdateAppAccountTokenRequest(appAccountToken='7389a31a-fb6d-4569-a2a6-db7d85d84813') |
| 504 | + client.set_app_account_token('49571273', update_app_account_token_request) |
| 505 | + |
| 506 | + def test_invalid_app_account_token_error(self): |
| 507 | + client = self.get_client_with_body_from_file('tests/resources/models/invalidAppAccountTokenUUIDError.json', |
| 508 | + 'PUT', |
| 509 | + 'https://local-testing-base-url/inApps/v1/transactions/49571273/appAccountToken', |
| 510 | + {}, |
| 511 | + None, |
| 512 | + 400) |
| 513 | + try: |
| 514 | + client.set_app_account_token('49571273', None) |
| 515 | + except APIException as e: |
| 516 | + self.assertEqual(400, e.http_status_code) |
| 517 | + self.assertEqual(4000183, e.raw_api_error) |
| 518 | + self.assertEqual(APIError.INVALID_APP_ACCOUNT_TOKEN_UUID_ERROR, e.api_error) |
| 519 | + self.assertEqual("Invalid request. The app account token field must be a valid UUID.", e.error_message) |
| 520 | + return |
| 521 | + |
| 522 | + self.assertFalse(True) |
| 523 | + |
| 524 | + def test_family_transaction_not_supported_error(self): |
| 525 | + client = self.get_client_with_body_from_file('tests/resources/models/familyTransactionNotSupportedError.json', |
| 526 | + 'PUT', |
| 527 | + 'https://local-testing-base-url/inApps/v1/transactions/1234' |
| 528 | + '/appAccountToken', |
| 529 | + {}, |
| 530 | + None, |
| 531 | + 400) |
| 532 | + try: |
| 533 | + client.set_app_account_token('1234', None) |
| 534 | + except APIException as e: |
| 535 | + self.assertEqual(400, e.http_status_code) |
| 536 | + self.assertEqual(4000185, e.raw_api_error) |
| 537 | + self.assertEqual(APIError.FAMILY_TRANSACTION_NOT_SUPPORTED_ERROR, e.api_error) |
| 538 | + self.assertEqual("Invalid request. Family Sharing transactions aren't supported by this endpoint.", e.error_message) |
| 539 | + return |
| 540 | + |
| 541 | + self.assertFalse(True) |
| 542 | + |
| 543 | + def test_transaction_id_not_original_transaction_id_error(self): |
| 544 | + client = self.get_client_with_body_from_file( |
| 545 | + 'tests/resources/models/transactionIdNotOriginalTransactionId.json', |
| 546 | + 'PUT', |
| 547 | + 'https://local-testing-base-url/inApps/v1/transactions/1234' |
| 548 | + '/appAccountToken', |
| 549 | + {}, |
| 550 | + None, |
| 551 | + 400) |
| 552 | + try: |
| 553 | + client.set_app_account_token('1234', None) |
| 554 | + except APIException as e: |
| 555 | + self.assertEqual(400, e.http_status_code) |
| 556 | + self.assertEqual(4000187, e.raw_api_error) |
| 557 | + self.assertEqual(APIError.TRANSACTION_ID_IS_NOT_ORIGINAL_TRANSACTION_ID_ERROR, e.api_error) |
| 558 | + self.assertEqual("Invalid request. The transaction ID provided is not an original transaction ID.", e.error_message) |
| 559 | + return |
| 560 | + |
| 561 | + self.assertFalse(True) |
| 562 | + |
| 563 | + |
498 | 564 | def get_signing_key(self): |
499 | 565 | return read_data_from_binary_file('tests/resources/certs/testSigningKey.p8') |
500 | 566 |
|
|
0 commit comments